This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
/* Xeslint-disable */
|
||||
|
||||
import _ from "../libs/lodash.min.js";
|
||||
|
||||
/////////////////////////////////
|
||||
// General utility library
|
||||
//
|
||||
@@ -69,6 +71,31 @@ export default {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
///////////////////////////////
|
||||
// CLEAN TAG NAME
|
||||
// Clean up a tag with same rules as server
|
||||
//
|
||||
normalizeTag: function(tagName) {
|
||||
//kebab case takes care of all the things we need for tags in one go
|
||||
tagName = _.kebabCase(tagName);
|
||||
|
||||
//No longer than 255 characters
|
||||
tagName = tagName.length > 255 ? tagName.substr(0, 255 - 1) : tagName;
|
||||
|
||||
return tagName;
|
||||
//
|
||||
// //This may be naive when we get international customers but for now supporting utf-8 and it appears it's safe to do this with unicode
|
||||
// inObj = inObj.ToLowerInvariant();
|
||||
// //No spaces in tags, replace with dashes
|
||||
// inObj = inObj.Replace(" ", "-");
|
||||
// //Remove multiple dash sequences
|
||||
// inObj = System.Text.RegularExpressions.Regex.Replace(inObj, "-+", "-");
|
||||
// //Ensure doesn't start or end with a dash
|
||||
// inObj = inObj.Trim('-');
|
||||
// //No longer than 255 characters
|
||||
// inObj = StringUtil.MaxLength(inObj, 255);
|
||||
// return inObj;
|
||||
}
|
||||
|
||||
//new functions above here
|
||||
|
||||
@@ -148,7 +148,8 @@
|
||||
@change="onChange('tags')"
|
||||
:items="pickLists.tags"
|
||||
:loading="tagSearchUnderway"
|
||||
:search-input.sync="searchTags"
|
||||
:search-input.sync="tagSearchEntry"
|
||||
no-data-text="ENTER A TAG"
|
||||
hide-selected
|
||||
multiple
|
||||
chips
|
||||
@@ -156,16 +157,14 @@
|
||||
deletable-chips
|
||||
cache-items
|
||||
>
|
||||
<template slot="no-data" v-if="searchTags">
|
||||
<template slot="no-data" v-if="tagSearchEntry">
|
||||
<v-container>
|
||||
<v-layout row>
|
||||
<v-layout justify-start fill-height align-content-center>
|
||||
Create new tag
|
||||
</v-layout>
|
||||
<v-layout justify-end>
|
||||
<v-icon color="success" @click="addTag()"
|
||||
>add {{ searchTags }} tag</v-icon
|
||||
>
|
||||
<v-btn icon @click="addTag()">
|
||||
<v-icon>fa-plus-circle</v-icon>
|
||||
</v-btn>
|
||||
<v-layout justify-start>
|
||||
"{{ this.$gzutil.normalizeTag(tagSearchEntry) }}"
|
||||
</v-layout>
|
||||
</v-layout>
|
||||
</v-container>
|
||||
@@ -298,7 +297,7 @@ export default {
|
||||
roles: [],
|
||||
tags: []
|
||||
},
|
||||
searchTags: null,
|
||||
tagSearchEntry: null,
|
||||
tagSearchUnderway: false,
|
||||
obj: {
|
||||
id: 0,
|
||||
@@ -355,7 +354,7 @@ export default {
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
searchTags(val) {
|
||||
tagSearchEntry(val) {
|
||||
var vm = this;
|
||||
if (vm.tagSearchUnderway) {
|
||||
return;
|
||||
@@ -556,8 +555,13 @@ export default {
|
||||
});
|
||||
}
|
||||
},
|
||||
addTag(a, b, c) {
|
||||
debugger;
|
||||
addTag() {
|
||||
//todo: clean the tag to server standards first so it's de-duped in the record
|
||||
var theTag = this.tagSearchEntry;
|
||||
theTag = this.$gzutil.normalizeTag(theTag);
|
||||
//make sure there are no existing of the same tag
|
||||
this.pickLists.tags.push(theTag);
|
||||
this.obj.tags.push(theTag);
|
||||
//add tags to existing picklist so that it contains all the unique tags ever searched for or present in the object
|
||||
//vm.pickLists.tags+=tags
|
||||
//vm.pickLists.tags=uniqueonly(vm.pickLists.tags)
|
||||
@@ -565,16 +569,6 @@ export default {
|
||||
}
|
||||
};
|
||||
|
||||
// //////////////////////
|
||||
// //
|
||||
// //
|
||||
// function addTag(a,b,c) {
|
||||
// debugger;
|
||||
// //add tags to existing picklist so that it contains all the unique tags ever searched for or present in the object
|
||||
// //vm.pickLists.tags+=tags
|
||||
// //vm.pickLists.tags=uniqueonly(vm.pickLists.tags)
|
||||
// }
|
||||
|
||||
/////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user