mirror of https://github.com/veops/cmdb.git
Merge branch 'master' of github.com:veops/cmdb
This commit is contained in:
commit
9ffa9c943d
|
@ -84,3 +84,10 @@ export function getDCIMHistoryOperate(params) {
|
|||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function calcUnitFreeCount() {
|
||||
return axios({
|
||||
url: `/v0.1/dcim/rack/calc_u_free_count`,
|
||||
method: 'POST'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -894,7 +894,11 @@ if __name__ == "__main__":
|
|||
deviceName: 'Device Name',
|
||||
removeDevice: 'Remove Device',
|
||||
moveDevice: 'Move Device',
|
||||
rackDetail: 'Rack Detail'
|
||||
rackDetail: 'Rack Detail',
|
||||
calcUnitFreeCount: 'Calculate Rack Free Unit Count',
|
||||
calcUnitFreeCountTip: 'Calculating in the background, refresh the page later to see the result',
|
||||
calcUnitFreeCountTip1: 'Calculate Trigger Success, refresh the page later to see the result',
|
||||
calcUnitFreeCountTip2: `Confirm that you want to calculate the number of free Units for all rack?`
|
||||
}
|
||||
}
|
||||
export default cmdb_en
|
||||
|
|
|
@ -893,7 +893,11 @@ if __name__ == "__main__":
|
|||
deviceName: '设备名',
|
||||
removeDevice: '删除设备',
|
||||
moveDevice: '移动设备',
|
||||
rackDetail: '机柜详情'
|
||||
rackDetail: '机柜详情',
|
||||
calcUnitFreeCount: '计算机柜空闲U数',
|
||||
calcUnitFreeCountTip: '后台计算中,稍后刷新页面查看结果',
|
||||
calcUnitFreeCountTip1: '计算触发成功,稍后刷新页面查看结果',
|
||||
calcUnitFreeCountTip2: '确认要计算所有机柜的空闲U数?'
|
||||
}
|
||||
}
|
||||
export default cmdb_zh
|
||||
|
|
|
@ -21,11 +21,24 @@
|
|||
<a>
|
||||
<a-icon
|
||||
type="plus-circle"
|
||||
class="dcim-tree-header-add-icon"
|
||||
class="dcim-tree-header-menu-icon"
|
||||
/>
|
||||
{{ $t(addActionTitle[type]) }}
|
||||
</a>
|
||||
</a-menu-item>
|
||||
|
||||
<a-menu-item
|
||||
class="dcim-tree-header-calc"
|
||||
@click="calcUnitFreeCount"
|
||||
>
|
||||
<a>
|
||||
<ops-icon
|
||||
type="veops-refresh"
|
||||
class="dcim-tree-header-menu-icon"
|
||||
/>
|
||||
{{ $t('cmdb.dcim.calcUnitFreeCount') }}
|
||||
</a>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
|
@ -121,7 +134,7 @@
|
|||
<script>
|
||||
import _ from 'lodash'
|
||||
import { DCIM_TYPE, DCIM_TYPE_NAME_MAP } from '../constants.js'
|
||||
import { deleteDCIM } from '@/modules/cmdb/api/dcim.js'
|
||||
import { deleteDCIM, calcUnitFreeCount } from '@/modules/cmdb/api/dcim.js'
|
||||
import CIDetailDrawer from '@/modules/cmdb/views/ci/modules/ciDetailDrawer.vue'
|
||||
|
||||
export default {
|
||||
|
@ -153,7 +166,9 @@ export default {
|
|||
],
|
||||
|
||||
viewDetailCITypeId: 0,
|
||||
viewDetailAttrObj: {}
|
||||
viewDetailAttrObj: {},
|
||||
|
||||
calculatedFreeUnitCount: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -259,6 +274,23 @@ export default {
|
|||
this.$refs.CIdetailRef.create(node._id)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
calcUnitFreeCount() {
|
||||
if (this.calculatedFreeUnitCount) {
|
||||
this.$message.info(this.$t('cmdb.dcim.calcUnitFreeCountTip'))
|
||||
} else {
|
||||
this.$confirm({
|
||||
title: this.$t('tip'),
|
||||
content: this.$t('cmdb.dcim.calcUnitFreeCountTip2'),
|
||||
onOk: () => {
|
||||
calcUnitFreeCount().then(() => {
|
||||
this.calculatedFreeUnitCount = true
|
||||
this.$message.success(this.$t('cmdb.dcim.calcUnitFreeCountTip1'))
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -281,7 +313,11 @@ export default {
|
|||
padding: 0px;
|
||||
}
|
||||
|
||||
&-add-icon {
|
||||
&-calc {
|
||||
border-top: dashed 1px #e8e8e8;
|
||||
}
|
||||
|
||||
&-menu-icon {
|
||||
margin-right: 6px;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue