|
|
@ -17,15 +17,15 @@ |
|
|
import { |
|
|
import { |
|
|
AfterViewInit, |
|
|
AfterViewInit, |
|
|
Component, |
|
|
Component, |
|
|
ElementRef, |
|
|
ElementRef, EventEmitter, |
|
|
HostBinding, |
|
|
HostBinding, |
|
|
Inject, |
|
|
Inject, |
|
|
OnDestroy, |
|
|
OnDestroy, |
|
|
OnInit, |
|
|
OnInit, |
|
|
QueryList, |
|
|
QueryList, Renderer2, |
|
|
SkipSelf, |
|
|
SkipSelf, |
|
|
ViewChild, |
|
|
ViewChild, |
|
|
ViewChildren, |
|
|
ViewChildren, ViewContainerRef, |
|
|
ViewEncapsulation |
|
|
ViewEncapsulation |
|
|
} from '@angular/core'; |
|
|
} from '@angular/core'; |
|
|
import { PageComponent } from '@shared/components/page.component'; |
|
|
import { PageComponent } from '@shared/components/page.component'; |
|
|
@ -63,7 +63,7 @@ import { |
|
|
} from '@shared/models/rule-node.models'; |
|
|
} from '@shared/models/rule-node.models'; |
|
|
import { FcRuleNodeModel, FcRuleNodeTypeModel, RuleChainMenuContextInfo } from './rulechain-page.models'; |
|
|
import { FcRuleNodeModel, FcRuleNodeTypeModel, RuleChainMenuContextInfo } from './rulechain-page.models'; |
|
|
import { RuleChainService } from '@core/http/rule-chain.service'; |
|
|
import { RuleChainService } from '@core/http/rule-chain.service'; |
|
|
import { fromEvent, NEVER, Observable, of, Subscription } from 'rxjs'; |
|
|
import { fromEvent, NEVER, Observable, of, ReplaySubject, Subscription } from 'rxjs'; |
|
|
import { debounceTime, distinctUntilChanged, mergeMap, tap } from 'rxjs/operators'; |
|
|
import { debounceTime, distinctUntilChanged, mergeMap, tap } from 'rxjs/operators'; |
|
|
import { ISearchableComponent } from '../../models/searchable-component.models'; |
|
|
import { ISearchableComponent } from '../../models/searchable-component.models'; |
|
|
import { deepClone } from '@core/utils'; |
|
|
import { deepClone } from '@core/utils'; |
|
|
@ -75,6 +75,11 @@ import { ItemBufferService, RuleNodeConnection } from '@core/services/item-buffe |
|
|
import { Hotkey } from 'angular2-hotkeys'; |
|
|
import { Hotkey } from 'angular2-hotkeys'; |
|
|
import { DebugEventType, EventType } from '@shared/models/event.models'; |
|
|
import { DebugEventType, EventType } from '@shared/models/event.models'; |
|
|
import Timeout = NodeJS.Timeout; |
|
|
import Timeout = NodeJS.Timeout; |
|
|
|
|
|
import { MatButton } from '@angular/material/button'; |
|
|
|
|
|
import { TbPopoverService } from '@shared/components/popover.service'; |
|
|
|
|
|
import { EntityVersionCreateComponent } from '@home/components/vc/entity-version-create.component'; |
|
|
|
|
|
import { VersionCreationResult } from '@shared/models/vc.models'; |
|
|
|
|
|
import { VersionControlComponent } from '@home/components/vc/version-control.component'; |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
selector: 'tb-rulechain-page', |
|
|
selector: 'tb-rulechain-page', |
|
|
@ -231,6 +236,8 @@ export class RuleChainPageComponent extends PageComponent |
|
|
|
|
|
|
|
|
flowchartConstants = FlowchartConstants; |
|
|
flowchartConstants = FlowchartConstants; |
|
|
|
|
|
|
|
|
|
|
|
updateBreadcrumbs = new EventEmitter(); |
|
|
|
|
|
|
|
|
private rxSubscription: Subscription; |
|
|
private rxSubscription: Subscription; |
|
|
|
|
|
|
|
|
private tooltipTimeout: Timeout; |
|
|
private tooltipTimeout: Timeout; |
|
|
@ -242,11 +249,13 @@ export class RuleChainPageComponent extends PageComponent |
|
|
private authService: AuthService, |
|
|
private authService: AuthService, |
|
|
private translate: TranslateService, |
|
|
private translate: TranslateService, |
|
|
private itembuffer: ItemBufferService, |
|
|
private itembuffer: ItemBufferService, |
|
|
|
|
|
private popoverService: TbPopoverService, |
|
|
|
|
|
private renderer: Renderer2, |
|
|
|
|
|
private viewContainerRef: ViewContainerRef, |
|
|
public dialog: MatDialog, |
|
|
public dialog: MatDialog, |
|
|
public dialogService: DialogService, |
|
|
public dialogService: DialogService, |
|
|
public fb: FormBuilder) { |
|
|
public fb: FormBuilder) { |
|
|
super(store); |
|
|
super(store); |
|
|
|
|
|
|
|
|
this.rxSubscription = this.route.data.subscribe( |
|
|
this.rxSubscription = this.route.data.subscribe( |
|
|
() => { |
|
|
() => { |
|
|
this.reset(); |
|
|
this.reset(); |
|
|
@ -1376,7 +1385,8 @@ export class RuleChainPageComponent extends PageComponent |
|
|
}, 0); |
|
|
}, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
saveRuleChain() { |
|
|
saveRuleChain(): Observable<any> { |
|
|
|
|
|
const saveResult = new ReplaySubject(); |
|
|
let saveRuleChainObservable: Observable<RuleChain>; |
|
|
let saveRuleChainObservable: Observable<RuleChain>; |
|
|
if (this.isImport) { |
|
|
if (this.isImport) { |
|
|
saveRuleChainObservable = this.ruleChainService.saveRuleChain(this.ruleChain); |
|
|
saveRuleChainObservable = this.ruleChainService.saveRuleChain(this.ruleChain); |
|
|
@ -1442,6 +1452,20 @@ export class RuleChainPageComponent extends PageComponent |
|
|
} else { |
|
|
} else { |
|
|
this.createRuleChainModel(); |
|
|
this.createRuleChainModel(); |
|
|
} |
|
|
} |
|
|
|
|
|
saveResult.next(); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
return saveResult; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
reloadRuleChain() { |
|
|
|
|
|
this.ruleChainService.getRuleChain(this.ruleChain.id.id).subscribe((ruleChain) => { |
|
|
|
|
|
this.ruleChain = ruleChain; |
|
|
|
|
|
this.updateBreadcrumbs.emit(); |
|
|
|
|
|
this.ruleChainService.getRuleChainMetadata(this.ruleChain.id.id).subscribe((ruleChainMetaData) => { |
|
|
|
|
|
this.ruleChainMetaData = ruleChainMetaData; |
|
|
|
|
|
this.isDirtyValue = false; |
|
|
|
|
|
this.createRuleChainModel(); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
@ -1509,6 +1533,38 @@ export class RuleChainPageComponent extends PageComponent |
|
|
}).afterClosed(); |
|
|
}).afterClosed(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
toggleVersionControl($event: Event, versionControlButton: MatButton) { |
|
|
|
|
|
if ($event) { |
|
|
|
|
|
$event.stopPropagation(); |
|
|
|
|
|
} |
|
|
|
|
|
const trigger = versionControlButton._elementRef.nativeElement; |
|
|
|
|
|
if (this.popoverService.hasPopover(trigger)) { |
|
|
|
|
|
this.popoverService.hidePopover(trigger); |
|
|
|
|
|
} else { |
|
|
|
|
|
const versionControlPopover = this.popoverService.displayPopover(trigger, this.renderer, |
|
|
|
|
|
this.viewContainerRef, VersionControlComponent, 'leftTop', true, null, |
|
|
|
|
|
{ |
|
|
|
|
|
detailsMode: true, |
|
|
|
|
|
popoverMode: true, |
|
|
|
|
|
active: true, |
|
|
|
|
|
singleEntityMode: true, |
|
|
|
|
|
externalEntityId: this.ruleChain.externalId || this.ruleChain.id, |
|
|
|
|
|
entityId: this.ruleChain.id, |
|
|
|
|
|
entityName: this.ruleChain.name, |
|
|
|
|
|
onBeforeCreateVersion: () => { |
|
|
|
|
|
if (this.isDirty) { |
|
|
|
|
|
return this.saveRuleChain(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return of(null); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}, {width: '800px', height: '600px'}, {}, {}, true); |
|
|
|
|
|
versionControlPopover.tbComponentRef.instance.versionRestored.subscribe(() => { |
|
|
|
|
|
this.reloadRuleChain(); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private updateNodeErrorTooltip(node: FcRuleNode) { |
|
|
private updateNodeErrorTooltip(node: FcRuleNode) { |
|
|
if (node.error) { |
|
|
if (node.error) { |
|
|
const element = $('#' + node.id); |
|
|
const element = $('#' + node.id); |
|
|
|