Skip to content

Commit

Permalink
Merge pull request #571 from WeBankPartners/557_display_isUnique_prop…
Browse files Browse the repository at this point in the history
…erty

bugfix #557 to display isUnique property in page
  • Loading branch information
zhangsenfeng authored Dec 24, 2019
2 parents d318d87 + 65b26a7 commit 63e8314
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 31 deletions.
1 change: 1 addition & 0 deletions cmdb-ui/src/locale/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"is_access_controlled": "Is Access Controlled",
"is_nullable": "Is Nullable",
"is_editable": "Is Editable",
"is_unique": "Is Unique",
"is_auto": "Is Auto Fill",
"auto_fill_rule": "Auto Fill Rule",
"filter_rule": "Filter Rule",
Expand Down
1 change: 1 addition & 0 deletions cmdb-ui/src/locale/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"is_access_controlled": "权限控制",
"is_nullable": "允许为空",
"is_editable": "是否可编辑",
"is_unique": "是否唯一",
"is_auto": "自动填充",
"auto_fill_rule": "填充规则",
"filter_rule": "过滤规则",
Expand Down
81 changes: 50 additions & 31 deletions cmdb-ui/src/pages/admin/cmdb-model-management.vue
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,7 @@
<Select v-model="addNewCITypeForm.imageFileId">
<img
v-if="addNewCITypeForm.imageFileId"
:src="
`${baseURL}/files/${addNewCITypeForm.imageFileId}.png`
"
:src="`${baseURL}/files/${addNewCITypeForm.imageFileId}.png`"
slot="prefix"
height="24"
width="24"
Expand Down Expand Up @@ -649,6 +647,20 @@
>
</RadioGroup>
</FormItem>
<FormItem prop="isUnique" :label="$t('is_unique')">
<RadioGroup v-model="item.form.isUnique">
<Radio
:disabled="item.form.status === 'decommissioned'"
label="yes"
>Yes</Radio
>
<Radio
:disabled="item.form.status === 'decommissioned'"
label="no"
>No</Radio
>
</RadioGroup>
</FormItem>
<FormItem prop="isAuto" :label="$t('is_auto')">
<RadioGroup v-model="item.form.isAuto">
<Radio
Expand Down Expand Up @@ -897,6 +909,12 @@
<Radio label="no">No</Radio>
</RadioGroup>
</FormItem>
<FormItem prop="isUnique" :label="$t('is_unique')">
<RadioGroup v-model="addNewAttrForm.isUnique">
<Radio label="yes">Yes</Radio>
<Radio label="no">No</Radio>
</RadioGroup>
</FormItem>
<FormItem prop="isAuto" :label="$t('is_auto')">
<RadioGroup v-model="addNewAttrForm.isAuto">
<Radio label="yes">Yes</Radio>
Expand Down Expand Up @@ -1068,7 +1086,8 @@ export default {
isDisplayed: "no",
isNullable: "no",
isAuto: "no",
isEditable: "yes"
isEditable: "yes",
isUnique: "no"
},
allCiTypes: [],
allCiTypesWithAttr: [],
Expand Down Expand Up @@ -1102,6 +1121,7 @@ export default {
isAuto: "no",
isDisplayed: "no",
isEditable: "yes",
isUnique: "no",
isNullable: "no",
isRefreshable: "no",
searchSeqNo: 0
Expand Down Expand Up @@ -1189,6 +1209,7 @@ export default {
isNullable: j.isNullable ? "yes" : "no",
isAuto: j.isAuto ? "yes" : "no",
isEditable: j.isEditable ? "yes" : "no",
isUnique: j.isUnique ? "yes" : "no",
searchSeqNo: j.searchSeqNo || 0
});
});
Expand Down Expand Up @@ -1231,23 +1252,15 @@ export default {
layerTag += `"layer_${_.layerId}"`;
}
tempClusterObjForGraph[index] = [
`{ rank=same; "layer_${_.layerId}"[id="layerId_${
_.layerId
}",class="layer",label="${_.name}",tooltip="${_.name}"];`
`{ rank=same; "layer_${_.layerId}"[id="layerId_${_.layerId}",class="layer",label="${_.name}",tooltip="${_.name}"];`
];
nodes.length > 0 &&
nodes.forEach((node, nodeIndex) => {
if (node.layerId === _.layerId) {
let fontcolor =
node.status === "notCreated" ? "#10a34e" : "black";
tempClusterObjForGraph[index].push(
`"ci_${node.ciTypeId}"[id="${node.ciTypeId}",label="${
node.name
}",tooltip="${
node.name
}",class="ci",fontcolor="${fontcolor}", image="${
node.form.imgSource
}.png", labelloc="b"]`
`"ci_${node.ciTypeId}"[id="${node.ciTypeId}",label="${node.name}",tooltip="${node.name}",class="ci",fontcolor="${fontcolor}", image="${node.form.imgSource}.png", labelloc="b"]`
);
}
if (nodeIndex === nodes.length - 1) {
Expand Down Expand Up @@ -1280,9 +1293,7 @@ export default {
genEdge(nodes, from, to) {
const target = nodes.find(_ => _.ciTypeId === to.referenceId);
let labels = to.referenceName ? to.referenceName.trim() : "";
return `"ci_${from.ciTypeId}"->"ci_${
target.ciTypeId
}"[taillabel="${labels}",labeldistance=3];`;
return `"ci_${from.ciTypeId}"->"ci_${target.ciTypeId}"[taillabel="${labels}",labeldistance=3];`;
},
shadeAll() {
d3.selectAll("g path")
Expand Down Expand Up @@ -1751,6 +1762,7 @@ export default {
isNullable: this.addNewAttrForm.isNullable === "yes",
isAuto: this.addNewAttrForm.isAuto === "yes",
isEditable: this.addNewAttrForm.isEditable === "yes",
isUnique: this.addNewAttrForm.isUnique === "yes",
callbackId: "10000001"
};
let res = await createNewCIAttr(this.currentSelectedCI.ciTypeId, payload);
Expand Down Expand Up @@ -1781,7 +1793,8 @@ export default {
form.inputType === "text" && form.isAccessControlled === "yes",
isNullable: form.isNullable === "yes",
isAuto: form.isAuto === "yes",
isEditable: form.isEditable === "yes"
isEditable: form.isEditable === "yes",
isUnique: form.isUnique === "yes"
};
delete payload.status;
delete payload.ciType;
Expand Down Expand Up @@ -1811,7 +1824,8 @@ export default {
form.inputType === "text" && form.isAccessControlled === "yes",
isNullable: form.isNullable === "yes",
isAuto: form.isAuto === "yes",
isEditable: form.isEditable === "yes"
isEditable: form.isEditable === "yes",
isUnique: form.isUnique === "yes"
}
);
if (updateRes.statusCode === "OK") {
Expand Down Expand Up @@ -1876,15 +1890,20 @@ export default {
}
},
async getAllCiTypeWithAttr() {
const res = await getAllCITypesByLayerWithAttr(["notCreated", "created", "decommissioned"])
const res = await getAllCITypesByLayerWithAttr([
"notCreated",
"created",
"decommissioned"
]);
if (res.statusCode === "OK") {
let allCiTypesWithAttr = []
let allCiTypesWithAttr = [];
res.data.forEach(layer => {
layer.ciTypes && layer.ciTypes.forEach(_ => {
allCiTypesWithAttr.push(_)
})
})
this.allCiTypesWithAttr = allCiTypesWithAttr
layer.ciTypes &&
layer.ciTypes.forEach(_ => {
allCiTypesWithAttr.push(_);
});
});
this.allCiTypesWithAttr = allCiTypesWithAttr;
}
},
async getAllInputTypesList() {
Expand Down Expand Up @@ -1912,11 +1931,11 @@ export default {
}
},
reRenderGraph() {
this.nodeName = ""
this.currentSelectedLayer = {}
this.currentSelectedCI = {}
this.nodeName = "";
this.currentSelectedLayer = {};
this.currentSelectedCI = {};
this.getAllCITypesList();
this.initGraph()
this.initGraph();
}
},
mounted() {
Expand All @@ -1925,7 +1944,7 @@ export default {
this.getAllInputTypesList();
this.getAllReferenceTypesList();
this.getTableStatusList();
this.getAllCiTypeWithAttr()
this.getAllCiTypeWithAttr();
},
computed: {
setUploadActionHeader() {
Expand Down

0 comments on commit 63e8314

Please sign in to comment.