Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,14 @@
import FilterStore from '@/components/filters/store'
import FilterUtils from '@/components/filters/utils'
import { BUILTIN_MODELS } from '@/dictionary/model-constants.js'
import { IPWithCloudSymbol, IPWithCloudFields, IPv6WithCloudSymbol, IPv46WithCloudSymbol, IPv64WithCloudSymbol } from '@/dictionary/ip-with-cloud-symbol'
import { isEmptyPropertyValue } from '@/utils/tools'

export default {
components: {
FilterCollection,
FilterFastSearch,
},
data() {
return {
IPWithCloudSymbol: Symbol('IPWithCloud')
}
},
computed: {
...mapGetters('userCustom', ['usercustom']),
...mapState('bizSet', ['bizId']),
Expand All @@ -68,15 +65,15 @@
return !!this.selection.length
},
clipboardList() {
const IPWithCloud = FilterUtils.defineProperty({
id: this.IPWithCloudSymbol,
bk_obj_id: BUILTIN_MODELS.HOST,
bk_property_id: this.IPWithCloudSymbol,
bk_property_name: `${this.$t('管控区域')}ID:IP`,
const IPWithClouds = Object.keys(IPWithCloudFields).map(key => FilterUtils.defineProperty({
id: key,
bk_obj_id: 'host',
bk_property_id: key,
bk_property_name: IPWithCloudFields[key],
bk_property_type: 'singlechar'
})
}))
const clipboardList = this.$parent.tableHeader.slice()
clipboardList.splice(1, 0, IPWithCloud)
clipboardList.splice(3, 0, ...IPWithClouds)
return clipboardList
},
tableHeaderPropertyIdList() {
Expand All @@ -91,11 +88,34 @@
const copyText = this.selection.map((data) => {
const modelId = property.bk_obj_id
const modelData = data[modelId]
if (property.id === this.IPWithCloudSymbol) {

const IPWithCloudKeys = Object.keys(IPWithCloudFields)
if (IPWithCloudKeys.includes(property.id)) {
const cloud = this.$tools.getPropertyCopyValue(modelData.bk_cloud_id, 'foreignkey')
const ip = this.$tools.getPropertyCopyValue(modelData.bk_host_innerip, 'singlechar')
return `${cloud}:${ip}`
const ipv6 = this.$tools.getPropertyCopyValue(modelData.bk_host_innerip_v6, 'singlechar')
const isEmptyIPv4Value = isEmptyPropertyValue(modelData.bk_host_innerip)
const isEmptyIPv6Value = isEmptyPropertyValue(modelData.bk_host_innerip_v6)
if (property.id === IPWithCloudSymbol) {
return `${cloud}:${ip}`
}
if (property.id === IPv6WithCloudSymbol) {
return `${cloud}:[${ipv6}]`
}
if (property.id === IPv46WithCloudSymbol) {
if (!isEmptyIPv4Value || isEmptyIPv6Value) {
return `${cloud}:${ip}`
}
return `${cloud}:[${ipv6}]`
}
if (property.id === IPv64WithCloudSymbol) {
if (isEmptyIPv4Value || !isEmptyIPv6Value) {
return `${cloud}:[${ipv6}]`
}
return `${cloud}:${ip}`
}
}

const propertyId = property.bk_property_id
if (Array.isArray(modelData)) {
const value = modelData.map(item => this.$tools.getPropertyCopyValue(item[propertyId], property))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@
this.currentNode = node
const result = await this.searchHost(node)
this.hostList = result.info
this.setNodeCount(this.findNode(node.parent, [...node.children]))
},
findNode(node, data) {
while (node.parent) {
data.push(...node.children)
return this.findNode(node.parent, data)
}
return data
},
async handleHostPaginationChange() {
const result = await this.searchHost(this.currentNode)
Expand Down
2 changes: 1 addition & 1 deletion src/ui/src/views/dynamic-group/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
}
}
this.filter.forEach((item) => {
const itemValue = item.value?.split(',')
const itemValue = item.value?.split(/,|;|\n|\s/)
const value = itemValue?.length > 1 ? {
$in: itemValue
} : itemValue[0]
Expand Down
19 changes: 18 additions & 1 deletion src/ui/src/views/model-manage/children/model-details/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@
MENU_MODEL_MANAGEMENT,
MENU_RESOURCE_INSTANCE,
MENU_MODEL_FIELD_TEMPLATE,
MENU_MODEL_FIELD_TEMPLATE_SYNC_MODEL
MENU_MODEL_FIELD_TEMPLATE_SYNC_MODEL,
MENU_RESOURCE_COLLECTION
} from '@/dictionary/menu-symbol'
import { BUILTIN_MODEL_RESOURCE_MENUS, BUILTIN_MODELS } from '@/dictionary/model-constants.js'
import EditableField from '@/components/ui/details/editable-field.vue'
Expand Down Expand Up @@ -373,6 +374,7 @@
}
},
computed: {
...mapGetters('userCustom', ['usercustom']),
...mapGetters([
'supplierAccount',
'userName'
Expand Down Expand Up @@ -684,6 +686,10 @@
bk_obj_id: this.activeModel.bk_obj_id
})
this.updateActiveModel()
if (ispaused) {
// 停用了调用更新收藏模型的接口
this.updateModelCollection()
}
},
async deleteModel() {
if (this.isMainLineModel) {
Expand All @@ -707,8 +713,19 @@
this.$routerActions.redirect({ name: MENU_MODEL_MANAGEMENT })
}
this.$success(this.$t('删除成功'))
this.updateModelCollection()
this.$http.cancel('post_searchClassificationsObjects')
},
// 停用或者删除模型后,如果该模型被收藏了,则取消收藏
updateModelCollection() {
const oldCollection = this.usercustom[MENU_RESOURCE_COLLECTION] || []
// 如果之前没收藏则返回,收藏了则取消收藏
const hasCollection = oldCollection.filter(id => id === this.activeModel.bk_obj_id)
if (!hasCollection.length) return
this.$store.dispatch('userCustom/saveUsercustom', {
[MENU_RESOURCE_COLLECTION]: oldCollection.filter(id => id !== this.activeModel.bk_obj_id)
})
},
handleGoInstance() {
const model = this.activeModel
if (has(BUILTIN_MODEL_RESOURCE_MENUS, model.bk_obj_id)) {
Expand Down
6 changes: 4 additions & 2 deletions src/ui/src/views/operation/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,10 @@
// eslint-disable-next-line no-plusplus
if (item.count === 0) zeroList++
if (data.chart_type === 'pie') {
content.labels.push(item.id)
if (item.count !== 0) content.values.push(item.count)
if (item.count !== 0) {
content.labels.push(item.id)
content.values.push(item.count)
}
} else {
const color = '#3A84FF'
content.marker.color.push(color)
Expand Down