Skip to content

Commit

Permalink
fix enabling in AppDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
janepie committed Sep 27, 2024
1 parent 64a8d39 commit c1840be
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 7 deletions.
2 changes: 1 addition & 1 deletion js/app_api-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -143345,7 +143345,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"compressed":true,"categories":[{"id"
/******/ // This function allow to reference async chunks
/******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "app_api-" + chunkId + ".js?v=" + {"node_modules_nextcloud_dialogs_dist_chunks_index-C1azEbgd_mjs":"ce0d37e24678dfb5ef24","vendors-node_modules_vue-material-design-icons_Alert_vue-node_modules_vue-material-design-ico-b44ec1":"276c7b3da988dc665f35","src_views_Apps_vue":"1db7dec7e96ddf8caad3","vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-CDU2njOJ_mjs":"5cd69d99367c861809dd"}[chunkId] + "";
/******/ return "app_api-" + chunkId + ".js?v=" + {"node_modules_nextcloud_dialogs_dist_chunks_index-C1azEbgd_mjs":"ce0d37e24678dfb5ef24","vendors-node_modules_vue-material-design-icons_Alert_vue-node_modules_vue-material-design-ico-b44ec1":"276c7b3da988dc665f35","src_views_Apps_vue":"8689f414e7e4cfca4b6d","vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-CDU2njOJ_mjs":"5cd69d99367c861809dd"}[chunkId] + "";
/******/ };
/******/ })();
/******/
Expand Down
2 changes: 1 addition & 1 deletion js/app_api-main.js.map

Large diffs are not rendered by default.

29 changes: 26 additions & 3 deletions js/app_api-src_views_Apps_vue.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/app_api-src_views_Apps_vue.js.map

Large diffs are not rendered by default.

25 changes: 24 additions & 1 deletion src/components/Apps/AppDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
type="button"
:value="enableButtonText"
:disabled="!app.canInstall || installing || isLoading || !defaultDeployDaemonAccessible || isInitializing || isDeploying"
@click="showSelectionModal">
@click="enableButtonAction">
<input v-else-if="!app.active && !app.canInstall"
:title="forceEnableButtonTooltip"
:aria-label="forceEnableButtonTooltip"
Expand All @@ -40,6 +40,7 @@
<DaemonSelectionModal
v-if="selectDaemonModal"
:show.sync="selectDaemonModal"
:daemons="dockerDaemons"
:app="app" />
<NcCheckboxRadioSwitch v-if="app.canUnInstall"
:checked="removeData"
Expand Down Expand Up @@ -116,6 +117,9 @@ import PrefixMixin from './PrefixMixin.vue'
import Markdown from './Markdown.vue'
import DaemonSelectionModal from './DaemonSelectionModal.vue'
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
export default {
name: 'AppDetails',
Expand All @@ -137,6 +141,7 @@ export default {
return {
removeData: false,
selectDaemonModal: false,
dockerDaemons: [],
}
},
Expand Down Expand Up @@ -170,6 +175,9 @@ export default {
this.removeData = false
},
},
mounted() {
this.getAllDockerDaemons()
},
methods: {
toggleRemoveData() {
Expand All @@ -178,6 +186,21 @@ export default {
showSelectionModal() {
this.selectDaemonModal = true
},
getAllDockerDaemons() {
return axios.get(generateUrl('/apps/app_api/daemons'))
.then(res => {
this.dockerDaemons = res.data.daemons.filter(function(daemon) {
return daemon.accepts_deploy_id === 'docker-install'
})
})
},
enableButtonAction() {
if (this.dockerDaemons.length === 1) {
this.enable(this.app.id, this.dockerDaemons[0])
} else {
this.showSelectionModal()
}
},
},
}
</script>
Expand Down

0 comments on commit c1840be

Please sign in to comment.