disable PC for which the user does not have read permissions when configuring a PG. Also, sort the list of PCs for the combo dropdown in the PG configuration
This closes
text: 'No parameter context',
value: null
}];
- parameterContexts.forEach(function (parameterContext) {
+
+ var authorizedParameterContexts = parameterContexts.filter(function (parameterContext) {
+ return parameterContext.permissions.canRead;
+ });
+
+ var unauthorizedParameterContexts = parameterContexts.filter(function (parameterContext) {
+ return !parameterContext.permissions.canRead;
+ });
+
+ //sort alphabetically
+ var sortedAuthorizedParameterContexts = authorizedParameterContexts.sort(function (a, b) {
+ if (a.component.name < b.component.name) {
+ return -1;
+ }
+ if (a.component.name > b.component.name) {
+ return 1;
+ }
+ return 0;
+ });
+
+ //sort alphabetically
+ var sortedUnauthorizedParameterContexts = unauthorizedParameterContexts.sort(function (a, b) {
+ if (a.id < b.id) {
+ return -1;
+ }
+ if (a.id > b.id) {
+ return 1;
+ }
+ return 0;
+ });
+
+ var sortedParameterContexts = sortedAuthorizedParameterContexts.concat(sortedUnauthorizedParameterContexts);
+
+ sortedParameterContexts.forEach(function (parameterContext) {
var option;
if (parameterContext.permissions.canRead) {
option = {
};
} else {
option = {
+ 'disabled': true,
'text': parameterContext.id,
'value': parameterContext.id
}
