Add campaign manager
This commit is contained in:
@ -13,10 +13,10 @@
|
||||
@attribute [Authorize]
|
||||
|
||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
@inject OperationService OperationService
|
||||
@inject HeadquartersService HeadquartersService
|
||||
@inject RegistryService RegistryService
|
||||
@inject DialogService DialogService
|
||||
@inject OperationExecutionState OperationExecutionState
|
||||
@inject CampaignManagementState CampaignManagementState
|
||||
|
||||
<PageTitle>Общие справочники подсистемы НСИ</PageTitle>
|
||||
|
||||
@ -83,7 +83,7 @@
|
||||
var state = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
if (state.User.IsInRole(AppRole.ADMINISTRATOR_TYPE) || state.User.IsInRole(AppRole.OPERATOR_TYPE))
|
||||
{
|
||||
var operationInProgress = await OperationService.HasActiveOperationAsync(Operation.OperationType.NsiCommon_15_7_0_1_ExportAllRegistryElements);
|
||||
var operationInProgress = await HeadquartersService.HasActiveCampaignAsync(Campaign.CampaignType.ExportRequiredRegistryElements_15_7_0_1);
|
||||
if (operationInProgress)
|
||||
{
|
||||
finalState = CommonPageState.OperationWaiting;
|
||||
@ -93,7 +93,7 @@
|
||||
registries = await RegistryService.GetAllRegistriesAsync(true);
|
||||
}
|
||||
|
||||
OperationExecutionState.OnOperationStarted += OnOperationStarted;
|
||||
CampaignManagementState.OnCampaignStarted += OnCampaignStarted;
|
||||
}
|
||||
|
||||
ChangeState(finalState);
|
||||
@ -106,14 +106,15 @@
|
||||
|
||||
ChangeState(CommonPageState.OperationWaiting);
|
||||
|
||||
if (await OperationService.HasActiveOperationAsync(Operation.OperationType.NsiCommon_15_7_0_1_ExportAllRegistryElements))
|
||||
if (await HeadquartersService.HasActiveCampaignAsync(Campaign.CampaignType.ExportRequiredRegistryElements_15_7_0_1))
|
||||
{
|
||||
ChangeState(CommonPageState.Idle);
|
||||
}
|
||||
else
|
||||
{
|
||||
var operation = await OperationService.InitiateOperationAsync(Operation.OperationType.NsiCommon_15_7_0_1_ExportAllRegistryElements, "");
|
||||
OperationExecutionState.EnqueueOperation(operation);
|
||||
// TODO: Use user id
|
||||
var campaign = await HeadquartersService.InitiateCampaignAsync(Campaign.CampaignType.ExportRequiredRegistryElements_15_7_0_1, "");
|
||||
CampaignManagementState.EnqueueCampaign(campaign);
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,9 +162,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
void OnOperationStarted(Operation operation)
|
||||
void OnCampaignStarted(Campaign campaign)
|
||||
{
|
||||
if (operation.Type == Operation.OperationType.NsiCommon_15_7_0_1_ExportAllRegistryElements)
|
||||
if (campaign.Type == Campaign.CampaignType.ExportRequiredRegistryElements_15_7_0_1)
|
||||
{
|
||||
InvokeAsync(() => ChangeState(CommonPageState.OperationWaiting));
|
||||
}
|
||||
@ -171,6 +172,6 @@
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
OperationExecutionState.OnOperationStarted -= OnOperationStarted;
|
||||
CampaignManagementState.OnCampaignStarted -= OnCampaignStarted;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user