Merge branch 'dev' into pr@dev@ticket

This commit is contained in:
feng626
2023-02-10 16:17:28 +08:00
committed by GitHub
10 changed files with 48 additions and 15 deletions

View File

@@ -36,3 +36,11 @@ export function uploadPlaybook(form) {
data: form data: form
}) })
} }
export function renameFile(playbookId, node) {
return request({
url: `/api/v1/ops/playbook/${playbookId}/file/`,
method: 'patch',
data: node
})
}

View File

@@ -154,7 +154,7 @@ export default {
push_now: { push_now: {
hidden: () => { hidden: () => {
const automation = this.iPlatform.automation || {} const automation = this.iPlatform.automation || {}
return !automation.push_account_enabled || !automation.ansible_enabled return !automation.push_account_enabled || !automation.ansible_enabled || !this.$hasPerm('assets.push_assetaccount')
} }
} }
}, },

View File

@@ -10,7 +10,24 @@ export default {
components: { BaseAssetCreateUpdate }, components: { BaseAssetCreateUpdate },
data() { data() {
return { return {
url: '/api/v1/assets/clouds/' url: '/api/v1/assets/clouds/',
addFieldsMeta: {
protocols: {
hidden: (formValue) => {
const address = formValue['address']
if (!address) return
let port = address.startsWith('https://') ? 443 : 80
try {
const url = new URL(address)
if (url.port) { port = url.port }
} catch (e) {
// pass
}
const protocols = formValue['protocols']?.[0] || {}
protocols.port = port
}
}
}
} }
} }
} }

View File

@@ -45,7 +45,8 @@ export default {
const total = _.sumBy(this.data, function(i) { return i.total }) const total = _.sumBy(this.data, function(i) { return i.total })
for (let i = 0, len = this.data.length; i < len; i++) { for (let i = 0, len = this.data.length; i < len; i++) {
const current = this.data[i] const current = this.data[i]
const num = (current.total / total) * 100 let num = (current.total / total) * 100
num = _.floor(num, 2)
const color = '#' + Math.floor(Math.random() * (256 * 256 * 256 - 1)).toString(16) const color = '#' + Math.floor(Math.random() * (256 * 256 * 256 - 1)).toString(16)
seriesList.push({ seriesList.push({
type: 'bar', type: 'bar',
@@ -132,7 +133,7 @@ export default {
grid: { grid: {
top: '60%', top: '60%',
containLabel: true, containLabel: true,
bottom: '0', bottom: '-10',
left: '0%', left: '0%',
right: 1 right: 1
}, },

View File

@@ -47,6 +47,7 @@ export default {
}, },
fieldsMeta: { fieldsMeta: {
name: { name: {
rules: [Required],
hidden: (formValue) => { hidden: (formValue) => {
return this.instantTask return this.instantTask
} }
@@ -78,6 +79,7 @@ export default {
} }
}, },
playbook: { playbook: {
rules: [Required],
hidden: (formValue) => { hidden: (formValue) => {
return formValue.type !== 'playbook' return formValue.type !== 'playbook'
}, },
@@ -104,6 +106,7 @@ export default {
} }
}, },
args: { args: {
rules: [Required],
hidden: (formValue) => { hidden: (formValue) => {
return formValue.type !== 'adhoc' return formValue.type !== 'adhoc'
}, },

View File

@@ -48,10 +48,7 @@ export default {
} }
}, },
comment: { comment: {
width: '240px', width: '240px'
formatter: (row) => {
return row.type.label
}
}, },
summary: { summary: {
label: this.$t('ops.Summary(success/total)'), label: this.$t('ops.Summary(success/total)'),

View File

@@ -5,7 +5,7 @@
:visible.sync="iVisible" :visible.sync="iVisible"
width="20%" width="20%"
top="1vh" top="1vh"
:show-cancel="true" :show-cancel="false"
:show-confirm="true" :show-confirm="true"
@confirm="onConfirm" @confirm="onConfirm"
> >

View File

@@ -45,6 +45,7 @@ import { TreeTable } from '@/components'
import CodeEditor from '@/components/FormFields/CodeEditor' import CodeEditor from '@/components/FormFields/CodeEditor'
import item from '@/layout/components/NavLeft/Item' import item from '@/layout/components/NavLeft/Item'
import NewNodeDialog from '@/views/ops/Template/Playbook/PlaybookDetail/Editor/NewNodeDialog.vue' import NewNodeDialog from '@/views/ops/Template/Playbook/PlaybookDetail/Editor/NewNodeDialog.vue'
import { renameFile } from '@/api/ops'
export default { export default {
name: 'CommandExecution', name: 'CommandExecution',
@@ -113,16 +114,17 @@ export default {
} }
}.bind(this), }.bind(this),
refresh: function(event, treeNode) { refresh: function(event, treeNode) {
// const parentNode = this.zTree.getNodeByParam('id', this.parentId)
// this.zTree.expandNode(parentNode, true, false, false, false)
}, },
onRename: function(event, treeId, treeNode, isCancel) { onRename: function(event, treeId, treeNode, isCancel) {
const url = `/api/v1/ops/playbook/${this.object.id}/file/`
if (isCancel) { if (isCancel) {
return return
} }
this.$axios.patch(url, { key: treeNode.id, new_name: treeNode.name, is_directory: treeNode.isParent }) renameFile(this.object.id, {
.then(data => { key: treeNode.id,
new_name: treeNode.name,
is_directory: treeNode.isParent
}).then()
.finally(() => {
this.refreshTree() this.refreshTree()
}) })
}.bind(this) }.bind(this)

View File

@@ -73,6 +73,9 @@ export default {
choicesSelected.push(this.SPEC) choicesSelected.push(this.SPEC)
this.showSpecAccounts = true this.showSpecAccounts = true
} }
if (this.value.indexOf(this.SPEC) > -1) {
this.showSpecAccounts = true
}
this.choicesSelected = choicesSelected this.choicesSelected = choicesSelected
this.specAccountsInput = specAccountsInput this.specAccountsInput = specAccountsInput
}, },

View File

@@ -44,8 +44,10 @@ export default {
formatter: function(row) { formatter: function(row) {
return toSafeLocalDateStr(row.timestamp * 1000) return toSafeLocalDateStr(row.timestamp * 1000)
} }
},
actions: {
has: false
} }
} }
}, },
headerActions: { headerActions: {