@openui5/sap.ui.support 1.149.1 → 1.151.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/REUSE.toml +24 -0
- package/THIRDPARTY.txt +25 -6
- package/package.json +6 -6
- package/src/sap/ui/support/.library +1 -5
- package/src/sap/ui/support/RuleAnalyzer.js +7 -3
- package/src/sap/ui/support/jQuery.sap.support.js +9 -4
- package/src/sap/ui/support/library.js +2 -2
- package/src/sap/ui/support/supportRules/Constants.js +0 -18
- package/src/sap/ui/support/supportRules/Main.js +0 -57
- package/src/sap/ui/support/supportRules/RuleSerializer.js +2 -7
- package/src/sap/ui/support/supportRules/RuleSet.js +1 -1
- package/src/sap/ui/support/supportRules/RuleSetLoader.js +0 -13
- package/src/sap/ui/support/supportRules/Storage.js +2 -80
- package/src/sap/ui/support/supportRules/WCBChannels.js +0 -40
- package/src/sap/ui/support/supportRules/WindowCommunicationBus.js +1 -1
- package/src/sap/ui/support/supportRules/ui/controllers/Analysis.controller.js +17 -494
- package/src/sap/ui/support/supportRules/ui/controllers/Main.controller.js +0 -22
- package/src/sap/ui/support/supportRules/ui/controllers/PresetsController.js +1 -1
- package/src/sap/ui/support/supportRules/ui/models/CustomJSONListSelection.js +0 -14
- package/src/sap/ui/support/supportRules/ui/models/SharedModel.js +1 -26
- package/src/sap/ui/support/supportRules/ui/views/Analysis.view.xml +1 -12
- package/src/sap/ui/support/supportRules/ui/views/StorageSettings.fragment.xml +1 -8
- package/src/sap/ui/support/supportRules/ui/views/RuleUpdate.fragment.xml +0 -320
- package/src/sap/ui/support/supportRules/util/EvalUtils.js +0 -41
|
@@ -19,6 +19,7 @@ sap.ui.define([
|
|
|
19
19
|
"sap/ui/core/Fragment",
|
|
20
20
|
"sap/m/library",
|
|
21
21
|
"sap/m/MessageToast",
|
|
22
|
+
"sap/m/MessageBox",
|
|
22
23
|
"sap/m/List",
|
|
23
24
|
"sap/m/StandardListItem",
|
|
24
25
|
"sap/m/table/columnmenu/Menu",
|
|
@@ -29,8 +30,7 @@ sap.ui.define([
|
|
|
29
30
|
"sap/ui/support/supportRules/WCBChannels",
|
|
30
31
|
"sap/ui/support/supportRules/RuleSerializer",
|
|
31
32
|
"sap/ui/support/supportRules/Constants",
|
|
32
|
-
"sap/ui/support/supportRules/Storage"
|
|
33
|
-
"sap/ui/support/supportRules/util/EvalUtils"
|
|
33
|
+
"sap/ui/support/supportRules/Storage"
|
|
34
34
|
], function(
|
|
35
35
|
BaseController,
|
|
36
36
|
PresetsController,
|
|
@@ -46,6 +46,7 @@ sap.ui.define([
|
|
|
46
46
|
Fragment,
|
|
47
47
|
mLibrary,
|
|
48
48
|
MessageToast,
|
|
49
|
+
MessageBox,
|
|
49
50
|
List,
|
|
50
51
|
StandardListItem,
|
|
51
52
|
ColumnMenu,
|
|
@@ -56,8 +57,7 @@ sap.ui.define([
|
|
|
56
57
|
channelNames,
|
|
57
58
|
RuleSerializer,
|
|
58
59
|
Constants,
|
|
59
|
-
Storage
|
|
60
|
-
EvalUtils
|
|
60
|
+
Storage
|
|
61
61
|
) {
|
|
62
62
|
"use strict";
|
|
63
63
|
|
|
@@ -66,7 +66,6 @@ sap.ui.define([
|
|
|
66
66
|
onInit: function () {
|
|
67
67
|
this.model = SharedModel;
|
|
68
68
|
this.setCommunicationSubscriptions();
|
|
69
|
-
this.tempRulesLoaded = false;
|
|
70
69
|
this.getView().setModel(this.model);
|
|
71
70
|
this.treeTable = SelectionUtils.treeTable = this.byId("ruleList");
|
|
72
71
|
this._oRuleSetsModel = new JSONModel();
|
|
@@ -103,9 +102,6 @@ sap.ui.define([
|
|
|
103
102
|
onclick: this.onPresetVariantClick.bind(this)
|
|
104
103
|
});
|
|
105
104
|
|
|
106
|
-
// "visible" property of RowAction cannot be updated trough binding, so set it directly
|
|
107
|
-
this.byId("rowActionTemplate").setVisible(!this.model.getProperty("/tempRulesDisabled"));
|
|
108
|
-
|
|
109
105
|
this._associateTableColumnsMenu();
|
|
110
106
|
},
|
|
111
107
|
|
|
@@ -126,103 +122,10 @@ sap.ui.define([
|
|
|
126
122
|
}.bind(this));
|
|
127
123
|
}
|
|
128
124
|
|
|
129
|
-
if (!this._ruleCreateUpdatePages) {
|
|
130
|
-
this._ruleCreateUpdatePages = Fragment.load({
|
|
131
|
-
name: "sap.ui.support.supportRules.ui.views.RuleUpdate",
|
|
132
|
-
controller: this
|
|
133
|
-
}).then(function (ruleCreateUpdatePages) {
|
|
134
|
-
ruleCreateUpdatePages.forEach(function (rcuPage) {
|
|
135
|
-
this.byId("rulesNavContainer").insertPage(rcuPage);
|
|
136
|
-
}, this);
|
|
137
|
-
|
|
138
|
-
}.bind(this));
|
|
139
|
-
}
|
|
140
|
-
|
|
141
125
|
this._updateRuleList();
|
|
142
126
|
},
|
|
143
127
|
|
|
144
|
-
onAsyncSwitch: function (oEvent) {
|
|
145
|
-
var oSource = oEvent.getSource();
|
|
146
|
-
|
|
147
|
-
if (oEvent.getParameter("selected")) {
|
|
148
|
-
var bAsync = oSource.getCustomData()[0].getValue() === "true";
|
|
149
|
-
var sRule = oSource.getProperty("groupName") === "asyncContext" ? "/newRule" : "/editRule";
|
|
150
|
-
this.model.setProperty(sRule + "/async", bAsync);
|
|
151
|
-
this._updateCheckFunction(sRule, bAsync);
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Add fnResolve to the check function when async is set to true otherwise removes it.
|
|
157
|
-
* @private
|
|
158
|
-
* @param {string} sRule the model path to edit or new rule
|
|
159
|
-
* @param {bAsync} bAsync the async property of the rule
|
|
160
|
-
*/
|
|
161
|
-
_updateCheckFunction: function (sRule, bAsync) {
|
|
162
|
-
var sCheckFunction = this.model.getProperty(sRule + "/check");
|
|
163
|
-
|
|
164
|
-
if (!sCheckFunction) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Check if a function is found
|
|
169
|
-
var oMatch = sCheckFunction.match(/function[^(]*\(([^)]*)\)/);
|
|
170
|
-
|
|
171
|
-
if (!oMatch) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Get the parameters of the function found and trim, then split by word.
|
|
176
|
-
var aParams = oMatch[1].trim().split(/\W+/);
|
|
177
|
-
// Add missing parameters to ensure the resolve function is passed on the correct position.
|
|
178
|
-
aParams[0] = aParams[0] || "oIssueManager";
|
|
179
|
-
aParams[1] = aParams[1] || "oCoreFacade";
|
|
180
|
-
aParams[2] = aParams[2] || "oScope";
|
|
181
|
-
|
|
182
|
-
// If async add a fnResolve to the template else remove it.
|
|
183
|
-
if (bAsync) {
|
|
184
|
-
aParams[3] = aParams[3] || "fnResolve";
|
|
185
|
-
} else {
|
|
186
|
-
aParams = aParams.slice(0, 3);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Replace the current parameters with the new ones.
|
|
190
|
-
var sNewCheckFunction = sCheckFunction.replace(/function[^(]*\(([^)]*)\)/, "function (" + aParams.join(", ") + ")");
|
|
191
|
-
|
|
192
|
-
this.model.setProperty(sRule + "/check", sNewCheckFunction);
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* @returns {object|null} Deep copy of the temporary library or null, if it doesn't exist
|
|
197
|
-
*/
|
|
198
|
-
getTemporaryLib: function () {
|
|
199
|
-
var libs = this.model.getProperty("/libraries");
|
|
200
|
-
|
|
201
|
-
for (var i = 0; i < libs.length; i++) {
|
|
202
|
-
if (libs[i].title == Constants.TEMP_RULESETS_NAME) {
|
|
203
|
-
return deepExtend({}, libs[i]);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return null;
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
setTemporaryLib: function (oData) {
|
|
211
|
-
var libs = this.model.getProperty("/libraries");
|
|
212
|
-
|
|
213
|
-
for (var i = 0; i < libs.length; i++) {
|
|
214
|
-
if (libs[i].title == Constants.TEMP_RULESETS_NAME) {
|
|
215
|
-
this.model.setProperty("/libraries/" + i, oData);
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
|
|
221
128
|
setCommunicationSubscriptions: function () {
|
|
222
|
-
if (!this.model.getProperty("/tempRulesDisabled")) {
|
|
223
|
-
this._setTempRulesCommunicationSubscriptions();
|
|
224
|
-
}
|
|
225
|
-
|
|
226
129
|
CommunicationBus.subscribe(channelNames.UPDATE_SUPPORT_RULES, this.updateSupportRules, this);
|
|
227
130
|
|
|
228
131
|
CommunicationBus.subscribe(channelNames.POST_AVAILABLE_LIBRARIES, function (data) {
|
|
@@ -266,10 +169,8 @@ sap.ui.define([
|
|
|
266
169
|
}
|
|
267
170
|
|
|
268
171
|
if (bPersistSettings) {
|
|
269
|
-
// Needed for temp rules init
|
|
270
|
-
this.initializeTempRules();
|
|
271
172
|
//Selection should be applied from local storage
|
|
272
|
-
// Syncs selection for all libs
|
|
173
|
+
// Syncs selection for all libs
|
|
273
174
|
var oUpdatedRules = SelectionUtils.updateSelectedRulesFromLocalStorage(oRuleSets);
|
|
274
175
|
// In case of deleted local storage item
|
|
275
176
|
if (oUpdatedRules) {
|
|
@@ -398,7 +299,7 @@ sap.ui.define([
|
|
|
398
299
|
|
|
399
300
|
Object.keys(oRulesSts).forEach(function (sKey) {
|
|
400
301
|
var sLibraryName = oRulesSts[sKey].name;
|
|
401
|
-
if (sLibraryName
|
|
302
|
+
if (sLibraryName) {
|
|
402
303
|
aLoadedLibraries.push(sLibraryName);
|
|
403
304
|
}
|
|
404
305
|
});
|
|
@@ -406,105 +307,6 @@ sap.ui.define([
|
|
|
406
307
|
return aLoadedLibraries;
|
|
407
308
|
},
|
|
408
309
|
|
|
409
|
-
/**
|
|
410
|
-
* Keeps in sync the TreeViewModel for temporary library that we use for visualisation of sap.m.TreeTable and the model that we use in the Suppport Assistant
|
|
411
|
-
* @param {Object} tempLib temporary library model from Support Assistant
|
|
412
|
-
*/
|
|
413
|
-
_applyTempRulesSelection: function (tempLib) {
|
|
414
|
-
var oRuleSets = deepExtend({}, this._oRuleSetsModel.getData()),
|
|
415
|
-
library,
|
|
416
|
-
rule,
|
|
417
|
-
aTempLibNodes,
|
|
418
|
-
bSelected,
|
|
419
|
-
aRules,
|
|
420
|
-
iIndex,
|
|
421
|
-
fnFilter = function (oRule) {
|
|
422
|
-
return oRule.id === rule.id;
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
for (var i in oRuleSets) {
|
|
426
|
-
library = oRuleSets[i];
|
|
427
|
-
aTempLibNodes = oRuleSets[i].nodes;
|
|
428
|
-
|
|
429
|
-
if (library.name !== Constants.TEMP_RULESETS_NAME) {
|
|
430
|
-
continue;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
//reset the model to add the temp rules
|
|
434
|
-
oRuleSets[i].nodes = [];
|
|
435
|
-
for (var ruleIndex in tempLib.rules) {
|
|
436
|
-
|
|
437
|
-
rule = tempLib.rules[ruleIndex];
|
|
438
|
-
bSelected = aTempLibNodes[ruleIndex] !== undefined ? aTempLibNodes[ruleIndex].selected : true;
|
|
439
|
-
|
|
440
|
-
// syncs selection of temporary rules from local storage
|
|
441
|
-
if (this.tempRulesFromStorage) {
|
|
442
|
-
aRules = this.tempRulesFromStorage.filter(fnFilter);
|
|
443
|
-
|
|
444
|
-
if (aRules.length > 0) {
|
|
445
|
-
bSelected = aRules[0].selected;
|
|
446
|
-
iIndex = this.tempRulesFromStorage.indexOf(aRules[0]);
|
|
447
|
-
this.tempRulesFromStorage.splice(iIndex, 1);
|
|
448
|
-
|
|
449
|
-
if (bSelected === false) {
|
|
450
|
-
library.selected = false;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
if (this.tempRulesFromStorage.length === 0) {
|
|
455
|
-
this.tempRulesFromStorage.length = null;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
library.nodes.push({
|
|
460
|
-
name: rule.title,
|
|
461
|
-
description: rule.description,
|
|
462
|
-
id: rule.id,
|
|
463
|
-
audiences: rule.audiences.toString(),
|
|
464
|
-
categories: rule.categories.toString(),
|
|
465
|
-
minversion: rule.minversion,
|
|
466
|
-
resolution: rule.resolution,
|
|
467
|
-
title: rule.title,
|
|
468
|
-
selected: bSelected,
|
|
469
|
-
libName: library.name,
|
|
470
|
-
check: rule.check
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
this._oRuleSetsModel.setData(oRuleSets);
|
|
476
|
-
},
|
|
477
|
-
|
|
478
|
-
/**
|
|
479
|
-
* Keeps in sync the TreeViewModel for temporary rules that we use for visualisation of sap.m.TreeTable and the model that we use in the SuppportAssistant
|
|
480
|
-
* @param {Object} tempRule Temporary rule
|
|
481
|
-
* @param {Object} treeTable Model for sap.m.TreeTable visualization
|
|
482
|
-
*/
|
|
483
|
-
_syncTreeTableVieModelTempRule: function (tempRule, treeTable) {
|
|
484
|
-
var ruleSource = this.model.getProperty("/editRuleSource");
|
|
485
|
-
for (var i in treeTable) {
|
|
486
|
-
if (treeTable[i].name === Constants.TEMP_RULESETS_NAME) {
|
|
487
|
-
for (var innerIndex in treeTable[i].nodes) {
|
|
488
|
-
if (treeTable[i].nodes[innerIndex].id === ruleSource.id) {
|
|
489
|
-
treeTable[i].nodes[innerIndex] = {
|
|
490
|
-
name: tempRule.title,
|
|
491
|
-
description: tempRule.description,
|
|
492
|
-
id: tempRule.id,
|
|
493
|
-
audiences: tempRule.audiences,
|
|
494
|
-
categories: tempRule.categories,
|
|
495
|
-
minversion: tempRule.minversion,
|
|
496
|
-
resolution: tempRule.resolution,
|
|
497
|
-
selected: treeTable[i].nodes[innerIndex].selected,
|
|
498
|
-
title: tempRule.title,
|
|
499
|
-
libName: treeTable[i].name,
|
|
500
|
-
check: tempRule.check
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
},
|
|
507
|
-
|
|
508
310
|
_hasSelectedComponent: function () {
|
|
509
311
|
var aAllComponentElements = Element.getElementById("componentsSelectionContainer").getContent();
|
|
510
312
|
function isSelected(oComponent) {
|
|
@@ -580,16 +382,13 @@ sap.ui.define([
|
|
|
580
382
|
},
|
|
581
383
|
|
|
582
384
|
createNewRulePress: function (oEvent) {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
goToRuleProperties: function () {
|
|
591
|
-
var navCont = this.byId("rulesNavContainer");
|
|
592
|
-
navCont.to(this.byId("rulesDisplayPage"), "show");
|
|
385
|
+
MessageBox.warning(
|
|
386
|
+
"Temporary rules have been deprecated and are non-functional anymore. Please use library rulesets instead.",
|
|
387
|
+
{
|
|
388
|
+
details: "See documentation about <a href='https://ui5.sap.com/#/topic/b5a51358b3574aea9143fa50ae4e0e2a' target='_blank' rel='noopener noreferrer'>library rulesets</a>.",
|
|
389
|
+
contentWidth: "400px"
|
|
390
|
+
}
|
|
391
|
+
);
|
|
593
392
|
},
|
|
594
393
|
|
|
595
394
|
createRuleString: function (rule) {
|
|
@@ -626,18 +425,6 @@ sap.ui.define([
|
|
|
626
425
|
return str;
|
|
627
426
|
},
|
|
628
427
|
|
|
629
|
-
updateRule: function () {
|
|
630
|
-
var oldId = this.model.getProperty("/editRuleSource/id"),
|
|
631
|
-
updateObj = this.model.getProperty("/editRule");
|
|
632
|
-
|
|
633
|
-
if (this.checkFunctionString(updateObj.check)) {
|
|
634
|
-
CommunicationBus.publish(channelNames.VERIFY_UPDATE_RULE, {
|
|
635
|
-
oldId: oldId,
|
|
636
|
-
updateObj: RuleSerializer.serialize(updateObj)
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
},
|
|
640
|
-
|
|
641
428
|
updateSupportRules: function (data) {
|
|
642
429
|
data = RuleSerializer.deserialize(data.sRuleSet);
|
|
643
430
|
|
|
@@ -667,15 +454,9 @@ sap.ui.define([
|
|
|
667
454
|
|
|
668
455
|
}
|
|
669
456
|
|
|
670
|
-
// Set first rule from first library
|
|
671
|
-
var firstSelectedRule;
|
|
672
|
-
if (libraries[0].rules[0]) {
|
|
673
|
-
firstSelectedRule = libraries[0].rules[0];
|
|
674
|
-
} else {
|
|
675
|
-
firstSelectedRule = libraries[1].rules[0];
|
|
676
|
-
}
|
|
457
|
+
// Set first rule from first library (there are no temporary rules anymore)
|
|
458
|
+
var firstSelectedRule = libraries[0].rules[0];
|
|
677
459
|
|
|
678
|
-
that.placeTemporaryRulesetAtStart(libraries);
|
|
679
460
|
that.model.setProperty("/selectedRuleStringify", "");
|
|
680
461
|
that.model.setProperty("/selectedRule", firstSelectedRule);
|
|
681
462
|
that.model.setProperty("/selectedRuleStringify", that.createRuleString(firstSelectedRule));
|
|
@@ -689,99 +470,6 @@ sap.ui.define([
|
|
|
689
470
|
}
|
|
690
471
|
},
|
|
691
472
|
|
|
692
|
-
/**
|
|
693
|
-
* Loads temporary rules from the local storage and sends them to the main window
|
|
694
|
-
*/
|
|
695
|
-
initializeTempRules: function () {
|
|
696
|
-
if (this.model.getProperty("/tempRulesDisabled")) {
|
|
697
|
-
return;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
var tempRules = Storage.getRules(),
|
|
701
|
-
loadingFromAdditionalRuleSets = this.model.getProperty("/loadingAdditionalRuleSets");
|
|
702
|
-
|
|
703
|
-
if (tempRules && !loadingFromAdditionalRuleSets && !this.tempRulesLoaded) {
|
|
704
|
-
this.tempRulesFromStorage = tempRules;
|
|
705
|
-
this.tempRulesLoaded = true;
|
|
706
|
-
|
|
707
|
-
tempRules.forEach(function (tempRule) {
|
|
708
|
-
CommunicationBus.publish(channelNames.VERIFY_CREATE_RULE, RuleSerializer.serialize(tempRule));
|
|
709
|
-
});
|
|
710
|
-
|
|
711
|
-
this.persistedTempRulesCount = tempRules.length;
|
|
712
|
-
}
|
|
713
|
-
},
|
|
714
|
-
|
|
715
|
-
placeTemporaryRulesetAtStart: function (libraries) {
|
|
716
|
-
for (var i = 0; i < libraries.length; i++) {
|
|
717
|
-
var ruleSet = libraries[i];
|
|
718
|
-
|
|
719
|
-
if (ruleSet.title === Constants.TEMP_RULESETS_NAME) {
|
|
720
|
-
var temp = ruleSet;
|
|
721
|
-
libraries.splice(i, 1);
|
|
722
|
-
libraries.unshift(temp);
|
|
723
|
-
return;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
},
|
|
727
|
-
|
|
728
|
-
addLinkToRule: function (event) {
|
|
729
|
-
var tempLink = this.model.getProperty("/tempLink"),
|
|
730
|
-
copy = deepExtend({}, tempLink),
|
|
731
|
-
action = event.getSource().getProperty("text"),
|
|
732
|
-
rule = action === 'Add' ? "/newRule" : "/editRule",
|
|
733
|
-
urlProperty = this.model.getProperty(rule + "/resolutionurls");
|
|
734
|
-
|
|
735
|
-
if (urlProperty) {
|
|
736
|
-
urlProperty.push(copy);
|
|
737
|
-
} else {
|
|
738
|
-
this.model.setProperty(rule + "/resolutionurls", "");
|
|
739
|
-
urlProperty.push(copy);
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
this.model.setProperty("/tempLink", { href: "", text: "" });
|
|
743
|
-
},
|
|
744
|
-
|
|
745
|
-
goToCreateRule: function () {
|
|
746
|
-
var navCont = this.byId("rulesNavContainer");
|
|
747
|
-
navCont.to(Element.getElementById("rulesCreatePage"), "show");
|
|
748
|
-
},
|
|
749
|
-
|
|
750
|
-
checkFunctionString: function (functionString) {
|
|
751
|
-
try {
|
|
752
|
-
EvalUtils.evalFunction(functionString);
|
|
753
|
-
} catch (err) {
|
|
754
|
-
MessageToast.show("Your check function contains errors, and can't be evaluated:" + err);
|
|
755
|
-
return false;
|
|
756
|
-
}
|
|
757
|
-
return true;
|
|
758
|
-
},
|
|
759
|
-
|
|
760
|
-
addNewRule: function () {
|
|
761
|
-
var newRule = this.model.getProperty("/newRule");
|
|
762
|
-
if (this.checkFunctionString(newRule.check)) {
|
|
763
|
-
this.showRuleCreatedToast = true;
|
|
764
|
-
|
|
765
|
-
CommunicationBus.publish(channelNames.VERIFY_CREATE_RULE, RuleSerializer.serialize(newRule));
|
|
766
|
-
}
|
|
767
|
-
},
|
|
768
|
-
|
|
769
|
-
rulesToolbarITHSelect: function (oEvent) {
|
|
770
|
-
if (oEvent.getParameter("key") === "jsonOutput") {
|
|
771
|
-
var newRule = this.model.getProperty("/newRule"),
|
|
772
|
-
stringifiedJson = this.createRuleString(newRule);
|
|
773
|
-
this.model.setProperty("/newRuleStringified", stringifiedJson);
|
|
774
|
-
}
|
|
775
|
-
},
|
|
776
|
-
|
|
777
|
-
rulesToolbarEditITHSelect: function (oEvent) {
|
|
778
|
-
if (oEvent.getParameter("key") === "jsonOutput") {
|
|
779
|
-
var newRule = this.model.getProperty("/editRule"),
|
|
780
|
-
stringifiedJson = this.createRuleString(newRule);
|
|
781
|
-
this.model.setProperty("/updateRuleStringified", stringifiedJson);
|
|
782
|
-
}
|
|
783
|
-
},
|
|
784
|
-
|
|
785
473
|
loadMarkedSupportLibraries: function () {
|
|
786
474
|
var list = this.byId("availableLibrariesSet"),
|
|
787
475
|
aLibNames = [],
|
|
@@ -853,86 +541,6 @@ sap.ui.define([
|
|
|
853
541
|
|
|
854
542
|
return mainModelRule;
|
|
855
543
|
},
|
|
856
|
-
_generateRuleId: function (sRuleId) {
|
|
857
|
-
var i = 0,
|
|
858
|
-
oTempLib = this.getTemporaryLib(),
|
|
859
|
-
aTempRuleset = oTempLib.rules,
|
|
860
|
-
bExists,
|
|
861
|
-
fnCheckId = function(oRule) {
|
|
862
|
-
return oRule.id === sRuleId + i;
|
|
863
|
-
};
|
|
864
|
-
|
|
865
|
-
while (++i) {
|
|
866
|
-
bExists = aTempRuleset.some(fnCheckId);
|
|
867
|
-
|
|
868
|
-
if (!bExists) {
|
|
869
|
-
return sRuleId + i;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
},
|
|
873
|
-
|
|
874
|
-
duplicateRule: function (oEvent) {
|
|
875
|
-
var sPath = oEvent.getSource().getBindingContext("ruleSets").getPath(),
|
|
876
|
-
oSourceObject = this.treeTable.getBinding().getModel().getProperty(sPath),
|
|
877
|
-
selectedRule = this.getMainModelFromTreeViewModel(oSourceObject),
|
|
878
|
-
selectedRuleCopy = deepExtend({}, selectedRule);
|
|
879
|
-
|
|
880
|
-
selectedRuleCopy.id = this._generateRuleId(selectedRuleCopy.id);
|
|
881
|
-
|
|
882
|
-
this.model.setProperty("/newRule", selectedRuleCopy);
|
|
883
|
-
this.goToCreateRule();
|
|
884
|
-
},
|
|
885
|
-
|
|
886
|
-
editRule: function (event) {
|
|
887
|
-
var sPath = event.getSource().getBindingContext("ruleSets").getPath(),
|
|
888
|
-
oSourceObject = this.treeTable.getBinding().getModel().getProperty(sPath),
|
|
889
|
-
selectedRule = this.getMainModelFromTreeViewModel(oSourceObject);
|
|
890
|
-
|
|
891
|
-
this.model.setProperty("/editRuleSource", selectedRule);
|
|
892
|
-
this.model.setProperty("/editRule", deepExtend({}, selectedRule));
|
|
893
|
-
var navCont = this.byId("rulesNavContainer");
|
|
894
|
-
navCont.to(Element.getElementById("ruleUpdatePage"), "show");
|
|
895
|
-
},
|
|
896
|
-
|
|
897
|
-
deleteTemporaryRule: function (event) {
|
|
898
|
-
var sourceObject = this.getObjectOnTreeRow(event),
|
|
899
|
-
oRuleSets = deepExtend({}, this._oRuleSetsModel.getData()),
|
|
900
|
-
aLibraries = this.model.getProperty("/libraries"),
|
|
901
|
-
aRemainingRules;
|
|
902
|
-
|
|
903
|
-
aLibraries.forEach(function (oLibrary) {
|
|
904
|
-
if (oLibrary.title === Constants.TEMP_RULESETS_NAME) {
|
|
905
|
-
aRemainingRules = oLibrary.rules.filter(function (oRule) {
|
|
906
|
-
return oRule.id !== sourceObject.id;
|
|
907
|
-
});
|
|
908
|
-
oLibrary.rules = aRemainingRules;
|
|
909
|
-
}
|
|
910
|
-
});
|
|
911
|
-
|
|
912
|
-
for (var oLibrary in oRuleSets) {
|
|
913
|
-
if (oRuleSets[oLibrary].name === Constants.TEMP_RULESETS_NAME) {
|
|
914
|
-
for (var iRuleIndex in oRuleSets[oLibrary].nodes) {
|
|
915
|
-
if (oRuleSets[oLibrary].nodes[iRuleIndex].id === sourceObject.id) {
|
|
916
|
-
oRuleSets[oLibrary].nodes.splice(iRuleIndex, 1);
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
this._oRuleSetsModel.setData(oRuleSets);
|
|
923
|
-
|
|
924
|
-
CommunicationBus.publish(channelNames.DELETE_RULE, RuleSerializer.serialize(sourceObject));
|
|
925
|
-
|
|
926
|
-
this._updateRuleList();
|
|
927
|
-
|
|
928
|
-
//Set selected rules count to UI and update preset selections
|
|
929
|
-
PresetsUtils.syncCurrentSelectionPreset(SelectionUtils.getSelectedRules());
|
|
930
|
-
|
|
931
|
-
if (Storage.readPersistenceCookie(Constants.COOKIE_NAME)) {
|
|
932
|
-
Storage.removeSelectedRules(aRemainingRules);
|
|
933
|
-
SelectionUtils.persistSelection();
|
|
934
|
-
}
|
|
935
|
-
},
|
|
936
544
|
|
|
937
545
|
/**
|
|
938
546
|
* Gets rule from selected row
|
|
@@ -955,15 +563,8 @@ sap.ui.define([
|
|
|
955
563
|
},
|
|
956
564
|
|
|
957
565
|
_updateRuleList: function() {
|
|
958
|
-
var oRuleList = this.getView().byId("ruleList")
|
|
959
|
-
|
|
960
|
-
aTempRules = oTempLib ? oTempLib["rules"] : [];
|
|
961
|
-
|
|
962
|
-
if (!aTempRules.length) {
|
|
963
|
-
oRuleList.setRowActionCount(1);
|
|
964
|
-
} else {
|
|
965
|
-
oRuleList.setRowActionCount(2);
|
|
966
|
-
}
|
|
566
|
+
var oRuleList = this.getView().byId("ruleList");
|
|
567
|
+
oRuleList.setRowActionCount(1);
|
|
967
568
|
},
|
|
968
569
|
|
|
969
570
|
/**
|
|
@@ -995,84 +596,6 @@ sap.ui.define([
|
|
|
995
596
|
this._PresetsController.openPresetVariant();
|
|
996
597
|
},
|
|
997
598
|
|
|
998
|
-
_setTempRulesCommunicationSubscriptions: function () {
|
|
999
|
-
// Temporary rules are validated and ready to be loaded in view
|
|
1000
|
-
CommunicationBus.subscribe(channelNames.VERIFY_RULE_CREATE_RESULT, function (data) {
|
|
1001
|
-
var result = data.result,
|
|
1002
|
-
newRule = RuleSerializer.deserialize(data.newRule, true),
|
|
1003
|
-
tempLib = this.getTemporaryLib();
|
|
1004
|
-
|
|
1005
|
-
if (result == "success") {
|
|
1006
|
-
tempLib.rules.push(newRule);
|
|
1007
|
-
this.setTemporaryLib(tempLib);
|
|
1008
|
-
this._applyTempRulesSelection(tempLib); //Sync Selection of temporary rules
|
|
1009
|
-
|
|
1010
|
-
//Set selected rules count to UI and update preset selections
|
|
1011
|
-
PresetsUtils.syncCurrentSelectionPreset(SelectionUtils.getSelectedRules());
|
|
1012
|
-
|
|
1013
|
-
if (Storage.readPersistenceCookie(Constants.COOKIE_NAME)) {
|
|
1014
|
-
SelectionUtils.persistSelection();
|
|
1015
|
-
Storage.setRules(tempLib.rules);
|
|
1016
|
-
|
|
1017
|
-
if (this.showRuleCreatedToast) {
|
|
1018
|
-
MessageToast.show('Your temporary rule "' + newRule.id + '" was persisted in the local storage');
|
|
1019
|
-
this.showRuleCreatedToast = false;
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
//Clean the new rule object
|
|
1024
|
-
var emptyRule = this.model.getProperty("/newEmptyRule");
|
|
1025
|
-
this.model.setProperty("/newRule", deepExtend({}, emptyRule));
|
|
1026
|
-
this.goToRuleProperties();
|
|
1027
|
-
this.model.setProperty("/selectedRule", newRule);
|
|
1028
|
-
this._updateRuleList();
|
|
1029
|
-
|
|
1030
|
-
this.treeTable.updateSelectionFromModel();
|
|
1031
|
-
} else {
|
|
1032
|
-
MessageToast.show("Add rule failed because: " + result);
|
|
1033
|
-
}
|
|
1034
|
-
}, this);
|
|
1035
|
-
|
|
1036
|
-
CommunicationBus.subscribe(channelNames.VERIFY_RULE_UPDATE_RESULT, function (data) {
|
|
1037
|
-
var result = data.result,
|
|
1038
|
-
updateRule = RuleSerializer.deserialize(data.updateRule, true),
|
|
1039
|
-
that = this;
|
|
1040
|
-
|
|
1041
|
-
if (result === "success") {
|
|
1042
|
-
var ruleSource = this.model.getProperty("/editRuleSource"),
|
|
1043
|
-
oRuleSets = this._oRuleSetsModel.getData(),
|
|
1044
|
-
libraries = this.model.getProperty('/libraries');
|
|
1045
|
-
|
|
1046
|
-
libraries.forEach(function (lib, libIndex) {
|
|
1047
|
-
if (lib.title === Constants.TEMP_RULESETS_NAME) {
|
|
1048
|
-
lib.rules.forEach(function (rule, ruleIndex) {
|
|
1049
|
-
if (rule.id === ruleSource.id) {
|
|
1050
|
-
lib.rules[ruleIndex] = updateRule;
|
|
1051
|
-
|
|
1052
|
-
if (that.model.getProperty("/persistingSettings")) {
|
|
1053
|
-
Storage.setRules(lib.rules);
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
});
|
|
1057
|
-
that._syncTreeTableVieModelTempRule(updateRule, oRuleSets);
|
|
1058
|
-
}
|
|
1059
|
-
});
|
|
1060
|
-
|
|
1061
|
-
this._oRuleSetsModel.setData(oRuleSets);
|
|
1062
|
-
this.model.setProperty('/selectedRule', updateRule);
|
|
1063
|
-
|
|
1064
|
-
//Set selected rules count to UI
|
|
1065
|
-
SelectionUtils.getSelectedRules();
|
|
1066
|
-
|
|
1067
|
-
this.treeTable.updateSelectionFromModel();
|
|
1068
|
-
|
|
1069
|
-
this.goToRuleProperties();
|
|
1070
|
-
} else {
|
|
1071
|
-
MessageToast.show("Update rule failed because: " + result);
|
|
1072
|
-
}
|
|
1073
|
-
}, this);
|
|
1074
|
-
},
|
|
1075
|
-
|
|
1076
599
|
_associateTableColumnsMenu: function () {
|
|
1077
600
|
const oColumnsData = TableSettingsModel.getProperty("/columns");
|
|
1078
601
|
const oList = new List({
|
|
@@ -16,7 +16,6 @@ sap.ui.define([
|
|
|
16
16
|
"sap/ui/support/supportRules/WCBChannels",
|
|
17
17
|
"sap/ui/support/supportRules/Constants",
|
|
18
18
|
"sap/ui/support/supportRules/Storage",
|
|
19
|
-
"sap/ui/support/supportRules/util/EvalUtils",
|
|
20
19
|
"sap/ui/VersionInfo",
|
|
21
20
|
"sap/m/library"
|
|
22
21
|
], function (
|
|
@@ -31,7 +30,6 @@ sap.ui.define([
|
|
|
31
30
|
channelNames,
|
|
32
31
|
Constants,
|
|
33
32
|
Storage,
|
|
34
|
-
EvalUtils,
|
|
35
33
|
VersionInfo,
|
|
36
34
|
mobileLibrary
|
|
37
35
|
) {
|
|
@@ -97,8 +95,6 @@ sap.ui.define([
|
|
|
97
95
|
location: new URL(sap.ui.require.toUrl("sap/ui/support"), window.location.origin + window.location.pathname).toString()
|
|
98
96
|
});
|
|
99
97
|
});
|
|
100
|
-
|
|
101
|
-
this._checkTempRules();
|
|
102
98
|
},
|
|
103
99
|
|
|
104
100
|
initSettingsPopoverModel: function () {
|
|
@@ -205,12 +201,6 @@ sap.ui.define([
|
|
|
205
201
|
if (this.model.getProperty("/persistingSettings")) {
|
|
206
202
|
Storage.createPersistenceCookie(Constants.COOKIE_NAME, true);
|
|
207
203
|
|
|
208
|
-
this.model.getProperty("/libraries").forEach(function (lib) {
|
|
209
|
-
if (lib.title === Constants.TEMP_RULESETS_NAME) {
|
|
210
|
-
Storage.setRules(lib.rules);
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
|
|
214
204
|
this.persistExecutionScope();
|
|
215
205
|
this.persistVisibleColumns();
|
|
216
206
|
SelectionUtils.persistSelection();
|
|
@@ -222,12 +212,6 @@ sap.ui.define([
|
|
|
222
212
|
}
|
|
223
213
|
},
|
|
224
214
|
|
|
225
|
-
onSettingsPopoverClose: function () {
|
|
226
|
-
if (this.model.getProperty("/persistingSettings") && !this.model.getProperty("/tempRulesDisabledWarned")) {
|
|
227
|
-
this.model.setProperty("/tempRulesDisabledWarned", true);
|
|
228
|
-
Storage.markTempRulesDisabledWarned();
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
215
|
|
|
232
216
|
goToAnalysis: function (oEvent) {
|
|
233
217
|
this._setActiveView("analysis");
|
|
@@ -285,12 +269,6 @@ sap.ui.define([
|
|
|
285
269
|
this.ensureOpened();
|
|
286
270
|
},
|
|
287
271
|
|
|
288
|
-
_checkTempRules: function () {
|
|
289
|
-
if (!EvalUtils.isEvalAllowed() && !this.model.getProperty("/tempRulesDisabledWarned")) {
|
|
290
|
-
this._openSettingsPopover();
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
|
|
294
272
|
_openSettingsPopover: function () {
|
|
295
273
|
if (!this._settingsPopover) {
|
|
296
274
|
this._settingsPopover = Fragment.load({
|