Commit de3a6b962445e82a019e03c7ffa4e2b78a42022f

Authored by Artem Babak
1 parent 712a14ec

Edge Component: checkIsNewEdge method refactored

... ... @@ -83,7 +83,7 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> {
83 83 )
84 84 }
85 85 );
86   - this.checkIsNewEdge(entity, form);
  86 + this.generateRoutingKeyAndSecret(entity, form);
87 87 return form;
88 88 }
89 89
... ... @@ -100,7 +100,7 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> {
100 100 description: entity.additionalInfo ? entity.additionalInfo.description : ''
101 101 }
102 102 });
103   - this.checkIsNewEdge(entity, this.entityForm);
  103 + this.generateRoutingKeyAndSecret(entity, this.entityForm);
104 104 }
105 105
106 106 updateFormState() {
... ... @@ -109,13 +109,6 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> {
109 109 this.entityForm.get('secret').disable({emitEvent: false});
110 110 }
111 111
112   - private checkIsNewEdge(entity: EdgeInfo, form: FormGroup) {
113   - if (entity && !entity.id) {
114   - form.get('routingKey').patchValue(guid(), {emitEvent: false});
115   - form.get('secret').patchValue(generateSecret(20), {emitEvent: false});
116   - }
117   - }
118   -
119 112 onEdgeIdCopied($event) {
120 113 this.store.dispatch(new ActionNotificationShow(
121 114 {
... ... @@ -139,4 +132,11 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> {
139 132 horizontalPosition: 'right'
140 133 }));
141 134 }
  135 +
  136 + private generateRoutingKeyAndSecret(entity: EdgeInfo, form: FormGroup) {
  137 + if (entity && !entity.id) {
  138 + form.get('routingKey').patchValue(guid(), {emitEvent: false});
  139 + form.get('secret').patchValue(generateSecret(20), {emitEvent: false});
  140 + }
  141 + }
142 142 }
... ...