diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue
index 2077bc6b30..19b0c5b972 100644
--- a/frontend/src/business/components/track/case/TestCase.vue
+++ b/frontend/src/business/components/track/case/TestCase.vue
@@ -17,6 +17,7 @@
:draggable="true"
:select-node.sync="selectNode"
@refreshTable="refreshTable"
+ :current-project="currentProject"
ref="nodeTree"/>
@@ -39,6 +40,7 @@
:read-only="testCaseReadOnly"
:tree-nodes="treeNodes"
:select-node="selectNode"
+ :current-project="currentProject"
ref="testCaseEditDialog">
diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue
index 566e407478..8545ffa84f 100644
--- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue
+++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue
@@ -250,6 +250,9 @@
},
selectNode: {
type: Object
+ },
+ currentProject: {
+ type: Object
}
},
mounted() {
@@ -330,9 +333,11 @@
param.nodePath = item.path;
}
});
- if(localStorage.getItem(CURRENT_PROJECT)) {
- param.projectId = JSON.parse(localStorage.getItem(CURRENT_PROJECT)).id;
+
+ if (this.currentProject) {
+ param.projectId = this.currentProject.id;
}
+
param.name = param.name.trim();
if (param.name == '') {
this.$warning(this.$t('test_track.case.input_name'));
diff --git a/frontend/src/business/components/track/common/NodeEdit.vue b/frontend/src/business/components/track/common/NodeEdit.vue
index 004cdc60ce..03955bcf86 100644
--- a/frontend/src/business/components/track/common/NodeEdit.vue
+++ b/frontend/src/business/components/track/common/NodeEdit.vue
@@ -57,6 +57,9 @@
props: {
treeNodes: {
type: Array
+ },
+ currentProject: {
+ type: Object
}
},
methods: {
@@ -106,8 +109,8 @@
}
param.name = this.form.name.trim();
param.label = this.form.name;
- if (localStorage.getItem(CURRENT_PROJECT)) {
- param.projectId = JSON.parse(localStorage.getItem(CURRENT_PROJECT)).id;
+ if (this.currentProject) {
+ param.projectId = this.currentProject.id;
}
return url;
},
diff --git a/frontend/src/business/components/track/common/NodeTree.vue b/frontend/src/business/components/track/common/NodeTree.vue
index 5c304dfe7a..34e8960078 100644
--- a/frontend/src/business/components/track/common/NodeTree.vue
+++ b/frontend/src/business/components/track/common/NodeTree.vue
@@ -49,7 +49,7 @@
-
+
@@ -83,6 +83,9 @@ export default {
draggable: {
type: Boolean,
default: true
+ },
+ currentProject: {
+ type: Object
}
},
watch: {