mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-16 22:07:21 +00:00
perf: add check_all
This commit is contained in:
parent
39c0ae8cf7
commit
292aad0d59
@ -14,7 +14,11 @@
|
|||||||
:visible.sync="showSetVariableDialog"
|
:visible.sync="showSetVariableDialog"
|
||||||
@submit="onSubmitVariable"
|
@submit="onSubmitVariable"
|
||||||
/>
|
/>
|
||||||
<ConfirmRunAssetsDialog :visible.sync="showConfirmRunAssetsDialog" :assets="classifiedAssets" />
|
<ConfirmRunAssetsDialog
|
||||||
|
:visible.sync="showConfirmRunAssetsDialog"
|
||||||
|
:assets="classifiedAssets"
|
||||||
|
@submit="onConfirmRunAsset"
|
||||||
|
/>
|
||||||
<AssetTreeTable ref="TreeTable" :tree-setting="treeSetting">
|
<AssetTreeTable ref="TreeTable" :tree-setting="treeSetting">
|
||||||
<template slot="table">
|
<template slot="table">
|
||||||
<div class="transition-box" style="width: calc(100% - 17px);">
|
<div class="transition-box" style="width: calc(100% - 17px);">
|
||||||
@ -467,12 +471,29 @@ export default {
|
|||||||
this.$message.error(this.$tc('RequiredRunas'))
|
this.$message.error(this.$tc('RequiredRunas'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const data = {
|
this.$axios.post('/api/v1/ops/inventory/classified-hosts/', {
|
||||||
assets: hosts,
|
assets: hosts,
|
||||||
nodes: nodes,
|
nodes: nodes,
|
||||||
module: this.module,
|
module: this.module,
|
||||||
args: this.command,
|
args: this.command,
|
||||||
runas: this.runas,
|
runas: this.runas,
|
||||||
|
runas_policy: this.runasPolicy
|
||||||
|
}).then(data => {
|
||||||
|
this.classifiedAssets = data
|
||||||
|
if (this.classifiedAssets.error.length === 0) {
|
||||||
|
this.onConfirmRunAsset(hosts, nodes)
|
||||||
|
} else {
|
||||||
|
this.showConfirmRunAssetsDialog = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onConfirmRunAsset(assets, nodes) {
|
||||||
|
const data = {
|
||||||
|
assets: assets,
|
||||||
|
nodes: nodes,
|
||||||
|
module: this.module,
|
||||||
|
args: this.command,
|
||||||
|
runas: this.runas,
|
||||||
runas_policy: this.runasPolicy,
|
runas_policy: this.runasPolicy,
|
||||||
instant: true,
|
instant: true,
|
||||||
is_periodic: false,
|
is_periodic: false,
|
||||||
@ -484,17 +505,6 @@ export default {
|
|||||||
if (this.parameters) {
|
if (this.parameters) {
|
||||||
data.parameters = this.parameters
|
data.parameters = this.parameters
|
||||||
}
|
}
|
||||||
this.showConfirmRunAssetsDialog = true
|
|
||||||
this.$axios.post('/api/v1/ops/inventory/classified-hosts/', {
|
|
||||||
assets: hosts,
|
|
||||||
nodes: nodes,
|
|
||||||
module: this.module,
|
|
||||||
args: this.command,
|
|
||||||
runas: this.runas,
|
|
||||||
runas_policy: this.runasPolicy
|
|
||||||
}).then(data => {
|
|
||||||
this.classifiedAssets = data
|
|
||||||
})
|
|
||||||
createJob(data).then(res => {
|
createJob(data).then(res => {
|
||||||
this.executionInfo.timeCost = 0
|
this.executionInfo.timeCost = 0
|
||||||
this.executionInfo.status = { value: 'running', label: this.$t('Running') }
|
this.executionInfo.status = { value: 'running', label: this.$t('Running') }
|
||||||
|
@ -6,16 +6,26 @@
|
|||||||
:show-confirm="true"
|
:show-confirm="true"
|
||||||
:show-cancel="true"
|
:show-cancel="true"
|
||||||
width="1000px"
|
width="1000px"
|
||||||
|
@confirm="onConfirm"
|
||||||
|
@cancel="onCancel"
|
||||||
>
|
>
|
||||||
<div class="confirm-run-assets-dialog">
|
<div class="confirm-run-assets-dialog">
|
||||||
<div class="assets-list">
|
<div class="assets-list">
|
||||||
<div class="asset-group">
|
<div class="asset-group">
|
||||||
<div class="group-title">可运行资产:</div>
|
<div class="group-title">可运行资产:</div>
|
||||||
<el-checkbox-group v-model="selectedAssets" class="group-assets">
|
<el-checkbox
|
||||||
|
v-model="checkAll"
|
||||||
|
:indeterminate="isIndeterminate"
|
||||||
|
style="margin-left: 10px"
|
||||||
|
@change="handleCheckAllChange"
|
||||||
|
>
|
||||||
|
{{ $t('All') }}
|
||||||
|
</el-checkbox>
|
||||||
|
<el-checkbox-group v-model="selectedAssets" class="group-assets" @change="handleCheckedAssetChange">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-for="asset in runnableAssets"
|
v-for="asset in runnableAssets"
|
||||||
:key="asset.id"
|
:key="asset.id"
|
||||||
:label="asset.name"
|
:label="asset.id"
|
||||||
class="asset-item"
|
class="asset-item"
|
||||||
>
|
>
|
||||||
<div class="asset-item">
|
<div class="asset-item">
|
||||||
@ -72,8 +82,9 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
searchQuery: '',
|
checkAll: false,
|
||||||
selectedAssets: []
|
selectedAssets: [],
|
||||||
|
isIndeterminate: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -81,7 +92,7 @@ export default {
|
|||||||
return this.assets.runnable
|
return this.assets.runnable
|
||||||
},
|
},
|
||||||
failedAssets() {
|
failedAssets() {
|
||||||
return [...this.assets.skipped, ...this.assets.error]
|
return this.assets.error
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -89,7 +100,17 @@ export default {
|
|||||||
this.$emit('update:visible', false)
|
this.$emit('update:visible', false)
|
||||||
},
|
},
|
||||||
onConfirm() {
|
onConfirm() {
|
||||||
this.$emit('confirm', this.selectedAssets)
|
this.$emit('submit', this.selectedAssets, [])
|
||||||
|
this.$emit('update:visible', false)
|
||||||
|
},
|
||||||
|
handleCheckAllChange(value) {
|
||||||
|
this.selectedAssets = value ? this.runnableAssets.map((item) => item.id) : []
|
||||||
|
this.isIndeterminate = false
|
||||||
|
},
|
||||||
|
handleCheckedAssetChange(value) {
|
||||||
|
const checkedCount = value.length
|
||||||
|
this.checkAll = checkedCount === this.runnableAssets.length
|
||||||
|
this.isIndeterminate = checkedCount > 0 && checkedCount < this.runnableAssets.length
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user