Skip to content

Commit

Permalink
Add possibility to edit Deploy daemon configuration (#338)
Browse files Browse the repository at this point in the history
Resolves #332


![image](https://github.com/user-attachments/assets/06a161f7-7dec-42fb-b2a9-17258a92ac77)

---------

Co-authored-by: Andrey Borysenko <andrey18106x@gmail.com>
  • Loading branch information
vstelmakh and andrey18106 authored Jul 30, 2024
1 parent 68650d2 commit 9297fbc
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 40 deletions.
1 change: 1 addition & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
['name' => 'DaemonConfig#unregisterDaemonConfig', 'url' => '/daemons/{name}', 'verb' => 'DELETE'],
['name' => 'DaemonConfig#verifyDaemonConnection', 'url' => '/daemons/{name}/check', 'verb' => 'POST'],
['name' => 'DaemonConfig#checkDaemonConnection', 'url' => '/daemons/verify_connection', 'verb' => 'POST'],
['name' => 'DaemonConfig#updateDaemonConfig', 'url' => '/daemons/{name}', 'verb' => 'PUT'],

// Test Deploy actions
['name' => 'DaemonConfig#startTestDeploy', 'url' => '/daemons/{name}/test_deploy', 'verb' => 'POST'],
Expand Down
6 changes: 3 additions & 3 deletions lib/Controller/DaemonConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public function registerDaemonConfig(array $daemonConfigParams, bool $defaultDae
}

#[NoCSRFRequired]
public function updateDaemonConfig(string $name, array $params): Response {
public function updateDaemonConfig(string $name, array $daemonConfigParams): Response {
$daemonConfig = $this->daemonConfigService->getDaemonConfigByName($name);
$updatedDaemonConfig = new DaemonConfig($params);
$updatedDaemonConfig = new DaemonConfig($daemonConfigParams);
$updatedDaemonConfig->setId($daemonConfig->getId());
$updatedDaemonConfig = $this->daemonConfigService->updateDaemonConfig($daemonConfig);
$updatedDaemonConfig = $this->daemonConfigService->updateDaemonConfig($updatedDaemonConfig);
return new JSONResponse([
'success' => $updatedDaemonConfig !== null,
'daemonConfig' => $updatedDaemonConfig,
Expand Down
25 changes: 25 additions & 0 deletions src/components/DaemonConfig/DaemonConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
<TestTube :size="20" />
</template>
</NcActionButton>
<NcActionButton :close-after-click="true" @click="showEditModal()">
{{ t('app_api', 'Edit') }}
<template #icon>
<Pencil :size="20" />
</template>
</NcActionButton>
<NcActionButton icon="icon-delete" :close-after-click="true" @click="deleteDaemonConfig()">
{{ t('app_api', 'Delete') }}
<template #icon>
Expand All @@ -50,6 +56,12 @@
:get-all-daemons="getAllDaemons"
:daemon="daemon" />
</template>
<ManageDaemonConfigModal
:show.sync="showEditDialog"
:daemons="daemons"
:get-all-daemons="getAllDaemons"
:daemon="daemon"
:is-default-daemon="isDefault" />
</div>
</template>

Expand All @@ -63,14 +75,17 @@ import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
import CheckBold from 'vue-material-design-icons/CheckBold.vue'
import TestTube from 'vue-material-design-icons/TestTube.vue'
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 ManageDaemonConfigModal from './ManageDaemonConfigModal.vue'
export default {
name: 'DaemonConfig',
components: {
ManageDaemonConfigModal,
NcListItem,
NcActionButton,
CheckBold,
Expand All @@ -79,6 +94,7 @@ export default {
DaemonTestDeploy,
NcLoadingIcon,
TestTube,
Pencil,
},
props: {
daemon: {
Expand All @@ -95,6 +111,11 @@ export default {
type: Function,
required: true,
},
daemons: {
type: Array,
required: true,
default: () => [],
},
getAllDaemons: {
type: Function,
required: true,
Expand All @@ -108,6 +129,7 @@ export default {
showDeleteDialog: false,
removeExAppsOnDaemonDelete: false,
showTestDeployDialog: false,
showEditDialog: false,
}
},
computed: {
Expand Down Expand Up @@ -158,6 +180,9 @@ export default {
showTestDeployModal() {
this.showTestDeployDialog = true
},
showEditModal() {
this.showEditDialog = true
},
},
}
</script>
Expand Down
7 changes: 4 additions & 3 deletions src/components/DaemonConfig/DaemonConfigList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
:daemon="daemon"
:is-default="defaultDaemon === daemon.name"
:save-options="saveOptions"
:daemons="daemons"
:get-all-daemons="getAllDaemons" />
</ul>
<NcEmptyContent
Expand All @@ -26,7 +27,7 @@
<NcLoadingIcon v-else />
</template>
</NcButton>
<RegisterDaemonConfigModal :show.sync="showRegisterModal" :daemons="daemons" :get-all-daemons="getAllDaemons" />
<ManageDaemonConfigModal :show.sync="showRegisterModal" :daemons="daemons" :get-all-daemons="getAllDaemons" />
</div>
</template>

Expand All @@ -42,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',
Expand All @@ -52,7 +53,7 @@ export default {
NcLoadingIcon,
Plus,
DaemonConfig,
RegisterDaemonConfigModal,
ManageDaemonConfigModal,
NcEmptyContent,
},
props: {
Expand Down
Loading

0 comments on commit 9297fbc

Please sign in to comment.