Hi @demirmusa, the problem was one of closure within javascript, as explained in the first answer here: setTimeout not working inside forEach. My refactored code is as below (note the use of the index parameter when setting the timeout at the end.
selectedDocumentTemplates.forEach((item, index) => {
setTimeout(function () {
item = item.replace('dt_', '');
input.ncDocumentTemplateId = item;
console.log(input.ncDocumentTemplateId);
self._ncDocumentService.createDefaultDocument(input)
.subscribe((documentDto) => {
self.newDocumentLoaded.emit(documentDto);
if (index === selectedDocumentTemplates.length - 1) {
self.allDocumentsLoaded.emit(true);
setTimeout(function () {
self.showModalForDocumentsLoading.emit(undefined);
}, 5000);
}
});
}, 5000 * (index + 1));
});
Thanks for your help.
@razkhan78, take a look here: Simple SignalR implementation. It may help, I had a similar problem and the solution is in my last post.
@demirmusa -
If you want to delay between each request you can call second request in first request's subscriber. Thus, all requests run sequentially and with a delay of 10sec between them.
How would that work?
Hi guys, banging my head against a wall here so I thought I would reach out. I have a piece of server code which reads a default Word document store in blob storage. It then carries out a merge with these documents using entity data and then saved back to a different folder in the same container with a similar folder structure but under a unique folder created for the relevant entity. All relevant uri's are persisted in SQL Server for each document review. The cost of this when processing all documents in one go is considerable:
I have changed my server code to deal with individual requests and a delay between each. But I can't put a delay on the angular code so I can debug:
checkedIds.forEach((id) => {
let input = new LoadDefaultDocumentInput();
input.ncEntityId = this.ncEntity.id;
input.ncDocumentTemplateId = id;
//setTimeout(function () {
this._ncDocumentService.createDefaultDocument(input)
.pipe(delay(10000))
.subscribe((response) => {
this.newDocumentLoaded.emit(response);
if (id === _.last(checkedIds)) {
this.allDocumentsLoaded.emit(true);
setTimeout(function () {
this.showModalForDocumentsLoading.emit(false);
}, 5000);
}
});
//}, 10000);
});
Can anyone tell me why this .pipe(delay(10000))
command is not working? I have the requisite import from rxjs:
import { of } from 'rxjs/internal/observable/of';
import { delay, concatMap } from 'rxjs/operators';
Any ideas anyone?
So we have no idea of how to get the count of online uses for each tenant? Is this an impossible request or is there something we can do to facilitate?
@moetarhini, you have chosen Zero to handle all the points raised in the article posted. Calm down and run with the framework, it will all become clear as you get used to it. It seems you're starting out with a new framework and then before you use it you're looking for how it might go wrong. Just start to use Zero, populate it with some data and work out how it works and don't try change it.
Please test and debug. If your Status class has a MayHaveTenant or MustHaveTenant interface the answer is yes, it must belong to same tenant. If it does not belong to the same tenant you have set things up incorrectly. Are status, priority and user selected on the client, do they all belong to the same tenant; are they populated from a call to the server, do they all belong to the same tenant. Please test and debug.
@moetarhini, Listen, I don't mind helping but I can't write your app for you. Why do you need the status, priority and user objects, they have no function in the above code. If you need to get data outside of your current tenant disable the data filter, inject UnitOfWork and refactor as follows:
public async Task CreateTicket(CreateTicketInput input)
{
using (_unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant))
{
var status = _statusRepository.Get(input.StatusId);
var priority = _priorityRepository.Get(input.PriorityId);
var user = _userRepository.Get(input.UserId);
}
await _ticketRepository.InsertAsync(ObjectMapper.Map<Ticket>(input));
}
Hi @ismcagdas, Here is my query for getting summary data for the client. If I iterate around the result how do I get the number of online clients for each tenant?
public async Task<List<GetTenantSummaryDataForHostDashboard_Output>> GetTenantSummaryData(GetHostDashboardDataInput input)
{
var query = await _sQLRepository.GetTenantSummaryDataForHostDashboard(input.From, input.To, input.UserId, 0);
var model = ObjectMapper.Map<List<GetTenantSummaryDataForHostDashboard_Output>>(query.ToList());
return model;
}