Commit de3a6b962445e82a019e03c7ffa4e2b78a42022f
1 parent
712a14ec
Edge Component: checkIsNewEdge method refactored
Showing
1 changed file
with
9 additions
and
9 deletions
@@ -83,7 +83,7 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { | @@ -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 | return form; | 87 | return form; |
88 | } | 88 | } |
89 | 89 | ||
@@ -100,7 +100,7 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { | @@ -100,7 +100,7 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { | ||
100 | description: entity.additionalInfo ? entity.additionalInfo.description : '' | 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 | updateFormState() { | 106 | updateFormState() { |
@@ -109,13 +109,6 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { | @@ -109,13 +109,6 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { | ||
109 | this.entityForm.get('secret').disable({emitEvent: false}); | 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 | onEdgeIdCopied($event) { | 112 | onEdgeIdCopied($event) { |
120 | this.store.dispatch(new ActionNotificationShow( | 113 | this.store.dispatch(new ActionNotificationShow( |
121 | { | 114 | { |
@@ -139,4 +132,11 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { | @@ -139,4 +132,11 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { | ||
139 | horizontalPosition: 'right' | 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 | } |