Commit 5a8131d7 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'noc-1866' into 'master'

#1866 Add filterProtected attribute to UI labelfield fir Filter fields.

See merge request !6427

(cherry picked from commit 0233985f)

b917142c Add filterProtected attribute to UI labelfield fir Filter fields.
026916c2 Fix if.
9a467e5b Fix typo.
parent 13c1839b
Pipeline #36701 passed with stages
in 1 minute and 35 seconds
......@@ -23,6 +23,7 @@ Ext.define("NOC.core.label.LabelField", {
queryMode: "remote",
autoLoadOnValue: true,
filterPickList: true,
filterProtected: true,
forceSelection: true,
createNewOnEnter: false,
isTree: false,
......@@ -123,7 +124,7 @@ Ext.define("NOC.core.label.LabelField", {
},
filterPicked: function(rec) {
return !this.valueCollection.contains(rec) && !rec.get("is_protected");
return !this.valueCollection.contains(rec) && !(rec.get("is_protected") && this.filterProtected);
},
onKeyDown: function(e) {
......@@ -149,10 +150,10 @@ Ext.define("NOC.core.label.LabelField", {
lastSelectionIndex = -1;
}
valueCollection.remove(Ext.Array.filter(selModel.getSelection(), function(el) {
return !el.get("is_protected")
return !el.get("is_protected") && me.filterProtected
}));
} else {
if(!valueCollection.last().get("is_protected")) {
if(!valueCollection.last().get("is_protected") && me.filterProtected) {
valueCollection.remove(valueCollection.last());
}
}
......@@ -231,14 +232,14 @@ Ext.define("NOC.core.label.LabelField", {
'%}',
me.tipTpl ? '" data-qtip="{[this.getTip(values)]}">' : '">',
'<div class="' + me.tagItemTextCls + '">{[this.getItemLabel(values)]}</div>',
'<tpl if="!is_protected">',
'<tpl if="!is_protected || !this.filter_protected">',
'<div class="' + me.tagItemCloseCls + childElCls + '"></div>',
'</tpl>',
'</li>',
'</tpl>',
{
isProtected: function(rec) {
return rec.get("is_protected");
return rec.get("is_protected") && me.filterProtected;
},
isSelected: function(rec) {
return me.selectionModel.isSelected(rec);
......@@ -250,6 +251,7 @@ Ext.define("NOC.core.label.LabelField", {
getTip: function(values) {
return Ext.String.htmlEncode(me.tipTpl.apply(values));
},
filter_protected: me.filterProtected,
strict: true
}
]);
......
......@@ -29,6 +29,7 @@ Ext.define("NOC.core.modelfilter.Label", {
width: me.width,
query: me.query_filter,
isTree: me.isTree,
filterProtected: me.filterProtected,
treePickerWidth: me.treePickerWidth,
listeners: {
select: {
......
......@@ -200,6 +200,7 @@ Ext.define("NOC.fm.alarmrule.Application", {
fieldLabel: __("Match Labels"),
allowBlank: true,
isTree: true,
filterProtected: false,
pickerPosition: "down",
uiStyle: "extra",
query: {
......@@ -212,6 +213,7 @@ Ext.define("NOC.fm.alarmrule.Application", {
fieldLabel: __("Exclude Match Labels"),
allowBlank: true,
isTree: true,
filterProtected: false,
pickerPosition: "down",
uiStyle: "extra",
query: {
......
......@@ -470,6 +470,7 @@ Ext.define("NOC.inv.interfaceprofile.Application", {
fieldLabel: __("Match Labels"),
allowBlank: false,
isTree: true,
filterProtected: false,
pickerPosition: "down",
uiStyle: "extra",
query: {
......@@ -505,6 +506,7 @@ Ext.define("NOC.inv.interfaceprofile.Application", {
lookup: "main.handler.LookupField",
pickerPosition: "left",
isTree: true,
filterProtected: false,
treePickerWidth: 400,
query_filter: {
"allow_matched": true
......
......@@ -139,6 +139,7 @@ Ext.define("NOC.inv.sensorprofile.Application", {
fieldLabel: __("Match Labels"),
allowBlank: false,
isTree: true,
filterProtected: false,
pickerPosition: "down",
uiStyle: "extra",
query: {
......
......@@ -1681,7 +1681,8 @@ Ext.define("NOC.sa.managedobject.Application", {
{
title: __("By Labels"),
name: "labels",
ftype: "label"
ftype: "label",
filterProtected: false
}
],
inlines:
......
......@@ -427,6 +427,7 @@ Ext.define("NOC.sa.managedobjectprofile.Application", {
fieldLabel: __("Match Labels"),
allowBlank: false,
isTree: true,
filterProtected: false,
pickerPosition: "down",
uiStyle: "extra",
query: {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment