Browse Source

Move ruleChainType assignment from validateImportedRuleChain() to importRuleChain()

pull/3811/head
Artem Babak 6 years ago
parent
commit
226f7f4eba
  1. 6
      ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts

6
ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts

@ -406,6 +406,9 @@ export class ImportExportService {
public importRuleChain(expectedRuleChainType: RuleChainType): Observable<RuleChainImport> { public importRuleChain(expectedRuleChainType: RuleChainType): Observable<RuleChainImport> {
return this.openImportDialog('rulechain.import', 'rulechain.rulechain-file').pipe( return this.openImportDialog('rulechain.import', 'rulechain.rulechain-file').pipe(
mergeMap((ruleChainImport: RuleChainImport) => { mergeMap((ruleChainImport: RuleChainImport) => {
if (isUndefined(ruleChainImport.ruleChain.type)) {
ruleChainImport.ruleChain.type = ruleChainType.core;
}
if (!this.validateImportedRuleChain(ruleChainImport)) { if (!this.validateImportedRuleChain(ruleChainImport)) {
this.store.dispatch(new ActionNotificationShow( this.store.dispatch(new ActionNotificationShow(
{message: this.translate.instant('rulechain.invalid-rulechain-file-error'), {message: this.translate.instant('rulechain.invalid-rulechain-file-error'),
@ -469,9 +472,6 @@ export class ImportExportService {
|| isUndefined(ruleChainImport.ruleChain.name)) { || isUndefined(ruleChainImport.ruleChain.name)) {
return false; return false;
} }
if (isUndefined(ruleChainImport.ruleChain.type)) {
ruleChainImport.ruleChain.type = ruleChainType.core;
}
return true; return true;
} }

Loading…
Cancel
Save