From 44a3d3a567049653fd0996c09d093f2cc7b2fa09 Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Sat, 16 Mar 2024 17:50:52 +0100 Subject: [PATCH 1/4] Update @nethserver/ns8-ui-lib dependency version --- ui/package.json | 2 +- ui/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/package.json b/ui/package.json index ea4cf27..48d0307 100644 --- a/ui/package.json +++ b/ui/package.json @@ -11,7 +11,7 @@ "dependencies": { "@carbon/icons-vue": "^10.37.0", "@carbon/vue": "^2.40.0", - "@nethserver/ns8-ui-lib": "^0.1.22", + "@nethserver/ns8-ui-lib": "^0.1.32", "await-to-js": "^3.0.0", "axios": "^0.21.2", "carbon-components": "^10.41.0", diff --git a/ui/yarn.lock b/ui/yarn.lock index 1c0054c..7945e1e 100644 --- a/ui/yarn.lock +++ b/ui/yarn.lock @@ -1012,10 +1012,10 @@ call-me-maybe "^1.0.1" glob-to-regexp "^0.3.0" -"@nethserver/ns8-ui-lib@^0.1.22": - version "0.1.25" - resolved "https://registry.npmjs.org/@nethserver/ns8-ui-lib/-/ns8-ui-lib-0.1.25.tgz" - integrity sha512-jSYcG/PDd356Dvdb7BZkMBC+h9fxHvROWTrPsXRplCV4GsTcygO8Uc3H/ch3eo51Rre4qqrk/AP7j5Tzz3tBzQ== +"@nethserver/ns8-ui-lib@^0.1.32": + version "0.1.32" + resolved "https://registry.npmmirror.com/@nethserver/ns8-ui-lib/-/ns8-ui-lib-0.1.32.tgz#7556dd5c7f96ff166597552c9b20e02599d86ba6" + integrity sha512-CqW+Qr65uFiKYe/cG0qahRD+3ojXhDxMJ8Mf8M9CXDHY0WSWygyGYAftLxF8rtQkOdGHlaYv7cSK7TctHggHGA== dependencies: "@rollup/plugin-json" "^4.1.0" core-js "^3.15.2" From c6de374a2f22704bd09b950c04049163e982bdf9 Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Sat, 16 Mar 2024 18:09:14 +0100 Subject: [PATCH 2/4] Update kickstart-app.service to create tmp directory instead of config --- imageroot/systemd/user/kickstart-app.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imageroot/systemd/user/kickstart-app.service b/imageroot/systemd/user/kickstart-app.service index 61aca25..274ced4 100644 --- a/imageroot/systemd/user/kickstart-app.service +++ b/imageroot/systemd/user/kickstart-app.service @@ -15,7 +15,7 @@ EnvironmentFile=-%S/state/smarthost.env WorkingDirectory=%S/state Restart=always TimeoutStopSec=70 -ExecStartPre=/bin/mkdir -p config +ExecStartPre=/bin/mkdir -p tmp ExecStartPre=/bin/rm -f %t/kickstart-app.pid %t/kickstart-app.ctr-id ExecStartPre=-runagent discover-smarthost ExecStart=/usr/bin/podman run --conmon-pidfile %t/kickstart-app.pid \ From 20be7d81c02480ca7deabe5f6b662addcda6e36e Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Sat, 16 Mar 2024 18:09:19 +0100 Subject: [PATCH 3/4] Add new translations and update error messages in translation.json --- ui/public/i18n/en/translation.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/public/i18n/en/translation.json b/ui/public/i18n/en/translation.json index b26b3bb..1a21926 100644 --- a/ui/public/i18n/en/translation.json +++ b/ui/public/i18n/en/translation.json @@ -18,7 +18,11 @@ "mount": "Mount", "no_services": "No services", "no_images": "No images", - "no_volumes": "No volumes" + "no_volumes": "No volumes", + "kickstart_webapp": "kickstart webapp", + "not_configured": "Not configured", + "open_webapp": "Open kickstart", + "configure": "Configure" }, "settings": { "title": "Settings", @@ -62,6 +66,7 @@ "403": "Operation not authorized", "404": "Resource not found", "cannot_retrieve_module_info": "Cannot retrieve module info", - "cannot_retrieve_installed_modules": "Cannot retrieve installed modules" + "cannot_retrieve_installed_modules": "Cannot retrieve installed modules", + "cannot_retrieve_configuration": "Cannot retrieve configuration" } } From 70988f601a320a7d1e2a626f2790e53b9c5e38bc Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Sat, 16 Mar 2024 18:09:29 +0100 Subject: [PATCH 4/4] Add NsInfoCard component for kickstart webapp status --- ui/src/views/Status.vue | 91 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 2 deletions(-) diff --git a/ui/src/views/Status.vue b/ui/src/views/Status.vue index aa1b112..9159d85 100644 --- a/ui/src/views/Status.vue +++ b/ui/src/views/Status.vue @@ -40,13 +40,47 @@ + + + + + @@ -57,7 +91,7 @@ :titleTooltip="installationNodeTitleTooltip" :description="$t('status.installation_node')" :icon="Chip32" - :loading="loading.getStatus" + :loading="loading.getStatus || loading.getConfiguration" class="min-height-card" /> @@ -282,6 +316,7 @@ export default { urlCheckInterval: null, isRedirectChecked: false, redirectTimeout: 0, + host: "", status: { instance: "", services: [], @@ -294,6 +329,7 @@ export default { getStatus: false, listBackupRepositories: false, listBackups: false, + getConfiguration: false, }, error: { getStatus: "", @@ -343,10 +379,61 @@ export default { clearTimeout(this.redirectTimeout); }, created() { + this.getConfiguration(); this.getStatus(); this.listBackupRepositories(); }, methods: { + goToWebapp() { + window.open(`https://${this.host}`, "_blank"); + }, + async getConfiguration() { + this.loading.getConfiguration = true; + this.error.getConfiguration = ""; + const taskAction = "get-configuration"; + const eventId = this.getUuid(); + + // register to task error + this.core.$root.$once( + `${taskAction}-aborted-${eventId}`, + this.getConfigurationAborted + ); + + // register to task completion + this.core.$root.$once( + `${taskAction}-completed-${eventId}`, + this.getConfigurationCompleted + ); + + const res = await to( + this.createModuleTaskForApp(this.instanceName, { + action: taskAction, + extra: { + title: this.$t("action." + taskAction), + isNotificationHidden: true, + eventId, + }, + }) + ); + const err = res[0]; + + if (err) { + console.error(`error creating task ${taskAction}`, err); + this.error.getConfiguration = this.getErrorMessage(err); + this.loading.getConfiguration = false; + return; + } + }, + getConfigurationAborted(taskResult, taskContext) { + console.error(`${taskContext.action} aborted`, taskResult); + this.error.getConfiguration = this.$t("error.generic_error"); + this.loading.getConfiguration = false; + }, + getConfigurationCompleted(taskContext, taskResult) { + const config = taskResult.output; + this.host = config.host; + this.loading.getConfiguration = false; + }, async getStatus() { this.loading.getStatus = true; this.error.getStatus = "";