Commits
Kuno Vercammen authored 2d5d4a00ea5
93 93 | */ |
94 94 | submitForm(form: NgForm) { |
95 95 | if (isEmpty(this.parameters)) { |
96 96 | this.parameters = []; |
97 97 | } |
98 98 | if (!this.validateForm(form) || this.isRequiredMissing()) { |
99 99 | return; |
100 100 | } |
101 101 | |
102 102 | const stringParameters: ProcessParameter[] = this.parameters.map((parameter: ProcessParameter) => { |
103 - | return { |
104 - | name: parameter.name, |
105 - | value: this.checkValue(parameter), |
106 - | }; |
107 - | }, |
103 + | return { |
104 + | name: parameter.name, |
105 + | value: this.checkValue(parameter), |
106 + | }; |
107 + | }, |
108 108 | ); |
109 109 | this.scriptService.invoke(this.selectedScript.id, stringParameters, this.files) |
110 110 | .pipe(getFirstCompletedRemoteData()) |
111 111 | .subscribe((rd: RemoteData<Process>) => { |
112 112 | if (rd.hasSucceeded) { |
113 113 | const title = this.translationService.get('process.new.notification.success.title'); |
114 114 | const content = this.translationService.get('process.new.notification.success.content'); |
115 115 | this.notificationsService.success(title, content); |
116 116 | this.sendBack(rd.payload); |
117 117 | } else { |
174 174 | private sendBack(newProcess: Process) { |
175 175 | const extras: NavigationExtras = { |
176 176 | queryParams: { new_process_id: newProcess.processId }, |
177 177 | }; |
178 178 | void this.router.navigate([getProcessListRoute()], extras); |
179 179 | } |
180 180 | |
181 181 | updateScript($event: Script) { |
182 182 | this.selectedScript = $event; |
183 183 | this.parameters = undefined; |
184 - | this.updateName(); |
185 - | } |
186 - | |
187 - | updateName(): void { |
188 - | if (isEmpty(this.customName)) { |
189 - | this.processName = this.generatedProcessName; |
190 - | } else { |
191 - | this.processName = this.customName; |
192 - | } |
193 184 | } |
194 185 | |
195 186 | get generatedProcessName() { |
196 187 | const paramsString = this.parameters?.map((p: ProcessParameter) => { |
197 188 | const value = this.parseValue(p.value); |
198 189 | return isEmpty(value) ? p.name : `${p.name} ${value}`; |
199 190 | }).join(' ') || ''; |
200 191 | return isEmpty(paramsString) ? this.selectedScript.name : `${this.selectedScript.name} ${paramsString}`; |
201 192 | } |
202 193 | |