|
@@ -57,7 +57,7 @@ export default {
|
|
|
return {
|
|
|
'mdi-plus-circle-outline': !this.is_creating_folder,
|
|
|
'mdi-loading': this.is_creating_folder,
|
|
|
- active: this.new_folder_name.length > 4 && !this.is_creating_folder,
|
|
|
+ active: this.new_folder_name.length > 4 && this.checkFlagNameUniqness() && !this.is_creating_folder,
|
|
|
loading: this.is_creating_folder
|
|
|
}
|
|
|
},
|
|
@@ -76,15 +76,28 @@ export default {
|
|
|
openFlagColl: 'User/openFlagColl',
|
|
|
openCloseHamMenu: 'Common/openCloseHamMenu'
|
|
|
}),
|
|
|
+ checkFlagNameUniqness () {
|
|
|
+ let uniq = true
|
|
|
+ const flagcolls_ids = Object.keys(this.flagcolls);
|
|
|
+ flagcolls_ids.forEach((id) => {
|
|
|
+ if(this.flagcolls[id].name === this.new_folder_name){
|
|
|
+ uniq = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return uniq
|
|
|
+ },
|
|
|
onCreateFlagColl () {
|
|
|
console.log("UserFlags onCreateFlagColl", this.new_folder_name)
|
|
|
- this.is_creating_folder = true;
|
|
|
- this.createFlagColl(this.new_folder_name)
|
|
|
- .then(data => {
|
|
|
- console.log("onCreateFlagColl then", data)
|
|
|
- this.new_folder_name = "";
|
|
|
- this.is_creating_folder = false;
|
|
|
- })
|
|
|
+ if (this.new_folder_name.length > 4 && this.checkFlagNameUniqness()){
|
|
|
+ // create new flagcoll
|
|
|
+ this.is_creating_folder = true;
|
|
|
+ this.createFlagColl(this.new_folder_name)
|
|
|
+ .then(data => {
|
|
|
+ console.log("onCreateFlagColl then", data)
|
|
|
+ this.new_folder_name = "";
|
|
|
+ this.is_creating_folder = false;
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
onDeleteFlagColl (e) {
|
|
|
const flagcollid = e.target.getAttribute('flagcollid');
|