mirror of https://github.com/veops/cmdb.git
fix(ui): some bugs (#512)
This commit is contained in:
parent
a903738cdc
commit
c92a3a5f31
|
@ -49,6 +49,8 @@
|
|||
import _ from 'lodash'
|
||||
import '@wangeditor/editor/dist/css/style.css'
|
||||
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
||||
import { i18nChangeLanguage } from '@wangeditor/editor'
|
||||
|
||||
export default {
|
||||
name: 'NoticeContent',
|
||||
components: { Editor, Toolbar },
|
||||
|
@ -76,6 +78,10 @@ export default {
|
|||
if (editor == null) return
|
||||
editor.destroy() // When the component is destroyed, destroy the editor in time
|
||||
},
|
||||
beforeCreate() {
|
||||
const locale = this.$i18n.locale === 'zh' ? 'zh-CN' : 'en'
|
||||
i18nChangeLanguage(locale)
|
||||
},
|
||||
methods: {
|
||||
onCreated(editor) {
|
||||
this.editor = Object.seal(editor) // Be sure to use Object.seal(), otherwise an error will be reported
|
||||
|
|
|
@ -198,6 +198,9 @@ export default {
|
|||
if (this.type === 'resourceSearch') {
|
||||
this.getCITypeGroups()
|
||||
}
|
||||
if (this.typeId) {
|
||||
this.currenCiType = [this.typeId]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// toggleAdvanced() {
|
||||
|
|
|
@ -4,6 +4,7 @@ const cmdb_en = {
|
|||
configTable: 'Config Table',
|
||||
menu: {
|
||||
views: 'Views',
|
||||
resources: 'Resources',
|
||||
config: 'Configuration',
|
||||
backend: 'Management',
|
||||
ciTable: 'Resource Views',
|
||||
|
@ -69,9 +70,9 @@ const cmdb_en = {
|
|||
adAutoInLib: 'Save as CI auto',
|
||||
adInterval: 'Collection frequency',
|
||||
byInterval: 'by interval',
|
||||
allNodes: 'All nodes',
|
||||
specifyNodes: 'Specify Node',
|
||||
specifyNodesTips: 'Please fill in the specify node!',
|
||||
allNodes: 'All Instances',
|
||||
specifyNodes: 'Specify Instance',
|
||||
specifyNodesTips: 'Please fill in the specify instance!',
|
||||
username: 'Username',
|
||||
password: 'Password',
|
||||
link: 'Link',
|
||||
|
@ -144,7 +145,7 @@ const cmdb_en = {
|
|||
triggerDataChange: 'Data changes',
|
||||
triggerDate: 'Date attribute',
|
||||
triggerEnable: 'Turn on',
|
||||
descInput: 'Please enter remarks',
|
||||
descInput: 'Please enter descriptions',
|
||||
triggerCondition: 'Triggering conditions',
|
||||
addInstance: 'Add new instance',
|
||||
deleteInstance: 'Delete instance',
|
||||
|
|
|
@ -4,8 +4,9 @@ const cmdb_zh = {
|
|||
configTable: '配置表格',
|
||||
menu: {
|
||||
views: '视图',
|
||||
resources: '资源',
|
||||
config: '配置',
|
||||
backend: '管理端',
|
||||
backend: '管理',
|
||||
ciTable: '资源数据',
|
||||
ciTree: '资源层级',
|
||||
ciSearch: '资源搜索',
|
||||
|
@ -69,9 +70,9 @@ const cmdb_zh = {
|
|||
adAutoInLib: '自动入库',
|
||||
adInterval: '采集频率',
|
||||
byInterval: '按间隔',
|
||||
allNodes: '所有节点',
|
||||
specifyNodes: '指定节点',
|
||||
specifyNodesTips: '请填写指定节点!',
|
||||
allNodes: '所有实例',
|
||||
specifyNodes: '指定实例',
|
||||
specifyNodesTips: '请填写指定实例!',
|
||||
username: '用户名',
|
||||
password: '密码',
|
||||
link: '链接',
|
||||
|
@ -144,7 +145,7 @@ const cmdb_zh = {
|
|||
triggerDataChange: '数据变更',
|
||||
triggerDate: '日期属性',
|
||||
triggerEnable: '开启',
|
||||
descInput: '请输入备注',
|
||||
descInput: '请输入描述',
|
||||
triggerCondition: '触发条件',
|
||||
addInstance: '新增实例',
|
||||
deleteInstance: '删除实例',
|
||||
|
|
|
@ -19,7 +19,7 @@ const genCmdbRoutes = async () => {
|
|||
{
|
||||
path: '/cmdb/disabled1',
|
||||
name: 'cmdb_disabled1',
|
||||
meta: { title: 'cmdb.menu.views', disabled: true },
|
||||
meta: { title: 'cmdb.menu.resources', disabled: true },
|
||||
},
|
||||
{
|
||||
path: '/cmdb/resourceviews',
|
||||
|
|
|
@ -107,6 +107,7 @@
|
|||
v-decorator="[list.name, { rules: [{ required: false }] }]"
|
||||
style="width: 100%"
|
||||
:format="getFieldType(list.name) == '4' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss'"
|
||||
:valueFormat="getFieldType(list.name) == '4' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss'"
|
||||
v-if="getFieldType(list.name) === '4' || getFieldType(list.name) === '3'"
|
||||
:showTime="getFieldType(list.name) === '4' ? false : { format: 'HH:mm:ss' }"
|
||||
/>
|
||||
|
@ -370,7 +371,7 @@ export default {
|
|||
return 'select%%multiple'
|
||||
}
|
||||
return 'select'
|
||||
} else if (_find.value_type === '0' || _find.value_type === '1') {
|
||||
} else if ((_find.value_type === '0' || _find.value_type === '1') && !_find.is_list) {
|
||||
return 'input_number'
|
||||
} else if (_find.value_type === '4' || _find.value_type === '3') {
|
||||
return _find.value_type
|
||||
|
|
|
@ -182,7 +182,7 @@ export default {
|
|||
const edges = []
|
||||
this.parentCITypes.forEach((parent) => {
|
||||
const _findCiType = ci_types_list.find((item) => item.id === parent.id)
|
||||
if (this.firstCIs[parent.name]) {
|
||||
if (this.firstCIs[parent.name] && _findCiType) {
|
||||
const unique_id = _findCiType.show_id || _findCiType.unique_id
|
||||
const _findUnique = parent.attributes.find((attr) => attr.id === unique_id)
|
||||
const unique_name = _findUnique?.name
|
||||
|
@ -225,7 +225,7 @@ export default {
|
|||
})
|
||||
this.childCITypes.forEach((child) => {
|
||||
const _findCiType = ci_types_list.find((item) => item.id === child.id)
|
||||
if (this.secondCIs[child.name]) {
|
||||
if (this.secondCIs[child.name] && _findCiType) {
|
||||
const unique_id = _findCiType.show_id || _findCiType.unique_id
|
||||
const _findUnique = child.attributes.find((attr) => attr.id === unique_id)
|
||||
const unique_name = _findUnique?.name
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
<a-tab-pane key="tab_5">
|
||||
<span slot="tab"><ops-icon type="itsm-association" />{{ $t('cmdb.ci.relITSM') }}</span>
|
||||
<div :style="{ padding: '24px', height: '100%' }">
|
||||
<related-itsm-table :ci_id="ci._id" :ciHistory="ciHistory" :itsmInstalled="itsmInstalled" />
|
||||
<RelatedItsmTable ref="relatedITSMTable" :ci_id="ci._id" :ciHistory="ciHistory" :itsmInstalled="itsmInstalled" :attrList="attrList" />
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
|
@ -140,8 +140,6 @@ import CiDetailRelation from './ciDetailRelation.vue'
|
|||
import TriggerTable from '../../operation_history/modules/triggerTable.vue'
|
||||
import RelatedItsmTable from './ciDetailRelatedItsmTable.vue'
|
||||
import CiRollbackForm from './ciRollbackForm.vue'
|
||||
import { sleep } from '@/utils/util'
|
||||
|
||||
export default {
|
||||
name: 'CiDetailTab',
|
||||
components: {
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
</div>
|
||||
<SearchForm
|
||||
ref="search"
|
||||
type="resourceSearch"
|
||||
:type="type"
|
||||
:typeId="typeId"
|
||||
@refresh="handleSearch"
|
||||
:preferenceAttrList="allAttributesList"
|
||||
@updateAllAttributesList="updateAllAttributesList"
|
||||
|
@ -205,7 +206,7 @@ import _ from 'lodash'
|
|||
import SearchForm from '../../components/searchForm/SearchForm.vue'
|
||||
import { searchCI } from '../../api/ci'
|
||||
import { searchAttributes, getCITypeAttributesByTypeIds, getCITypeAttributesById } from '../../api/CITypeAttr'
|
||||
import { getCITypes } from '../../api/CIType'
|
||||
import { getCITypes, getCIType } from '../../api/CIType'
|
||||
import { getSubscribeAttributes } from '../../api/preference'
|
||||
import { getCITableColumns } from '../../utils/helper'
|
||||
import EditAttrsPopover from '../ci/modules/editAttrsPopover.vue'
|
||||
|
@ -221,6 +222,14 @@ export default {
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
typeId: {
|
||||
type: Number,
|
||||
default: null
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'resourceSearch'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -250,8 +259,14 @@ export default {
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.typeId) {
|
||||
this.getCIType(this.typeId)
|
||||
this.getAttrsByType(this.typeId)
|
||||
this.loadInstance()
|
||||
} else {
|
||||
this.getAllAttr()
|
||||
this.getAllCiTypes()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getAllCiTypes() {
|
||||
|
@ -259,6 +274,17 @@ export default {
|
|||
this.ciTypes = res.ci_types
|
||||
})
|
||||
},
|
||||
getCIType(typeId) {
|
||||
getCIType(typeId).then((res) => {
|
||||
this.ciTypes = res.ci_types
|
||||
})
|
||||
},
|
||||
async getAttrsByType(typeId) {
|
||||
await getCITypeAttributesById(typeId).then((res) => {
|
||||
this.allAttributesList = res.attributes
|
||||
this.originAllAttributesList = res.attributes
|
||||
})
|
||||
},
|
||||
async getAllAttr() {
|
||||
await searchAttributes({ page_size: 9999 }).then((res) => {
|
||||
this.allAttributesList = res.attributes
|
||||
|
|
Loading…
Reference in New Issue