5858 $t("settings.enabled")
5959 }}</template >
6060 </cv-toggle >
61+ <NsComboBox
62+ v-model .trim =" timezone "
63+ :autoFilter =" true "
64+ :autoHighlight =" true "
65+ :title =" $t (' settings.timezone' )"
66+ :label =" $t (' settings.timezone_placeholder' )"
67+ :options =" timezoneList "
68+ :userInputLabel =" core .$t (' common.user_input_l' )"
69+ :acceptUserInput =" false "
70+ :showItemType =" true "
71+ :invalid-message =" $t (error .timezone )"
72+ :disabled =" loading .getConfiguration || loading .configureModule "
73+ tooltipAlignment="start"
74+ tooltipDirection="top"
75+ ref="timezone"
76+ >
77+ <template slot="tooltip">
78+ {{ $t("settings.timezone_tooltip") }}
79+ </template >
80+ </NsComboBox >
6181 <div v-if =" error.configureModule" class =" bx--row" >
6282 <div class =" bx--col" >
6383 <NsInlineNotification
@@ -109,18 +129,24 @@ export default {
109129 n8n_ADMIN_PASSWORD: " " ,
110130 isLetsEncryptEnabled: false ,
111131 isHttpToHttpsEnabled: false ,
132+ timezone: " " ,
133+ timezoneList: [],
112134 loading: {
113135 getConfiguration: false ,
114136 configureModule: false ,
137+ getDefaults: false ,
115138 },
116139 error: {
117140 getConfiguration: " " ,
141+ timezone: " " ,
118142 configureModule: " " ,
119143 host: " " ,
120144 n8n_ADMIN_USER: " " ,
121145 n8n_ADMIN_PASSWORD: " " ,
122146 lets_encrypt: " " ,
123147 http2https: " " ,
148+ getStatus: " " ,
149+ getDefaults: " " ,
124150 },
125151 };
126152 },
@@ -129,6 +155,8 @@ export default {
129155 },
130156 created () {
131157 this .getConfiguration ();
158+ this .getStatus ();
159+ this .getDefaults ();
132160 },
133161 beforeRouteEnter (to , from , next ) {
134162 next ((vm ) => {
@@ -141,6 +169,48 @@ export default {
141169 next ();
142170 },
143171 methods: {
172+ async getStatus () {
173+ this .loading .getStatus = true ;
174+ this .error .getStatus = " " ;
175+ const taskAction = " get-status" ;
176+ const eventId = this .getUuid ();
177+ // register to task error
178+ this .core .$root .$once (
179+ ` ${ taskAction} -aborted-${ eventId} ` ,
180+ this .getStatusAborted ,
181+ );
182+ // register to task completion
183+ this .core .$root .$once (
184+ ` ${ taskAction} -completed-${ eventId} ` ,
185+ this .getStatusCompleted ,
186+ );
187+ const res = await to (
188+ this .createModuleTaskForApp (this .instanceName , {
189+ action: taskAction,
190+ extra: {
191+ title: this .$t (" action." + taskAction),
192+ isNotificationHidden: true ,
193+ eventId,
194+ },
195+ }),
196+ );
197+ const err = res[0 ];
198+ if (err) {
199+ console .error (` error creating task ${ taskAction} ` , err);
200+ this .error .getStatus = this .getErrorMessage (err);
201+ this .loading .getStatus = false ;
202+ return ;
203+ }
204+ },
205+ getStatusAborted (taskResult , taskContext ) {
206+ console .error (` ${ taskContext .action } aborted` , taskResult);
207+ this .error .getStatus = this .$t (" error.generic_error" );
208+ this .loading .getStatus = false ;
209+ },
210+ getStatusCompleted (taskContext , taskResult ) {
211+ this .status = taskResult .output ;
212+ this .loading .getStatus = false ;
213+ },
144214 async getConfiguration () {
145215 this .loading .getConfiguration = true ;
146216 this .error .getConfiguration = " " ;
@@ -150,14 +220,14 @@ export default {
150220 this .core .$root .$off (taskAction + " -aborted" );
151221 this .core .$root .$once (
152222 taskAction + " -aborted" ,
153- this .getConfigurationAborted
223+ this .getConfigurationAborted ,
154224 );
155225
156226 // register to task completion
157227 this .core .$root .$off (taskAction + " -completed" );
158228 this .core .$root .$once (
159229 taskAction + " -completed" ,
160- this .getConfigurationCompleted
230+ this .getConfigurationCompleted ,
161231 );
162232
163233 const res = await to (
@@ -167,7 +237,7 @@ export default {
167237 title: this .$t (" action." + taskAction),
168238 isNotificationHidden: true ,
169239 },
170- })
240+ }),
171241 );
172242 const err = res[0 ];
173243
@@ -204,6 +274,10 @@ export default {
204274 }
205275 isValidationOk = false ;
206276 }
277+ if (! this .timezone ) {
278+ this .error .timezone = " common.required" ;
279+ isValidationOk = false ;
280+ }
207281
208282 return isValidationOk;
209283 },
@@ -235,21 +309,21 @@ export default {
235309 this .core .$root .$off (taskAction + " -aborted" );
236310 this .core .$root .$once (
237311 taskAction + " -aborted" ,
238- this .configureModuleAborted
312+ this .configureModuleAborted ,
239313 );
240314
241315 // register to task validation
242316 this .core .$root .$off (taskAction + " -validation-failed" );
243317 this .core .$root .$once (
244318 taskAction + " -validation-failed" ,
245- this .configureModuleValidationFailed
319+ this .configureModuleValidationFailed ,
246320 );
247321
248322 // register to task completion
249323 this .core .$root .$off (taskAction + " -completed" );
250324 this .core .$root .$once (
251325 taskAction + " -completed" ,
252- this .configureModuleCompleted
326+ this .configureModuleCompleted ,
253327 );
254328
255329 const res = await to (
@@ -259,14 +333,15 @@ export default {
259333 host: this .host ,
260334 lets_encrypt: this .isLetsEncryptEnabled ,
261335 http2https: this .isHttpToHttpsEnabled ,
336+ timezone: this .timezone ,
262337 },
263338 extra: {
264339 title: this .$t (" settings.instance_configuration" , {
265340 instance: this .instanceName ,
266341 }),
267342 description: this .$t (" settings.configuring" ),
268343 },
269- })
344+ }),
270345 );
271346 const err = res[0 ];
272347
@@ -288,6 +363,60 @@ export default {
288363 // reload configuration
289364 this .getConfiguration ();
290365 },
366+ async getDefaults () {
367+ this .loading .getDefaults = true ;
368+
369+ const taskAction = " get-defaults" ;
370+ const eventId = this .getUuid ();
371+
372+ // register to task error
373+ this .core .$root .$once (
374+ ` ${ taskAction} -aborted-${ eventId} ` ,
375+ this .getDefaultsAborted ,
376+ );
377+
378+ // register to task completion
379+ this .core .$root .$once (
380+ ` ${ taskAction} -completed-${ eventId} ` ,
381+ this .getDefaultsCompleted ,
382+ );
383+
384+ const res = await to (
385+ this .createModuleTaskForApp (this .instanceName , {
386+ action: taskAction,
387+ extra: {
388+ title: this .$t (" action." + taskAction),
389+ isNotificationHidden: true ,
390+ eventId,
391+ },
392+ }),
393+ );
394+ const err = res[0 ];
395+
396+ if (err) {
397+ console .error (` error creating task ${ taskAction} ` , err);
398+ this .error .getDefaults = this .getErrorMessage (err);
399+ this .loading .getDefaults = false ;
400+ return ;
401+ }
402+ },
403+ getDefaultsAborted (taskResult , taskContext ) {
404+ console .error (` ${ taskContext .action } aborted` , taskResult);
405+ this .error .getDefaults = this .$t (" error.generic_error" );
406+ this .loading .getDefaults = false ;
407+ },
408+ getDefaultsCompleted (taskContext , taskResult ) {
409+ this .timezoneList = [];
410+ taskResult .output .accepted_timezone_list .forEach ((value ) =>
411+ this .timezoneList .push ({
412+ name: value,
413+ label: value,
414+ value: value,
415+ }),
416+ );
417+ this .loading .getDefaults = false ;
418+ this .isProxyInstalled = taskResult .output .proxy_status .proxy_installed ;
419+ },
291420 },
292421};
293422 </script >
0 commit comments