Commit 2cd42a7a authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'cherry-pick-0233985f' into 'release-22.1'

release-22.1:Backport!6427

See merge request !6430
parents 13c1839b 0f1bb3ea
...@@ -23,6 +23,7 @@ Ext.define("NOC.core.label.LabelField", { ...@@ -23,6 +23,7 @@ Ext.define("NOC.core.label.LabelField", {
queryMode: "remote", queryMode: "remote",
autoLoadOnValue: true, autoLoadOnValue: true,
filterPickList: true, filterPickList: true,
filterProtected: true,
forceSelection: true, forceSelection: true,
createNewOnEnter: false, createNewOnEnter: false,
isTree: false, isTree: false,
...@@ -123,7 +124,7 @@ Ext.define("NOC.core.label.LabelField", { ...@@ -123,7 +124,7 @@ Ext.define("NOC.core.label.LabelField", {
}, },
filterPicked: function(rec) { 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) { onKeyDown: function(e) {
...@@ -149,10 +150,10 @@ Ext.define("NOC.core.label.LabelField", { ...@@ -149,10 +150,10 @@ Ext.define("NOC.core.label.LabelField", {
lastSelectionIndex = -1; lastSelectionIndex = -1;
} }
valueCollection.remove(Ext.Array.filter(selModel.getSelection(), function(el) { valueCollection.remove(Ext.Array.filter(selModel.getSelection(), function(el) {
return !el.get("is_protected") return !el.get("is_protected") && me.filterProtected
})); }));
} else { } else {
if(!valueCollection.last().get("is_protected")) { if(!valueCollection.last().get("is_protected") && me.filterProtected) {
valueCollection.remove(valueCollection.last()); valueCollection.remove(valueCollection.last());
} }
} }
...@@ -231,14 +232,14 @@ Ext.define("NOC.core.label.LabelField", { ...@@ -231,14 +232,14 @@ Ext.define("NOC.core.label.LabelField", {
'%}', '%}',
me.tipTpl ? '" data-qtip="{[this.getTip(values)]}">' : '">', me.tipTpl ? '" data-qtip="{[this.getTip(values)]}">' : '">',
'<div class="' + me.tagItemTextCls + '">{[this.getItemLabel(values)]}</div>', '<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>', '<div class="' + me.tagItemCloseCls + childElCls + '"></div>',
'</tpl>', '</tpl>',
'</li>', '</li>',
'</tpl>', '</tpl>',
{ {
isProtected: function(rec) { isProtected: function(rec) {
return rec.get("is_protected"); return rec.get("is_protected") && me.filterProtected;
}, },
isSelected: function(rec) { isSelected: function(rec) {
return me.selectionModel.isSelected(rec); return me.selectionModel.isSelected(rec);
...@@ -250,6 +251,7 @@ Ext.define("NOC.core.label.LabelField", { ...@@ -250,6 +251,7 @@ Ext.define("NOC.core.label.LabelField", {
getTip: function(values) { getTip: function(values) {
return Ext.String.htmlEncode(me.tipTpl.apply(values)); return Ext.String.htmlEncode(me.tipTpl.apply(values));
}, },
filter_protected: me.filterProtected,
strict: true strict: true
} }
]); ]);
......
...@@ -29,6 +29,7 @@ Ext.define("NOC.core.modelfilter.Label", { ...@@ -29,6 +29,7 @@ Ext.define("NOC.core.modelfilter.Label", {
width: me.width, width: me.width,
query: me.query_filter, query: me.query_filter,
isTree: me.isTree, isTree: me.isTree,
filterProtected: me.filterProtected,
treePickerWidth: me.treePickerWidth, treePickerWidth: me.treePickerWidth,
listeners: { listeners: {
select: { select: {
......
...@@ -200,6 +200,7 @@ Ext.define("NOC.fm.alarmrule.Application", { ...@@ -200,6 +200,7 @@ Ext.define("NOC.fm.alarmrule.Application", {
fieldLabel: __("Match Labels"), fieldLabel: __("Match Labels"),
allowBlank: true, allowBlank: true,
isTree: true, isTree: true,
filterProtected: false,
pickerPosition: "down", pickerPosition: "down",
uiStyle: "extra", uiStyle: "extra",
query: { query: {
...@@ -212,6 +213,7 @@ Ext.define("NOC.fm.alarmrule.Application", { ...@@ -212,6 +213,7 @@ Ext.define("NOC.fm.alarmrule.Application", {
fieldLabel: __("Exclude Match Labels"), fieldLabel: __("Exclude Match Labels"),
allowBlank: true, allowBlank: true,
isTree: true, isTree: true,
filterProtected: false,
pickerPosition: "down", pickerPosition: "down",
uiStyle: "extra", uiStyle: "extra",
query: { query: {
......
...@@ -470,6 +470,7 @@ Ext.define("NOC.inv.interfaceprofile.Application", { ...@@ -470,6 +470,7 @@ Ext.define("NOC.inv.interfaceprofile.Application", {
fieldLabel: __("Match Labels"), fieldLabel: __("Match Labels"),
allowBlank: false, allowBlank: false,
isTree: true, isTree: true,
filterProtected: false,
pickerPosition: "down", pickerPosition: "down",
uiStyle: "extra", uiStyle: "extra",
query: { query: {
...@@ -505,6 +506,7 @@ Ext.define("NOC.inv.interfaceprofile.Application", { ...@@ -505,6 +506,7 @@ Ext.define("NOC.inv.interfaceprofile.Application", {
lookup: "main.handler.LookupField", lookup: "main.handler.LookupField",
pickerPosition: "left", pickerPosition: "left",
isTree: true, isTree: true,
filterProtected: false,
treePickerWidth: 400, treePickerWidth: 400,
query_filter: { query_filter: {
"allow_matched": true "allow_matched": true
......
...@@ -139,6 +139,7 @@ Ext.define("NOC.inv.sensorprofile.Application", { ...@@ -139,6 +139,7 @@ Ext.define("NOC.inv.sensorprofile.Application", {
fieldLabel: __("Match Labels"), fieldLabel: __("Match Labels"),
allowBlank: false, allowBlank: false,
isTree: true, isTree: true,
filterProtected: false,
pickerPosition: "down", pickerPosition: "down",
uiStyle: "extra", uiStyle: "extra",
query: { query: {
......
...@@ -1681,7 +1681,8 @@ Ext.define("NOC.sa.managedobject.Application", { ...@@ -1681,7 +1681,8 @@ Ext.define("NOC.sa.managedobject.Application", {
{ {
title: __("By Labels"), title: __("By Labels"),
name: "labels", name: "labels",
ftype: "label" ftype: "label",
filterProtected: false
} }
], ],
inlines: inlines:
......
...@@ -427,6 +427,7 @@ Ext.define("NOC.sa.managedobjectprofile.Application", { ...@@ -427,6 +427,7 @@ Ext.define("NOC.sa.managedobjectprofile.Application", {
fieldLabel: __("Match Labels"), fieldLabel: __("Match Labels"),
allowBlank: false, allowBlank: false,
isTree: true, isTree: true,
filterProtected: false,
pickerPosition: "down", pickerPosition: "down",
uiStyle: "extra", uiStyle: "extra",
query: { 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