From eabc64df30bb033169a46a36d082253a8800e2fb Mon Sep 17 00:00:00 2001 From: Volodymyr Stelmakh Date: Fri, 26 Jul 2024 23:01:28 +0200 Subject: [PATCH 01/12] add daemon edit button --- l10n/de.js | 3 +++ l10n/de.json | 5 ++++- l10n/en_GB.js | 1 + l10n/en_GB.json | 3 ++- l10n/uk.js | 5 ++++- l10n/uk.json | 7 +++++-- src/components/DaemonConfig/DaemonConfig.vue | 8 ++++++++ 7 files changed, 27 insertions(+), 5 deletions(-) diff --git a/l10n/de.js b/l10n/de.js index 31049882..028b5ed5 100644 --- a/l10n/de.js +++ b/l10n/de.js @@ -42,6 +42,9 @@ OC.L10N.register( "Delete" : "Löschen", "Default" : "Standard", "{license}-licensed" : "{license}-Lizenziert", + "Set as default" : "Als Standard einstellen", + "Test deploy" : "Testen der Bereitstellung", + "Edit" : "Bearbeiten", "Host" : "Host", "Nextcloud URL" : "Nextcloud-URL", "Enabled" : "Aktiviert", diff --git a/l10n/de.json b/l10n/de.json index 009e0920..c7ee8dfa 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -40,6 +40,9 @@ "Delete" : "Löschen", "Default" : "Standard", "{license}-licensed" : "{license}-Lizenziert", + "Set as default" : "Als Standard einstellen", + "Test deploy" : "Testen der Bereitstellung", + "Edit" : "Bearbeiten", "Host" : "Host", "Nextcloud URL" : "Nextcloud-URL", "Enabled" : "Aktiviert", @@ -63,4 +66,4 @@ "An error occurred during the request. Unable to proceed." : "Es ist ein Fehler bei der Anfrage aufgetreten. Es kann nicht fortgefahren werden.", "Error: This app cannot be enabled because it makes the server unstable" : "Fehler: Diese App kann nicht aktiviert werden, da sie den Server instabil macht. " },"pluralForm" :"nplurals=2; plural=(n != 1);" -} \ No newline at end of file +} diff --git a/l10n/en_GB.js b/l10n/en_GB.js index 469aebd0..7abb8693 100644 --- a/l10n/en_GB.js +++ b/l10n/en_GB.js @@ -81,6 +81,7 @@ OC.L10N.register( "{license}-licensed" : "{license}-licensed", "Set as default" : "Set as default", "Test deploy" : "Test deploy", + "Edit" : "Edit", "\"manual-install\" Deploy Daemon cannot be set as default" : "\"manual-install\" Deploy Daemon cannot be set as default", "Failed to save admin options. Check the logs" : "Failed to save admin options. Check the logs", "Deploy daemon config details" : "Deploy daemon config details", diff --git a/l10n/en_GB.json b/l10n/en_GB.json index 7e721820..a43638cf 100644 --- a/l10n/en_GB.json +++ b/l10n/en_GB.json @@ -79,6 +79,7 @@ "{license}-licensed" : "{license}-licensed", "Set as default" : "Set as default", "Test deploy" : "Test deploy", + "Edit": "Edit", "\"manual-install\" Deploy Daemon cannot be set as default" : "\"manual-install\" Deploy Daemon cannot be set as default", "Failed to save admin options. Check the logs" : "Failed to save admin options. Check the logs", "Deploy daemon config details" : "Deploy daemon config details", @@ -190,4 +191,4 @@ "The app has been enabled but needs to be updated." : "The app has been enabled but needs to be updated.", "Error: This app cannot be enabled because it makes the server unstable" : "Error: This app cannot be enabled because it makes the server unstable" },"pluralForm" :"nplurals=2; plural=(n != 1);" -} \ No newline at end of file +} diff --git a/l10n/uk.js b/l10n/uk.js index 8ef8bbec..3a4671f7 100644 --- a/l10n/uk.js +++ b/l10n/uk.js @@ -28,8 +28,11 @@ OC.L10N.register( "_Update_::_Update all_" : ["Оновити","Оновити все","Оновити все","Оновити все"], "Type" : "Тип", "Cancel" : "Скасувати", - "Delete" : "Вилучати", + "Delete" : "Видалити", "{license}-licensed" : "Ліцензія: {license}", + "Set as default" : "Встановити за замовчуванням", + "Test deploy" : "Тестове розгортання", + "Edit" : "Редагувати", "Host" : "Хост", "Enabled" : "Увімкнено", "Display name" : "Ім'я для показу", diff --git a/l10n/uk.json b/l10n/uk.json index 8e656c8d..2a327d4c 100644 --- a/l10n/uk.json +++ b/l10n/uk.json @@ -26,8 +26,11 @@ "_Update_::_Update all_" : ["Оновити","Оновити все","Оновити все","Оновити все"], "Type" : "Тип", "Cancel" : "Скасувати", - "Delete" : "Вилучати", + "Delete" : "Видалити", "{license}-licensed" : "Ліцензія: {license}", + "Set as default" : "Встановити за замовчуванням", + "Test deploy" : "Тестове розгортання", + "Edit" : "Редагувати", "Host" : "Хост", "Enabled" : "Увімкнено", "Display name" : "Ім'я для показу", @@ -50,4 +53,4 @@ "An error occurred during the request. Unable to proceed." : "Під час запиту сталася помилка. Неможливо продовжити.", "Error: This app cannot be enabled because it makes the server unstable" : "Помилка: цей застосунок неможливо увімкнути, оскільки він робить сервер нестабільним" },"pluralForm" :"nplurals=4; plural=(n % 1 == 0 && n % 10 == 1 && n % 100 != 11 ? 0 : n % 1 == 0 && n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14) ? 1 : n % 1 == 0 && (n % 10 ==0 || (n % 10 >=5 && n % 10 <=9) || (n % 100 >=11 && n % 100 <=14 )) ? 2: 3);" -} \ No newline at end of file +} diff --git a/src/components/DaemonConfig/DaemonConfig.vue b/src/components/DaemonConfig/DaemonConfig.vue index 6a5c71a0..c9f85735 100644 --- a/src/components/DaemonConfig/DaemonConfig.vue +++ b/src/components/DaemonConfig/DaemonConfig.vue @@ -24,6 +24,12 @@ + + {{ t('app_api', 'Edit') }} + + {{ t('app_api', 'Delete') }} - + {{ t('app_api', 'Edit') }} + @@ -74,10 +80,12 @@ import Pencil from 'vue-material-design-icons/Pencil.vue' import DaemonConfigDetailsModal from './DaemonConfigDetailsModal.vue' import ConfirmDaemonDeleteModal from './ConfirmDaemonDeleteModal.vue' import DaemonTestDeploy from './DaemonTestDeploy.vue' +import RegisterDaemonConfigModal from './RegisterDaemonConfigModal.vue' export default { name: 'DaemonConfig', components: { + RegisterDaemonConfigModal, NcListItem, NcActionButton, CheckBold, @@ -103,6 +111,11 @@ export default { type: Function, required: true, }, + daemons: { + type: Array, + required: true, + default: () => [], + }, getAllDaemons: { type: Function, required: true, @@ -116,6 +129,7 @@ export default { showDeleteDialog: false, removeExAppsOnDaemonDelete: false, showTestDeployDialog: false, + showEditDialog: false, } }, computed: { @@ -166,6 +180,9 @@ export default { showTestDeployModal() { this.showTestDeployDialog = true }, + showEditModal() { + this.showEditDialog = true + }, }, } diff --git a/src/components/DaemonConfig/DaemonConfigList.vue b/src/components/DaemonConfig/DaemonConfigList.vue index 48665b9b..aff60e78 100644 --- a/src/components/DaemonConfig/DaemonConfigList.vue +++ b/src/components/DaemonConfig/DaemonConfigList.vue @@ -8,6 +8,7 @@ :daemon="daemon" :is-default="defaultDaemon === daemon.name" :save-options="saveOptions" + :daemons="daemons" :get-all-daemons="getAllDaemons" />
-

{{ t('app_api', 'Register Deploy Daemon') }}

-
+

{{ isEdit ? t('app_api', 'Edit Deploy Daemon') : t('app_api', 'Register Deploy Daemon') }}

+
- {{ t('app_api', 'Register') }} + {{ isEdit ? t('app_api', 'Save') : t('app_api', 'Register') }} @@ -43,7 +43,7 @@ import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js' import FormatListBullet from 'vue-material-design-icons/FormatListBulleted.vue' -import RegisterDaemonConfigModal from './RegisterDaemonConfigModal.vue' +import ManageDaemonConfigModal from './ManageDaemonConfigModal.vue' export default { name: 'DaemonConfigList', @@ -53,7 +53,7 @@ export default { NcLoadingIcon, Plus, DaemonConfig, - RegisterDaemonConfigModal, + ManageDaemonConfigModal, NcEmptyContent, }, props: { diff --git a/src/components/DaemonConfig/RegisterDaemonConfigModal.vue b/src/components/DaemonConfig/ManageDaemonConfigModal.vue similarity index 99% rename from src/components/DaemonConfig/RegisterDaemonConfigModal.vue rename to src/components/DaemonConfig/ManageDaemonConfigModal.vue index a86306bd..c573b114 100644 --- a/src/components/DaemonConfig/RegisterDaemonConfigModal.vue +++ b/src/components/DaemonConfig/ManageDaemonConfigModal.vue @@ -250,7 +250,7 @@ import UnfoldMoreHorizontal from 'vue-material-design-icons/UnfoldMoreHorizontal import { DAEMON_TEMPLATES, DAEMON_COMPUTE_DEVICES } from '../../constants/daemonTemplates.js' export default { - name: 'RegisterDaemonConfigModal', + name: 'ManageDaemonConfigModal', components: { NcLoadingIcon, NcModal, From fa95634cfedb7e3a523aee10fb617531218c63b6 Mon Sep 17 00:00:00 2001 From: Volodymyr Stelmakh Date: Sun, 28 Jul 2024 15:29:23 +0200 Subject: [PATCH 09/12] fix https enabled watcher in manage daemon config modal --- .../DaemonConfig/ManageDaemonConfigModal.vue | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/components/DaemonConfig/ManageDaemonConfigModal.vue b/src/components/DaemonConfig/ManageDaemonConfigModal.vue index c573b114..ab522471 100644 --- a/src/components/DaemonConfig/ManageDaemonConfigModal.vue +++ b/src/components/DaemonConfig/ManageDaemonConfigModal.vue @@ -330,8 +330,6 @@ export default { data.name = this.daemon.name data.displayName = this.daemon.display_name data.acceptsDeployId = this.daemon.accepts_deploy_id - // TODO: Investigate why this is not working properly. - // Throws error on change if value is "true". Seems to be unrelated to this change. Also reproducible with httpsEnabled = true as default. data.httpsEnabled = this.daemon.protocol === 'https' data.host = this.daemon.host data.nextcloud_url = this.daemon.deploy_config.nextcloud_url @@ -428,12 +426,8 @@ export default { this.setupFormConfiguration(newConfigurationTab) }, httpsEnabled(newHttpsEnabled) { - if (newHttpsEnabled) { - this.prevNet = this.deployConfig.net - this.deployConfig.net = 'host' - } else { - this.deployConfig.net = this.prevNet - } + this.prevNet = this.deployConfig.net + this.deployConfig.net = newHttpsEnabled ? 'host' : this.prevNet }, }, methods: { From 98baa4a1690843a6347a21a035cf973dd62238aa Mon Sep 17 00:00:00 2001 From: Volodymyr Stelmakh Date: Sun, 28 Jul 2024 17:51:31 +0200 Subject: [PATCH 10/12] reset manage daemon config modal data on show --- .../DaemonConfig/ManageDaemonConfigModal.vue | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/DaemonConfig/ManageDaemonConfigModal.vue b/src/components/DaemonConfig/ManageDaemonConfigModal.vue index ab522471..efd179c3 100644 --- a/src/components/DaemonConfig/ManageDaemonConfigModal.vue +++ b/src/components/DaemonConfig/ManageDaemonConfigModal.vue @@ -429,8 +429,16 @@ export default { this.prevNet = this.deployConfig.net this.deployConfig.net = newHttpsEnabled ? 'host' : this.prevNet }, + show(newShow) { + if (newShow === true) { + this.resetData() + } + }, }, methods: { + resetData() { + Object.assign(this.$data, this.$options.data.apply(this)) + }, registerDaemon() { this.registeringDaemon = true @@ -523,7 +531,7 @@ export default { }, setupFormConfiguration(templateName) { const template = Object.assign({}, DAEMON_TEMPLATES.find(template => template.name === templateName.id)) - if (!template) { + if (Object.keys(template).length === 0) { return } this.name = template.name @@ -565,9 +573,6 @@ export default { this.additionalOption = { key: '', value: '' } }, closeModal() { - // TODO: Not sure what is this for. But it seems to mess the modal data when closing. Therefore commented out. - // const customTemplate = DAEMON_TEMPLATES.find(template => template.name === 'custom') - // this.configurationTab = { id: customTemplate.name, label: customTemplate.displayName } this.$emit('update:show', false) }, }, From 1e11d4301ea88f90f6110fc5218a3dc15c5c4f72 Mon Sep 17 00:00:00 2001 From: Volodymyr Stelmakh Date: Sun, 28 Jul 2024 18:40:36 +0200 Subject: [PATCH 11/12] disable unchangeable fields in manage daemon config modal --- src/components/DaemonConfig/ManageDaemonConfigModal.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/DaemonConfig/ManageDaemonConfigModal.vue b/src/components/DaemonConfig/ManageDaemonConfigModal.vue index efd179c3..3928c1f0 100644 --- a/src/components/DaemonConfig/ManageDaemonConfigModal.vue +++ b/src/components/DaemonConfig/ManageDaemonConfigModal.vue @@ -19,6 +19,7 @@ @@ -138,11 +139,12 @@
- + @@ -152,7 +154,7 @@
-
+