Skip to content

Commit

Permalink
feat: Support playbook, adhoc share
Browse files Browse the repository at this point in the history
  • Loading branch information
w940853815 committed Sep 6, 2024
1 parent 40bb841 commit 635d99c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/views/ops/Adhoc/AdhocOpenDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default {
width: '60%',
tableConfig: {
hasSelection: false,
url: `/api/v1/ops/adhocs/`,
url: `/api/v1/ops/adhocs/?creator=${this.$store.state.users.profile.id}`,
columns: ['name', 'module', 'args', 'comment', 'actions'],
columnsMeta: {
name: {
Expand Down
2 changes: 1 addition & 1 deletion src/views/ops/Job/JobUpdateCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default {
multiple: false,
value: [],
ajax: {
url: '/api/v1/ops/playbooks/',
url: `/api/v1/ops/playbooks/?creator=${this.$store.state.users.profile.id}`,
transformOption: (item) => {
return { label: item.name, value: item.id }
}
Expand Down
10 changes: 7 additions & 3 deletions src/views/ops/Template/Adhoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
url: '/api/v1/ops/adhocs/',
columnsShow: {
min: ['name', 'actions'],
default: ['name', 'module', 'args', 'comment', 'date_created', 'actions']
default: ['name', 'module', 'args', 'comment', 'scope', 'date_created', 'actions']
},
columnsMeta: {
name: {
Expand All @@ -29,10 +29,14 @@ export default {
formatter: ActionsFormatter,
formatterArgs: {
hasUpdate: true,
canUpdate: this.$hasPerm('ops.change_adhoc'),
canUpdate: ({ row }) => {
return this.$hasPerm('ops.change_adhoc') && !row.disable_edit
},
updateRoute: 'AdhocUpdate',
hasDelete: true,
canDelete: this.$hasPerm('ops.delete_adhoc'),
canDelete: ({ row }) => {
return this.$hasPerm('ops.delete_adhoc') && !row.disable_edit
},
hasClone: false
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/ops/Template/Adhoc/AdhocUpdateCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
return {
url: '/api/v1/ops/adhocs/',
fields: [
[this.$t('Basic'), ['name', 'module', 'args', 'comment']]
[this.$t('Basic'), ['name', 'module', 'args', 'comment', 'scope']]
],
initial: {
module: 'shell',
Expand Down
12 changes: 8 additions & 4 deletions src/views/ops/Template/Playbook.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default {
url: '/api/v1/ops/playbooks/',
columnsShow: {
min: ['name', 'actions'],
default: ['name', 'comment', 'date_created', 'actions']
default: ['name', 'comment', 'scope', 'date_created', 'actions']
},
columnsMeta: {
name: {
Expand All @@ -36,11 +36,15 @@ export default {
formatter: ActionsFormatter,
formatterArgs: {
hasUpdate: true,
canUpdate: this.$hasPerm('ops.change_playbook'),
canUpdate: ({ row }) => {
return this.$hasPerm('ops.change_playbook') && !row.disable_edit
},
updateRoute: 'PlaybookUpdate',
hasDelete: true,
canDelete: this.$hasPerm('ops.delete_playbook'),
hasClone: false
canDelete: ({ row }) => {
return this.$hasPerm('ops.delete_playbook') && !row.disable_edit
},
hasClone: true
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/ops/Template/Playbook/PlaybookCreateUpdate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
return {
url: '/api/v1/ops/playbooks/',
fields: [
[this.$t('Basic'), ['name', 'comment']]
[this.$t('Basic'), ['name', 'comment', 'scope']]
],
createSuccessNextRoute: {
name: 'Template'
Expand Down
9 changes: 7 additions & 2 deletions src/views/ops/Template/Playbook/PlaybookDetail/Workspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<NewNodeDialog v-if="createDialogVisible" :visible.sync="createDialogVisible" @confirm="doCreate" />
<TreeTable ref="TreeTable" :tree-setting="treeSetting">
<template slot="rMenu">
<template v-if="!disableEdit" slot="rMenu">
<li id="m_create_file" class="rmenu" tabindex="-1" @click="onCreate('file')">
{{ $tc('NewFile') }}
</li>
Expand Down Expand Up @@ -62,15 +62,18 @@ export default {
}
},
data() {
const disableEdit = this.object.disable_edit
return {
disableEdit: disableEdit,
newNode: {},
createDialogVisible: false,
createType: 'directory',
parentId: '',
closing: false,
DataZTree: 0,
cmOptions: {
mode: 'yaml'
mode: 'yaml',
readOnly: disableEdit
},
toolbar: {
left: {
Expand All @@ -82,6 +85,7 @@ export default {
el: {
type: 'primary'
},
isVisible: disableEdit,
callback: () => {
this.onSave()
}
Expand All @@ -94,6 +98,7 @@ export default {
el: {
type: 'primary'
},
isVisible: disableEdit,
callback: () => {
this.onReset()
}
Expand Down

0 comments on commit 635d99c

Please sign in to comment.