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
})
}
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: {
hidden: () => {
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 },
data() {
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 })
for (let i = 0, len = this.data.length; i < len; 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)
seriesList.push({
type: 'bar',
@@ -132,7 +133,7 @@ export default {
grid: {
top: '60%',
containLabel: true,
bottom: '0',
bottom: '-10',
left: '0%',
right: 1
},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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