|
|
|
@ -77,8 +77,8 @@ import { |
|
|
|
} from '@shared/models/rule-node.models'; |
|
|
|
import { FcRuleNodeModel, FcRuleNodeTypeModel, RuleChainMenuContextInfo } from './rulechain-page.models'; |
|
|
|
import { RuleChainService } from '@core/http/rule-chain.service'; |
|
|
|
import { NEVER, Observable, of, ReplaySubject, skip, startWith, Subject } from 'rxjs'; |
|
|
|
import { debounceTime, distinctUntilChanged, mergeMap, takeUntil, tap } from 'rxjs/operators'; |
|
|
|
import { NEVER, Observable, of, ReplaySubject, skip, startWith, Subject, throwError } from 'rxjs'; |
|
|
|
import { catchError, debounceTime, distinctUntilChanged, mergeMap, takeUntil, tap } from 'rxjs/operators'; |
|
|
|
import { ISearchableComponent } from '../../models/searchable-component.models'; |
|
|
|
import { deepClone, isDefinedAndNotNull } from '@core/utils'; |
|
|
|
import { RuleNodeDetailsComponent } from '@home/pages/rulechain/rule-node-details.component'; |
|
|
|
@ -93,6 +93,7 @@ import { TbPopoverService } from '@shared/components/popover.service'; |
|
|
|
import { VersionControlComponent } from '@home/components/vc/version-control.component'; |
|
|
|
import { ComponentClusteringMode } from '@shared/models/component-descriptor.models'; |
|
|
|
import { MatDrawer } from '@angular/material/sidenav'; |
|
|
|
import { HttpStatusCode } from '@angular/common/http'; |
|
|
|
import Timeout = NodeJS.Timeout; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
@ -1282,7 +1283,9 @@ export class RuleChainPageComponent extends PageComponent |
|
|
|
onDebugEventSelected(debugEventBody: DebugRuleNodeEventBody) { |
|
|
|
const ruleNodeConfigComponent = this.ruleNodeComponent.ruleNodeConfigComponent; |
|
|
|
const ruleNodeConfigDefinedComponent = ruleNodeConfigComponent.definedConfigComponent; |
|
|
|
if (ruleNodeConfigComponent.useDefinedDirective() && ruleNodeConfigDefinedComponent.hasScript && ruleNodeConfigDefinedComponent.testScript) { |
|
|
|
if (ruleNodeConfigComponent.useDefinedDirective() |
|
|
|
&& ruleNodeConfigDefinedComponent.hasScript |
|
|
|
&& ruleNodeConfigDefinedComponent.testScript) { |
|
|
|
ruleNodeConfigDefinedComponent.testScript(debugEventBody); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1456,7 +1459,8 @@ export class RuleChainPageComponent extends PageComponent |
|
|
|
const ruleChainMetaData: RuleChainMetaData = { |
|
|
|
ruleChainId: this.ruleChain.id, |
|
|
|
nodes: [], |
|
|
|
connections: [] |
|
|
|
connections: [], |
|
|
|
version: ruleChain.version |
|
|
|
}; |
|
|
|
const nodes: FcRuleNode[] = []; |
|
|
|
this.ruleChainModel.nodes.forEach((node) => { |
|
|
|
@ -1465,7 +1469,9 @@ export class RuleChainPageComponent extends PageComponent |
|
|
|
id: node.ruleNodeId, |
|
|
|
type: node.component.clazz, |
|
|
|
name: node.name, |
|
|
|
configurationVersion: isDefinedAndNotNull(node.configurationVersion) ? node.configurationVersion : node.component.configurationVersion, |
|
|
|
configurationVersion: isDefinedAndNotNull(node.configurationVersion) |
|
|
|
? node.configurationVersion |
|
|
|
: node.component.configurationVersion, |
|
|
|
configuration: node.configuration, |
|
|
|
additionalInfo: node.additionalInfo ? node.additionalInfo : {}, |
|
|
|
debugMode: node.debugMode, |
|
|
|
@ -1500,20 +1506,30 @@ export class RuleChainPageComponent extends PageComponent |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
this.ruleChainService.saveRuleChainMetadata(ruleChainMetaData).subscribe((savedRuleChainMetaData) => { |
|
|
|
this.ruleChainMetaData = savedRuleChainMetaData; |
|
|
|
if (this.isImport) { |
|
|
|
this.isDirtyValue = false; |
|
|
|
this.isImport = false; |
|
|
|
if (this.ruleChainType !== RuleChainType.EDGE) { |
|
|
|
this.router.navigateByUrl(`ruleChains/${this.ruleChain.id.id}`); |
|
|
|
this.ruleChainService.saveRuleChainMetadata(ruleChainMetaData) |
|
|
|
.pipe( |
|
|
|
catchError(err => { |
|
|
|
if (err.status === HttpStatusCode.Conflict) { |
|
|
|
return this.ruleChainService.getRuleChainMetadata(ruleChainMetaData.ruleChainId.id); |
|
|
|
} |
|
|
|
return throwError(() => err); |
|
|
|
}) |
|
|
|
) |
|
|
|
.subscribe((savedRuleChainMetaData) => { |
|
|
|
this.ruleChain.version = savedRuleChainMetaData.version; |
|
|
|
this.ruleChainMetaData = savedRuleChainMetaData; |
|
|
|
if (this.isImport) { |
|
|
|
this.isDirtyValue = false; |
|
|
|
this.isImport = false; |
|
|
|
if (this.ruleChainType !== RuleChainType.EDGE) { |
|
|
|
this.router.navigateByUrl(`ruleChains/${this.ruleChain.id.id}`); |
|
|
|
} else { |
|
|
|
this.router.navigateByUrl(`edgeManagement/ruleChains/${this.ruleChain.id.id}`); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.router.navigateByUrl(`edgeManagement/ruleChains/${this.ruleChain.id.id}`); |
|
|
|
this.createRuleChainModel(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.createRuleChainModel(); |
|
|
|
} |
|
|
|
saveResult.next(); |
|
|
|
saveResult.next(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return saveResult; |
|
|
|
|