diff --git a/client/src/views/preferences/fields/dashboard-tab-list.js b/client/src/views/preferences/fields/dashboard-tab-list.js index 82ac0477c0..b66b02d625 100644 --- a/client/src/views/preferences/fields/dashboard-tab-list.js +++ b/client/src/views/preferences/fields/dashboard-tab-list.js @@ -40,6 +40,8 @@ define('views/preferences/fields/dashboard-tab-list', ['views/fields/array'], fu list.forEach(value => { this.translatedOptions[value] = value; }); + + this.validations.push('uniqueLabel'); }, getItemHtml: function (value) { @@ -85,6 +87,28 @@ define('views/preferences/fields/dashboard-tab-list', ['views/fields/array'], fu .get(0).outerHTML; }, + validateUniqueLabel: function () { + let keyList = this.model.get(this.name) || []; + let labels = this.model.get('translatedOptions') || {}; + let metLabelList = []; + + for (let key of keyList) { + let label = labels[key]; + + if (!label) { + return true; + } + + if (metLabelList.indexOf(label) !== -1) { + return true; + } + + metLabelList.push(label); + } + + return false; + }, + fetch: function () { let data = Dep.prototype.fetch.call(this);