How to use warningOptions method in stryker-parent

Best JavaScript code snippet using stryker-parent

roleReadOnlyView.js

Source:roleReadOnlyView.js Github

copy

Full Screen

1/* (c) Copyright 2008 SailPoint Technologies, Inc., All Rights Reserved. */2// This template accepts a JSON 'role' object of the form:3// {4// roleName: 'Role Name',5// roleDisplayName: 'Role Display Name',6// roleOwner: 'Role Owner', 7// roleType: 'Type', 8// roleDescription: 'description', 9// roleClassification: 'PII, Data', 10// roleActivityMonitoringEnabled: true || false, 11// roleDisabled: true || false, 12// ... (the rest of the role is not used in this template)13// }14var roleDataTemplate = new Ext.XTemplate(15 '<div id="roleDataSection" class="spContentBody" style="background-color: #fff">',16 '<div class="spTabledContent" style="margin: 6px">',17 '<table class="paddedTbl width100">',18 '<tbody>',19 '<tpl if="roleDeleted != \'\'">',20 '<tr>',21 '<td colspan="2" class="requiredText">{roleDeleted}</td>',22 '</tr>',23 '<tpl else>',24 '<tr>',25 '<td colspan="2" class="requiredText">{pendingChangeInfo}</td>',26 '</tr>',27 '</tpl>',28 '<tr><td class="titleColumn">{nameI18n}</td><td><span>{roleName:htmlEncode}</span></td>',29 '<tpl if="activationWarning != \'\'">',30 '<td rowspan="3" valign="top"><div style="float:right;margin:5px 10px" class="activationNotice {activationWarningClass}">{activationWarning} {activationWarningDate}</div></td>',31 '</tpl>',32 '</tr>',33 '<tr><td class="titleColumn">{displayNameI18n}</td><td><span>{roleDisplayName:htmlEncode}</span></td></tr>',34 '<tr><td class="titleColumn">{ownerI18n}</td><td><span>{roleOwner:htmlEncode}</span></td></tr>',35 '<tr><td class="titleColumn">{scopeI18n}</td><td><span>{roleScope}</span></td></tr>',36 '<tr><td class="titleColumn">{typeI18n}</td><td colspan="2"><span>{roleType}</span></td></tr>',37 '<tr><td class="titleColumn">{descriptionI18n}</td><td colspan="2"><span>{roleDescription}</span></td></tr>',38 '<tr><td class="titleColumn">{classificationI18n}</td><td colspan="2"><span>{roleClassification}</span></td></tr>',39 '<tpl if="roleActivityMonitoringIsEnabled">',40 '<tr><td class="titleColumn" colspan="3">{roleActivityMonitoringEnabled}</td></tr>',41 '</tpl>',42 '<tpl if="roleMergeTemplates">',43 '<tr><td class="titleColumn" colspan="3">{roleMergeTemplates}</td></tr>',44 '</tpl>',45 '<tr><td class="titleColumn" colspan="3">{roleDisabled}</td></tr>',46 '</tbody>',47 '</table>',48 '</div>',49 '</div>');50var roleCategoryTemplate = new Ext.XTemplate(51 '<div>',52 '<table class="paddedTbl width100">',53 '<tpl for="attributes">',54 '<tr>',55 '<td style="border: 1px solid #CCC"><span class="titleColumn">','{displayName:htmlEncode}','<tpl if="missing">','*','</tpl>','</span></td>',56 '<td style="border: 1px solid #CCC"><span>','<tpl if="value != null">','{value:htmlEncode}','</tpl>','</span></td>',57 '</tr>',58 '</tpl>',59 '</table>',60 '</div>'61);62var roleEventsTemplate = new Ext.XTemplate(63 '<div>',64 '<table class="spTable width100">',65 '<tr>',66 '<th>#{msgs.work_item_type_event}</th>',67 '<th>#{msgs.date}</th>',68 '<th>#{msgs.creator}</th>',69 '</tr>',70 '<tpl for="events">',71 '<tr>',72 '<td width="25%">',73 '<span class="titleColumn">{name}</span>',74 '</td>',75 '<td >',76 '<span>{date}</span>',77 '</td>',78 '<td >',79 '<span>{creator}</span>',80 '</td>',81 '</tr>',82 '</tpl>',83 '</table>',84 '</div>'85)86;87var roleRightsTemplate = new Ext.XTemplate(88 '<div>',89 '<tpl if="capabilities != null">',90 '<table class="spTable width100">',91 '<tr>',92 '<th>#{msgs.capabilities}</th>',93 '</tr>',94 '<tpl for="capabilities">',95 '<tr>',96 '<td>',97 '<span class="titleColumn">{name}</span>',98 '</td>',99 '</tr>',100 '</tpl>',101 '</table>',102 '</tpl>',103 '</div>',104 '<div>',105 '<tpl if="scopes != null">',106 '<table class="spTable">',107 '<tr>',108 '<th>#{msgs.authorized_scopes}</th>',109 '</tr>',110 '<tpl for="scopes">',111 '<tr>',112 '<td>',113 '<span class="titleColumn">{name}</span>',114 '</td>',115 '</tr>',116 '</tpl>',117 '</table>',118 '</tpl>',119 '</div>'120);121Ext.ns('SailPoint', 'SailPoint.Role', 'SailPoint.Role.RoleView');122SailPoint.Role.RoleView.MAX_ROLES = 15;123SailPoint.Role.RoleView.MAX_ENTITLEMENTS = 10;124Ext.define('RoleSummary', {125 extend: 'Ext.data.Model',126 fields: [127 { name: 'name', type: 'string' },128 { name: 'roleType', type: 'string' },129 { name: 'description', type: 'string' }130 ]131});132Ext.define('SimpleEntitlement', {133 extend: 'Ext.data.Model',134 fields: [135 { name: 'applicationName', type: 'string' },136 { name: 'roleName', type: 'string' },137 { name: 'property', type: 'string' },138 { name: 'value', type: 'string' },139 { name: 'displayValue', type: 'string' },140 { name: 'classifications', type: 'string' }141 ]142});143SailPoint.Role.RoleView.SectionPanelBodyStyle = {144 background: "#dddddd",145 'overflow-y': 'hidden',146 'overflow-x': 'hidden'147};148SailPoint.Role.RoleView.getRoleReader = function() {149 return {150 type: 'json',151 root: 'roles',152 totalProperty: 'numRoleResults',153 idProperty: 'property'154 };155};156SailPoint.Role.RoleView.getEntitlementReader = function() {157 return {158 type: 'json',159 root: 'entitlements',160 totalProperty: 'numEntitlements',161 idProperty: 'id'162 };163};164SailPoint.Role.RoleView.populate = function(viewConfig) {165 var results = viewConfig.results;166 var prefix = viewConfig.prefix;167 var viewDiv = Ext.get(prefix + 'roleViewDiv');168 var roleDataDiv = Ext.get(prefix + 'roleData');169 var roleMetricsSection = Ext.getCmp(prefix + 'roleMetricsSectionPanel');170 var roleMetricsDiv = Ext.get(prefix + 'roleMetrics');171 var directEntitlementsDiv = Ext.get(prefix + 'roleDirectEntitlements');172 var includedEntitlementsDiv = Ext.get(prefix + 'roleIncludedEntitlements');173 var assignmentRuleDiv = Ext.get(prefix + 'roleAssignmentRule');174 var extendedAttributesSectionPanel = Ext.getCmp(prefix + 'extendedAttributesSectionPanel');175 var directEntitlementsSectionCard = Ext.getCmp(prefix + 'directEntitlementsSectionCardPanel');176 var directEntitlementsInvalidWarning = prefix + 'directEntitlementsInvalidWarning';177 var directEntitlementsSimpleInvalidWarning = prefix + 'directEntitlementsSimpleInvalidWarning';178 var includedEntitlementsSectionCard = Ext.getCmp(prefix + 'includedEntitlementsSectionCardPanel');179 var includedEntitlementsInvalidWarning = prefix + 'includedEntitlementsInvalidWarning';180 var includedEntitlementsSimpleInvalidWarning = prefix + 'includedtEntitlementsSimpleInvalidWarning';181 var assignmentRuleSection = Ext.getCmp(prefix + 'assignmentRuleSectionPanel');182 var inheritedRolesGridDataStore = Ext.StoreMgr.lookup(prefix + 'inheritedRolesGridDataStore');183 var permittedRolesGridDataStore = Ext.StoreMgr.lookup(prefix + 'permittedRolesGridDataStore');184 var requiredRolesGridDataStore = Ext.StoreMgr.lookup(prefix + 'requiredRolesGridDataStore');185 var simpleEntitlementsGridDataStore = Ext.StoreMgr.lookup(prefix + 'simpleEntitlementsGridDataStore');186 var simpleIncludedEntitlementsGridDataStore = Ext.StoreMgr.lookup(prefix + 'simpleIncludedEntitlementsGridDataStore');187 var permittedRolesPanel = Ext.getCmp(prefix + 'permittedRolesGridPanel');188 var permittedRolesSectionPanel = Ext.getCmp(prefix + 'permittedRolesSectionPanel');189 var inheritedRolesPanel = Ext.getCmp(prefix + 'inheritedRolesGridPanel');190 var inheritedRolesSectionPanel = Ext.getCmp(prefix + 'inheritedRolesSectionPanel');191 var requiredRolesPanel = Ext.getCmp(prefix + 'requiredRolesGridPanel');192 var requiredRolesSectionPanel = Ext.getCmp(prefix + 'requiredRolesSectionPanel');193 var dataSection = Ext.getCmp(prefix + 'dataSectionPanel');194 var roleEventsSection = Ext.getCmp(prefix + 'roleEventsSectionPanel');195 var roleEventsDiv = Ext.get(prefix + 'roleEvents');196 var assignmentInvalidWarningDiv = prefix + 'assignmentInvalidWarning';197 var inheritedRolesInvalidWarningDiv = prefix + 'inheritedRolesInvalidWarning';198 var inheritedRolesInvalidWarningValuesDiv = prefix + 'inheritedRolesInvalidValuesWarning';199 var requiredRolesInvalidWarningDiv = prefix + 'requiredRolesInvalidWarning';200 var requiredRolesInvalidWarningValuesDiv = prefix + 'requiredRolesInvalidValuesWarning';201 var permittedRolesInvalidWarningDiv = prefix + 'permittedRolesInvalidWarning';202 var permittedRolesInvalidWarningValuesDiv = prefix + 'permittedRolesInvalidValuesWarning';203 // Grab the appropriate type definition and feed it into the results204 var typeDefStore = Ext.StoreMgr.lookup('roleTypeDefinitionStore');205 var typeDefinition = typeDefStore.getTypeDefinition(results.typeName);206 207 // These are blank warningOptions objects that will be used later on to 208 // show/hide 'invalid field' warnings209 var warningOptions = { contentDiv: '', fieldTitle: '' };210 var invalidValuesWarningOptions = { contentDiv: '', fieldTitle: '' };211 212 viewDiv.setVisibilityMode(Ext.Element.DISPLAY);213 roleDataDiv.setVisibilityMode(Ext.Element.DISPLAY);214 directEntitlementsDiv.setVisibilityMode(Ext.Element.DISPLAY);215 216 if (results.roleName) {217 // Fix the dates218 for (var i = 0; i < results.roleExtendableAttributesWithNoCategory.length; ++i) {219 var attr = results.roleExtendableAttributesWithNoCategory[i]; 220 if (attr.type == 'date' && attr.value !== null) {221 attr.value = SailPoint.Date.DateTimeRenderer(attr.value);222 }223 }224 225 for (var categoryName in results.roleExtendableAttributesByCategory) {226 for (var i = 0; i < results.roleExtendableAttributesByCategory[categoryName].length; ++i) {227 var attr = results.roleExtendableAttributesByCategory[categoryName][i]; 228 if (attr.type == 'date' && attr.value !== null) {229 attr.value = SailPoint.Date.DateTimeRenderer(attr.value);230 }231 }232 }233 234 if(results.activationWarningDate) {235 results.activationWarningDate = SailPoint.Date.DateRenderer(results.activationWarningDate);236 }237 roleDataTemplate.overwrite(roleDataDiv, results);238 dataSection.show();239 240 if (extendedAttributesSectionPanel.items != null) {241 var toRemove = new Array(extendedAttributesSectionPanel.items.length);242 for (var i=0; i<extendedAttributesSectionPanel.items.length; ++i) {243 toRemove[i] = extendedAttributesSectionPanel.items.get(i);244 }245 246 for (var i=0; i<toRemove.length; ++i) {247 extendedAttributesSectionPanel.remove(toRemove[i]);248 }249 }250 var roleAttributeBodyStyle = {251 background: '#ffffff', 252 'overflow-y': 'auto',253 'overflow-x': 'hidden'254 }; 255 // This time Firefox is special256 if (Ext.isGecko) {257 roleAttributeBodyStyle['border-top'] = '1px solid #D0D0D0'; 258 roleAttributeBodyStyle['border-left'] = '1px solid #D0D0D0'; 259 }260 261 if(results.events){262 for (var i = 0; i < results.events.length; ++i) {263 var event = results.events[i]; 264 event.date = SailPoint.Date.DateRenderer(event.date);265 }266 roleEventsTemplate.overwrite(roleEventsDiv, results);267 roleEventsSection.show();268 } else {269 roleEventsSection.hide();270 }271 var numExtendedAttributes = 0;272 273 var extAttrNoCat = Ext.create('Ext.panel.Panel', {274 html: roleCategoryTemplate.apply({attributes: results.roleExtendableAttributesWithNoCategory}),275 layout:'anchor',276 anchor:'98%',277 style: 'padding: 10px;',278 bodyStyle: roleAttributeBodyStyle,279 border:false,280 autoScroll:true281 });282 extendedAttributesSectionPanel.add(extAttrNoCat);283 284 numExtendedAttributes += results.roleExtendableAttributesWithNoCategory.length;285 286 for (var categoryName in results.roleExtendableAttributesByCategory) {287 var child = Ext.create('Ext.panel.Panel', {288 html: roleCategoryTemplate.apply({attributes: results.roleExtendableAttributesByCategory[categoryName]}),289 layout:'anchor',290 anchor:'98%',291 border:false,292 title: SailPoint.Utils.escapeForXss(categoryName),293 collapsible:true,294 collapsed:false,295 autoScroll:true,296 style: 'padding: 10px;',297 bodyStyle: roleAttributeBodyStyle298 });299 300 extendedAttributesSectionPanel.add(child);301 numExtendedAttributes++;302 }303 if (results.missingAttributePresent === true) {304 var missingAttributeInfoPanel = Ext.create('Ext.panel.Panel', {305 html: '*#{msgs.attr_does_not_apply}.',306 border:false307 });308 309 extendedAttributesSectionPanel.add(missingAttributeInfoPanel);310 }311 312 if (numExtendedAttributes > 0) {313 extendedAttributesSectionPanel.show();314 extendedAttributesSectionPanel.doLayout();315 } else {316 extendedAttributesSectionPanel.hide();317 }318 319 var roleMetrics = results.roleMetrics;320 var roleMetricsTemplate;321 // We shouldn't display metrics for archived roles so the editor doesn't include the metrics code322 if (SailPoint.Role.Metrics && !viewConfig.isArchive) {323 roleMetricsTemplate = SailPoint.Role.Metrics.Template;324 roleMetricsTemplate.overwrite(roleMetricsDiv, roleMetrics);325 roleMetricsSection.show();326 } else {327 roleMetricsSection.hide();328 }329 330 var roleDirectEntitlements = results.roleDirectEntitlements;331 var roleIncludedEntitlements = results.roleIncludedEntitlements;332 var roleEntitlementsTemplate = SailPoint.modeler.RoleEntitlementsTemplate;333 var roleAssignmentRulesTemplate = SailPoint.modeler.RoleAssignmentRuleTemplate; 334 var i18nWrapper = SailPoint.modeler.I18nEntitlementsWrapper;335 336 i18nWrapper.entitlements = roleDirectEntitlements;337 roleEntitlementsTemplate.overwrite(directEntitlementsDiv, i18nWrapper);338 i18nWrapper.entitlements = roleIncludedEntitlements;339 roleEntitlementsTemplate.overwrite(includedEntitlementsDiv, i18nWrapper);340 341 var roleAssignmentRule = results.roleSelector;342 warningOptions.contentDiv = assignmentInvalidWarningDiv;343 warningOptions.fieldTitle = '#{msgs.role_section_assignment_selector}';344 if (roleAssignmentRule) {345 if (!typeDefinition || typeDefinition.noAssignmentSelector) {346 SailPoint.Role.RoleView.displayInvalidFieldValuesWarning(warningOptions);347 } else {348 SailPoint.Role.RoleView.hideInvalidFieldWarning(warningOptions);349 }350 351 roleAssignmentRulesTemplate.overwrite(assignmentRuleDiv, roleAssignmentRule);352 assignmentRuleSection.show();353 assignmentRuleDiv.show();354 } else {355 SailPoint.Role.RoleView.hideInvalidFieldWarning(warningOptions);356 assignmentRuleDiv.hide();357 assignmentRuleSection.hide();358 }359 360 var storeParams = {361 start: 0, 362 limit: SailPoint.Role.RoleView.MAX_ROLES, 363 roleId: results.roleId364 }365 if (viewConfig.isArchive) {366 storeParams.archiveId = viewConfig.archiveId;367 }368 369 SailPoint.Role.RoleView.displayRoleReference({370 roleId: results.roleId,371 isShown: results.roleHasInheritance,372 isInvalid: !typeDefinition || typeDefinition.noSupers,373 warningDiv: inheritedRolesInvalidWarningDiv,374 warningFieldTitle: '#{msgs.role_membership}',375 warningValuesDiv: inheritedRolesInvalidWarningValuesDiv,376 warningValues: results.invalidInheritance,377 sectionPanel: inheritedRolesSectionPanel,378 gridPanel: inheritedRolesPanel,379 store: inheritedRolesGridDataStore,380 storeParams: storeParams381 });382 383 SailPoint.Role.RoleView.displayRoleReference({384 roleId: results.roleId,385 isShown: results.roleHasPermits,386 isInvalid: !typeDefinition || typeDefinition.noPermits,387 warningDiv: permittedRolesInvalidWarningDiv,388 warningFieldTitle: '#{msgs.role_section_permitted_roles}',389 warningValuesDiv: permittedRolesInvalidWarningValuesDiv,390 warningValues: results.invalidPermits,391 sectionPanel: permittedRolesSectionPanel,392 gridPanel: permittedRolesPanel,393 store: permittedRolesGridDataStore,394 storeParams: storeParams395 });396 SailPoint.Role.RoleView.displayRoleReference({397 roleId: results.roleId,398 isShown: results.roleHasRequirements,399 isInvalid: !typeDefinition || typeDefinition.noRequirements,400 warningDiv: requiredRolesInvalidWarningDiv,401 warningFieldTitle: '#{msgs.role_section_required_roles}',402 warningValuesDiv: requiredRolesInvalidWarningValuesDiv,403 warningValues: results.invalidRequirements,404 sectionPanel: requiredRolesSectionPanel,405 gridPanel: requiredRolesPanel,406 store: requiredRolesGridDataStore,407 storeParams: storeParams408 });409 410 viewDiv.show();411 roleDataDiv.show();412 413 warningOptions.contentDiv = directEntitlementsInvalidWarning;414 warningOptions.fieldTitle = '#{msgs.role_section_entitlements}';415 416 var hasEntitlements = roleDirectEntitlements.length > 0;417 if (hasEntitlements) {418 if (!typeDefinition || typeDefinition.noProfiles) {419 SailPoint.Role.RoleView.displayInvalidFieldValuesWarning(warningOptions);420 } else {421 SailPoint.Role.RoleView.hideInvalidFieldWarning(warningOptions);422 }423 if (results.hasSimpleEntitlements) {424 var entitlementStoreParams = {425 start: 0,426 limit: SailPoint.Role.RoleView.MAX_ENTITLEMENTS,427 roleId: results.roleId428 };429 if(prefix === 'archive'){430 simpleEntitlementsGridDataStore.getProxy().extraParams = {archiveId: storeParams.archiveId, prefix: "archive" };431 }432 //IIQETN-5561 :- When clicking in a new node we need to refresh the current page for simple entitlements433 simpleEntitlementsGridDataStore.currentPage = 1;434 simpleEntitlementsGridDataStore.load(entitlementStoreParams);435 directEntitlementsSectionCard.layout.setActiveItem(0);436 }437 else {438 directEntitlementsSectionCard.layout.setActiveItem(1);439 }440 directEntitlementsSectionCard.show();441 } else {442 SailPoint.Role.RoleView.hideInvalidFieldWarning(warningOptions);443 directEntitlementsSectionCard.hide();444 }445 hasEntitlements = false;446 var hasPermissions = false;447 448 warningOptions.contentDiv = includedEntitlementsInvalidWarning;449 warningOptions.fieldTitle = '#{msgs.role_section_inherited_entitlements}';450 for (var i = 0; i < roleIncludedEntitlements.length; ++i) {451 hasEntitlements |= (roleIncludedEntitlements[i].rules.length > 0);452 hasPermissions |= (roleIncludedEntitlements[i].permissions.length > 0);453 }454 if (hasEntitlements) {455 if (!typeDefinition || typeDefinition.noProfiles) {456 // SailPoint.Role.RoleView.displayInvalidFieldValuesWarning(warningOptions);457 } else {458 SailPoint.Role.RoleView.hideInvalidFieldWarning(warningOptions);459 }460 if (results.hasSimpleIncludedEntitlements) {461 var includedEntitlementStoreParams = {462 start: 0,463 limit: SailPoint.Role.RoleView.MAX_ENTITLEMENTS,464 roleId: results.roleId465 }466 //IIQTC-83 :- When clicking in a new node we need to refresh the current467 //page for inherited entitlements468 simpleIncludedEntitlementsGridDataStore.currentPage = 1;469 simpleIncludedEntitlementsGridDataStore.load(includedEntitlementStoreParams);470 includedEntitlementsSectionCard.layout.setActiveItem(0);471 }472 else {473 includedEntitlementsSectionCard.layout.setActiveItem(1);474 }475 includedEntitlementsSectionCard.show();476 } else {477 SailPoint.Role.RoleView.hideInvalidFieldWarning(warningOptions);478 includedEntitlementsSectionCard.hide();479 }480 481 var versionSectionPanel = Ext.getCmp(prefix + 'versionSectionPanel');482 var versionGrid = Ext.getCmp(prefix + 'versionGrid');483 var versionGridDataStore = Ext.StoreMgr.lookup(prefix + 'versionGridDataStore'); 484 var hasArchives = results.hasArchivedRoles;485 486 if (hasArchives && viewConfig.showVersionGrid) {487 versionGridDataStore.getProxy().setExtraParam('roleId', results.roleId);488 versionGridDataStore.loadPage(1, {489 callback: function(record, options, success) {490 versionSectionPanel.show();491 versionGrid.show();492 }493 });494 } else {495 versionSectionPanel.hide();496 versionGrid.hide();497 }498 499 SailPoint.Role.RoleView.displayIIQRights(viewConfig, typeDefinition);500 501 Ext.getCmp(prefix + 'roleViewContentPanel').show();502 } else {503 SailPoint.Role.RoleView.clearRoleView({prefix: prefix});504 }505};506SailPoint.Role.RoleView.displayIIQRights = function(viewConfig, typeDefinition) {507 var prefix = viewConfig.prefix,508 results = viewConfig.results,509 roleRightsSection = Ext.getCmp(prefix + 'sailpointRightsSectionPanel'),510 rightsDiv = Ext.get(prefix + 'sailpointRights'),511 warningOptions = {512 contentDiv: prefix + 'sailpointRightsInvalidValuesWarning',513 };514 515 // reset warning message by hiding516 SailPoint.Role.RoleView.hideInvalidFieldWarning(warningOptions);517 // IIQCB-1404 render IIQ rights no matter what typeDefinition states518 if ( results.capabilities != null || results.scopes != null ) {519 roleRightsTemplate.overwrite(rightsDiv, results);520 roleRightsSection.show();521 522 // if typeDefinition doesn't allow IIQ rights, show warning523 if ( typeDefinition && typeDefinition.noIIQ ) {524 SailPoint.Role.RoleView.addFieldValuesWarning(results.capabilities, warningOptions);525 SailPoint.Role.RoleView.addFieldValuesWarning(results.scopes, warningOptions);526 SailPoint.Role.RoleView.displayInvalidFieldValuesWarning(warningOptions);527 }528 } else {529 roleRightsSection.hide();530 }531};532SailPoint.Role.RoleView.addFieldValuesWarning = function(arrayNameObjects, warningOptions) {533 if (!warningOptions.values) {534 warningOptions.values = [];535 }536 Ext.Array.each(arrayNameObjects, function(item, index, allItems) {537 Ext.Array.push(warningOptions.values, item.name);538 });539}540SailPoint.Role.RoleView.displayRoleReference = function(displayOptions) {541 var roleId = displayOptions.roleId;542 var storeParams = displayOptions.storeParams;543 var isShown = displayOptions.isShown;544 var isInvalid = displayOptions.isInvalid;545 var warningDiv = displayOptions.warningDiv;546 var warningValuesDiv = displayOptions.warningValuesDiv;547 var sectionPanel = displayOptions.sectionPanel;548 var gridPanel = displayOptions.gridPanel;549 var store = displayOptions.store;550 551 var warningOptions = {552 contentDiv: warningDiv,553 fieldTitle: displayOptions.warningFieldTitle554 };555 556 var invalidValuesWarningOptions = {557 contentDiv: warningValuesDiv,558 values: displayOptions.warningValues559 };560 561 if (isShown) {562 if (isInvalid) {563 SailPoint.Role.RoleView.displayInvalidFieldValuesWarning(warningOptions);564 Ext.get(warningDiv).show();565 Ext.getCmp(warningDiv + 'Container').show();566 } else {567 SailPoint.Role.RoleView.hideInvalidFieldWarning(warningOptions);568 Ext.get(warningDiv).setVisibilityMode(Ext.Element.DISPLAY).hide();569 Ext.getCmp(warningDiv + 'Container').hide();570 }571 572 if (invalidValuesWarningOptions.values.length > 0) {573 SailPoint.Role.RoleView.displayInvalidFieldValuesWarning(invalidValuesWarningOptions);574 Ext.get(warningValuesDiv).show();575 Ext.getCmp(warningValuesDiv + 'Container').show();576 } else {577 SailPoint.Role.RoleView.hideInvalidFieldWarning(invalidValuesWarningOptions);578 Ext.get(warningValuesDiv).setVisibilityMode(Ext.Element.DISPLAY).hide();579 Ext.getCmp(warningValuesDiv + 'Container').hide();580 }581 gridPanel.show();582 sectionPanel.show();583 //IIQTC-83 :- When clicking in a new node we need to refresh the current page584 //for inherited roles585 store.currentPage = 1;586 store.load({ params: storeParams });587 } else {588 SailPoint.Role.RoleView.hideInvalidFieldWarning(warningOptions);589 Ext.get(warningDiv).setVisibilityMode(Ext.Element.DISPLAY).hide();590 Ext.getCmp(warningDiv + 'Container').hide();591 gridPanel.hide();592 sectionPanel.hide();593 SailPoint.Role.RoleView.hideInvalidFieldWarning(invalidValuesWarningOptions);594 Ext.get(warningValuesDiv).setVisibilityMode(Ext.Element.DISPLAY).hide();595 Ext.getCmp(warningValuesDiv + 'Container').hide();596 }597};598SailPoint.Role.RoleView.hideInvalidFieldWarning = function (options) {599 var warningDivEl = Ext.get(options.contentDiv);600 Ext.DomHelper.applyStyles(warningDivEl, {display: 'none'});601};602SailPoint.Role.RoleView.invalidFieldValuesWarningTemplate = new Ext.XTemplate(603 '<div>{message}</div>',604 '<tpl for="values">',605 '<div style="margin-left:10px">{.}</div>',606 '</tpl>'607);608SailPoint.Role.RoleView.displayInvalidFieldValuesWarning = function (options) {609 var warningMsg = '#{msgs.role_invalid_field_values_warning}';610 var populatedWarningMsg = SailPoint.Role.RoleView.invalidFieldValuesWarningTemplate.apply({ 611 message: warningMsg, 612 values: options.values 613 });614 var warningDivEl = Ext.get(options.contentDiv);615 Ext.DomHelper.applyStyles(warningDivEl, {display: ''});616 Ext.DomHelper.overwrite(warningDivEl, populatedWarningMsg);617};618SailPoint.Role.RoleView.getRoleViewContentPanel = function(config) {619 var prefix = config.prefix;620 var isMainView = config.isMainView;621 var roleReferenceParamBuilder = config.roleReferenceParamBuilder;622 623 var dataSectionConfig = {624 xtype: 'panel',625 id: prefix + 'dataSectionPanel',626 bodyBorder: true,627 contentEl: prefix + 'dataSection',628 hidden: true,629 autoScroll: false,630 layout: 'fit',631 style: 'padding: 10px;',632 title: '#{msgs.attributes}',633 collapsible: true634 };635 636 var roleMetricsSectionConfig = {637 id: prefix + 'roleMetricsSectionPanel',638 contentEl: prefix + 'roleMetricsSection',639 hidden: true,640 autoScroll: false,641 layout: 'fit',642 collapsible: true,643 title: '#{msgs.role_metrics}',644 style: 'padding: 10px;',645 bodyBorder: true,646 bodyStyle: {647 'background': '#ffffff', 648 'overflow-y': 'auto',649 'overflow-x': 'hidden'650 },651 bbar: [652 Ext.create('Ext.button.Button', {653 text: '#{msgs.button_refresh}',654 tooltip: '#{msgs.button_refresh}',655 handler: function() {656 var metricsSection = Ext.getCmp(prefix + 'roleMetricsSectionPanel');657 var pollingTask = metricsSection.pollingTask;658 if (!pollingTask) {659 pollingTask = new Ext.util.DelayedTask(metricsSection.pollForMetrics, metricsSection);660 metricsSection.pollingTask = pollingTask;661 }662 metricsSection.getEl().mask('#{msgs.refreshing_data}', 'x-mask-loading');663 pollingTask.delay(1);664 }665 })666 ],667 pollForMetrics: function() {668 var viewerState = Ext.getCmp('roleViewerStateController').getState();669 var selectedRoleId = viewerState.selectedRoleId;670 671 Ext.Ajax.request({672 url: SailPoint.getRelativeUrl('/rest/roleViewer/refreshMetrics'),673 method: 'POST',674 params: {roleId: selectedRoleId},675 callback: function(options, success, response) {676 var roleMetricsDiv = Ext.get(prefix + 'roleMetrics');677 var roleMetricsTemplate = SailPoint.Role.Metrics.Template;678 var metricsSection = Ext.getCmp(prefix + 'roleMetricsSectionPanel');679 var responseObj = Ext.JSON.decode(response.responseText);680 if (responseObj.isPending) {681 metricsSection.pollingTask.delay(3000);682 } else {683 metricsSection.getEl().unmask();684 roleMetricsTemplate.overwrite(roleMetricsDiv, responseObj.roleMetrics);685 metricsSection.doLayout();686 }687 }688 });689 }690 };691 692 var extendedAttributesSectionConfig = {693 id: prefix + 'extendedAttributesSectionPanel',694 contentEl: prefix + 'extendedAttributesSection',695 hidden: true,696 layout: 'fit',697 collapsible:true,698 bodyBorder: true,699 title:'#{msgs.oconfig_section_extended_attributes}',700 style: 'padding: 10px;',701 bodyStyle: {702 'background': '#ffffff', 703 'overflow-y': 'auto',704 'overflow-x': 'hidden'705 }706 };707 var directEntitlementsSectionConfig = {708 id: prefix + 'directEntitlementsSectionPanel',709 contentEl: prefix + 'directEntitlementsSection',710 hidden: true,711 autoScroll: false,712 title:'#{msgs.role_entitlement_profile}',713 layout: 'fit',714 collapsible:true,715 style: 'padding: 10px;',716 bodyBorder: true,717 bodyStyle: {718 'background': '#ffffff', 719 'overflow-y': 'auto',720 'overflow-x': 'hidden'721 }722 };723 var directEntitlementsSectionSimpleConfig = SailPoint.Role.RoleView.createSimpleEntitlementPanel({724 prefix: prefix,725 title: '#{msgs.role_simple_direct_entitlements}',726 hidden: true,727 type: 'simpleEntitlements',728 url: SailPoint.getRelativeUrl('/define/roles/modeler/readOnlySimpleEntitlementsJSON.json'),729 paramBuilder: roleReferenceParamBuilder,730 columns: [731 { dataIndex: 'applicationName', header: '#{msgs.role_simple_entitlement_application_name_header}', flex: 1, sortable: true },732 { dataIndex: 'property', header: '#{msgs.role_simple_entitlement_property_header}', flex: 1, sortable: true },733 { dataIndex: 'displayValue', header: '#{msgs.role_simple_entitlement_value_header}', flex: 3, sortable: true, renderer: 'htmlEncode' },734 { dataIndex: 'classifications', header: '#{msgs.role_simple_entitlement_classification_header}', flex: 3, sortable: false, renderer: 'htmlEncode' }735 ],736 disableSelect: true737 });738 var directEntitlementsSectionCardConfig = {739 id: prefix + 'directEntitlementsSectionCardPanel',740 layout:'card',741 activeItem:0,742 region:'center',743 items: [744 directEntitlementsSectionSimpleConfig,745 directEntitlementsSectionConfig746 ]747 };748 749 var includedEntitlementsSectionConfig = {750 id: prefix + 'includedEntitlementsSectionPanel',751 title: '#{msgs.role_section_inherited_entitlements}',752 hidden: true,753 collapsible: true,754 header: true,755 collapsed: true,756 contentEl: prefix + 'includedEntitlementsSection',757 autoScroll: false,758 title:'#{msgs.role_inherited_entitlement_profile}',759 layout: 'fit',760 collapsible:true,761 style: 'padding: 10px;',762 bodyBorder: true,763 bodyStyle: {764 'background': '#ffffff', 765 'overflow-y': 'auto',766 'overflow-x': 'hidden'767 }768 };769 770 var includedEntitlementsSectionSimpleConfig = SailPoint.Role.RoleView.createSimpleEntitlementPanel({771 prefix: prefix,772 title: '#{msgs.role_section_inherited_entitlements}',773 hidden: true,774 type: 'simpleIncludedEntitlements',775 url: SailPoint.getRelativeUrl('/define/roles/modeler/readOnlySimpleIncludedEntitlementsJSON.json'),776 paramBuilder: roleReferenceParamBuilder,777 columns: [778 { dataIndex: 'applicationName', header: '#{msgs.role_simple_entitlement_application_name_header}', flex: 1, sortable: true },779 { dataIndex: 'roleName', header: '#{msgs.role_simple_entitlement_role_header}', flex: 1, sortable: true, renderer: 'htmlEncode' },780 { dataIndex: 'property', header: '#{msgs.role_simple_entitlement_property_header}', flex: 1, sortable: true },781 { dataIndex: 'displayValue', header: '#{msgs.role_simple_entitlement_value_header}', flex: 3, sortable: true, renderer: 'htmlEncode' },782 { dataIndex: 'classifications', header: '#{msgs.role_simple_entitlement_classification_header}', flex: 3, sortable: false, renderer: 'htmlEncode' }783 ],784 disableSelect: true785 });786 var includedEntitlementsSectionCardConfig = {787 id: prefix + 'includedEntitlementsSectionCardPanel',788 layout:'card',789 activeItem:0,790 region:'center',791 items: [792 includedEntitlementsSectionSimpleConfig,793 includedEntitlementsSectionConfig794 ]795 };796 797 var eventSectionConfig = {798 id: prefix + 'roleEventsSectionPanel',799 autoScroll : false,800 contentEl: prefix + 'roleEvents',801 hidden: true,802 style: 'padding:10px',803 title:'#{msgs.role_section_role_events}',804 bodyBorder: true,805 layout: 'fit'806 };807 var rightsSectionConfig = {808 id: prefix + 'sailpointRightsSectionPanel',809 autoScroll : false,810 hidden: true,811 style: 'padding:10px',812 title: '#{msgs.role_section_sprights}',813 collapsible: true,814 titleCollapse: true,815 bodyBorder: true,816 items: [{817 xtype: 'container',818 id: prefix + 'sailpointRightsInvalidValuesWarningContainer',819 contentEl: prefix + 'sailpointRightsInvalidValuesWarning'820 }, {821 xtype: 'container',822 id: prefix + 'sailpointRightsContainer',823 contentEl: prefix + 'sailpointRights'824 }]825 };826 827 var assignmentRuleSectionConfig = {828 id: prefix + 'assignmentRuleSectionPanel',829 title: '#{msgs.role_label_assignment_selector}',830 hidden: true,831 style: 'padding: 10px;',832 collapsible: true,833 titleCollapse: true,834 contentEl: prefix + 'assignmentRuleSection',835 autoScroll: false,836 bodyBorder: true,837 layout: 'fit'838 };839 var versionGridPanelConfig = SailPoint.Role.RoleView.createVersionSection({840 prefix: prefix841 });842 843 var inheritedRolesPanelConfig = SailPoint.Role.RoleView.createRoleReferencePanel({844 prefix: prefix,845 title: '#{msgs.role_membership}',846 hidden: true,847 type: 'inheritedRoles',848 url: SailPoint.getRelativeUrl('/define/roles/modeler/inheritedRolesQueryJSON.json'),849 paramBuilder: roleReferenceParamBuilder,850 disableSelect: !isMainView851 });852 var permittedRolesPanelConfig = SailPoint.Role.RoleView.createRoleReferencePanel({853 prefix: prefix,854 title: '#{msgs.role_section_permitted_roles}',855 hidden: true,856 type: 'permittedRoles',857 url: SailPoint.getRelativeUrl('/define/roles/modeler/permittedRolesQueryJSON.json'),858 paramBuilder: roleReferenceParamBuilder,859 disableSelect: !isMainView860 });861 862 var requiredRolesPanelConfig = SailPoint.Role.RoleView.createRoleReferencePanel({863 prefix: prefix,864 title: '#{msgs.role_section_required_roles}',865 hidden: true,866 type: 'requiredRoles',867 url: SailPoint.getRelativeUrl('/define/roles/modeler/requiredRolesQueryJSON.json'),868 paramBuilder: roleReferenceParamBuilder,869 disableSelect: !isMainView870 });871 var contentPanelConfig = {872 id: prefix + 'roleViewContentPanel',873 contentEl: prefix + 'roleViewDiv',874 autoScroll: true,875 items: [876 dataSectionConfig,877 extendedAttributesSectionConfig,878 eventSectionConfig,879 roleMetricsSectionConfig,880 versionGridPanelConfig, 881 assignmentRuleSectionConfig,882 requiredRolesPanelConfig,883 permittedRolesPanelConfig,884 inheritedRolesPanelConfig,885 directEntitlementsSectionCardConfig,886 includedEntitlementsSectionCardConfig,887 rightsSectionConfig888 ]889 };890 891 if (isMainView) {892 contentPanelConfig.bbar = [893 new Ext.Button({894 id: 'roleEditOptions',895 text: '#{msgs.button_edit_role}',896 handler: function() {897 var viewerState = Ext.getCmp('roleViewerStateController').getState();898 Ext.getDom('viewerForm:roleToEdit').value = viewerState.selectedRoleId || viewerState.filteredNode;899 Ext.getDom('viewerForm:editRole').click();900 }901 })902 ];903 }904 var roleViewContentPanel = Ext.create('Ext.panel.Panel', contentPanelConfig);905 906 return roleViewContentPanel;907};908SailPoint.Role.RoleView.clearRoleView = function(config) {909 var prefix;910 if (!config || !config.prefix) {911 prefix = '';912 } else {913 prefix = config.prefix;914 }915 var dataSection = Ext.getCmp(prefix + 'dataSectionPanel');916 var extendedAttributesSectionPanel = Ext.getCmp(prefix + 'extendedAttributesSectionPanel');917 var directEntitlementsSectionCard = Ext.getCmp(prefix + 'directEntitlementsSectionCardPanel');918 var includedEntitlementsSectionCard = Ext.getCmp(prefix + 'includedEntitlementsSectionCardPanel');919 var navigationPanel = Ext.getCmp(prefix + 'roleNavPanel');920 var eventsSection = Ext.getCmp(prefix + 'roleEventsSectionPanel');921 var metricsSection = Ext.getCmp(prefix + 'roleMetricsSectionPanel');922 var assignmentRuleSection = Ext.getCmp(prefix + 'assignmentRuleSectionPanel');923 var assignmentRuleDiv = Ext.get(prefix + 'roleAssignmentRule');924 var inheritedRolesPanel = Ext.getCmp(prefix + 'inheritedRolesGridPanel');925 var inheritedRolesSectionPanel = Ext.getCmp(prefix + 'inheritedRolesSectionPanel');926 var permittedRolesPanel = Ext.getCmp(prefix + 'permittedRolesGridPanel');927 var permittedRolesSectionPanel = Ext.getCmp(prefix + 'permittedRolesSectionPanel');928 var requiredRolesPanel = Ext.getCmp(prefix + 'requiredRolesGridPanel');929 var requiredRolesSectionPanel = Ext.getCmp(prefix + 'requiredRolesSectionPanel');930 var versionSectionPanel = Ext.getCmp(prefix + 'versionSectionPanel');931 var versionPanel = Ext.getCmp(prefix + 'versionGrid');932 var rightsPanel = Ext.getCmp(prefix + 'sailpointRightsSectionPanel');933 dataSection.hide();934 versionSectionPanel.hide();935 versionPanel.hide();936 extendedAttributesSectionPanel.hide();937 directEntitlementsSectionCard.hide();938 includedEntitlementsSectionCard.hide();939 inheritedRolesPanel.hide();940 inheritedRolesSectionPanel.hide();941 permittedRolesPanel.hide();942 permittedRolesSectionPanel.hide();943 requiredRolesPanel.hide();944 requiredRolesSectionPanel.hide();945 assignmentRuleSection.hide();946 eventsSection.hide();947 metricsSection.hide();948 assignmentRuleDiv.hide();949 navigationPanel.resetRoleEdit();950 rightsPanel.hide();951}952SailPoint.Role.RoleView.hideInvalidFieldWarning = function (options) {953 var warningDivEl = Ext.get(options.contentDiv);954 Ext.DomHelper.applyStyles(warningDivEl, {display: 'none'});955}956SailPoint.Role.RoleView.invalidFieldValuesWarningTemplate = new Ext.XTemplate(957 '<div>{message}</div>',958 '<tpl for="values">',959 '<div style="margin-left:10px">{.}</div>',960 '</tpl>'961);962SailPoint.Role.RoleView.displayInvalidFieldValuesWarning = function (options) {963 var warningMsg = '#{msgs.role_invalid_field_values_warning}';964 var populatedWarningMsg = SailPoint.Role.RoleView.invalidFieldValuesWarningTemplate.apply({ 965 message: warningMsg, 966 values: options.values 967 });968 var warningDivEl = Ext.get(options.contentDiv);969 Ext.DomHelper.applyStyles(warningDivEl, {display: ''});970 Ext.DomHelper.overwrite(warningDivEl, populatedWarningMsg);971}972SailPoint.Role.RoleView.createRoleReferencePanel = function(config) {973 var roleReferenceGridDataStore = Ext.create('Ext.data.Store', {974 id: config.prefix + config.type + 'GridDataStore',975 model: 'RoleSummary',976 proxy: {977 type: 'ajax',978 url: config.url,979 reader: SailPoint.Role.RoleView.getRoleReader()980 },981 remoteSort: true,982 pageSize: SailPoint.Role.RoleView.MAX_ROLES983 });984 985 // inject roleId into the request params...986 roleReferenceGridDataStore.on('beforeload', function(store, operation, eOpts) {987 var params;988 if (SailPoint.Role.Viewer) {989 // This only works in the role viewer990 params = SailPoint.Role.Viewer.getCurrentRoleId(); 991 } else {992 // This works in the role editor993 params = { roleId: Ext.getDom('rollbackForm:roleToEdit').value };994 }995 996 operation.params = operation.params || {};997 Ext.applyIf(operation.params, params);998 });999 1000 var roleReferenceGridPanelConfig = {1001 xtype: 'gridpanel',1002 prefix: config.prefix,1003 title: config.title,1004 id: config.prefix + config.type + 'GridPanel',1005 collapsible: true,1006 collapsed: true,1007 hidden: true,1008 store: roleReferenceGridDataStore,1009 cls : 'smallFontGrid wrappingGridCells',1010 columns: [1011 { dataIndex: 'name', header: '#{msgs.name}', flex: 2, sortable: true, renderer: 'htmlEncode' },1012 { dataIndex: 'roleType', header: '#{msgs.type}', flex: 1, sortable: true },1013 { dataIndex: 'description', header: '#{msgs.description}', flex: 5, sortable: false }1014 ],1015 viewConfig: {1016 emptyText: '#{msgs.role_viewer_roles_unavailable}'1017 },1018 bbar: [1019 Ext.create('SailPoint.ExtendedPagingToolbar', {1020 store: roleReferenceGridDataStore,1021 displayInfo: false,1022 paramBuilder: config.paramBuilder1023 })1024 ]1025 };1026 1027 if (!config.disableSelect) {1028 roleReferenceGridPanelConfig.listeners = {1029 select: {1030 fn: SailPoint.Role.forceSelection1031 }1032 }1033 }1034 1035 var warningEl = config.prefix + config.type + 'InvalidWarning'; 1036 var invalidValsEl = config.prefix + config.type + 'InvalidValuesWarning';1037 1038 var roleReferenceSectionConfig = {1039 xtype: 'panel',1040 id: config.prefix + config.type + 'SectionPanel',1041 style: 'padding: 10px',1042 border: false,1043 bodyBorder: false,1044 hidden: true,1045 bodyStyle: SailPoint.Role.RoleView.SectionPanelBodyStyle,1046 items: [{1047 xtype: 'container',1048 id: warningEl + 'Container',1049 contentEl: warningEl1050 }, {1051 xtype: 'container',1052 id: invalidValsEl + 'Container',1053 contentEl: invalidValsEl1054 },1055 roleReferenceGridPanelConfig1056 ]1057 };1058 1059 return roleReferenceSectionConfig;1060};1061SailPoint.Role.RoleView.createSimpleEntitlementPanel = function(config) {1062 var simpleEntitlementsGridDataStore = Ext.create('Ext.data.Store', {1063 id: config.prefix + config.type + 'GridDataStore',1064 model: 'SimpleEntitlement',1065 proxy: {1066 type: 'ajax',1067 url: config.url,1068 reader: SailPoint.Role.RoleView.getEntitlementReader()1069 },1070 remoteSort: true,1071 pageSize: 10,1072 autoLoad: true1073 });1074 // inject roleId into the request params...1075 simpleEntitlementsGridDataStore.on('beforeload', function(store, operation, eOpts) {1076 var params;1077 if (SailPoint.Role.Viewer) {1078 // This only works in the role viewer1079 params = SailPoint.Role.Viewer.getCurrentRoleId(); 1080 } else {1081 // This works in the role editor1082 params = { roleId: Ext.getDom('rollbackForm:roleToEdit').value };1083 }1084 operation.params = operation.params || {};1085 Ext.applyIf(operation.params, params);1086 });1087 var simpleEntitlementsGridPanelConfig = {1088 xtype: 'gridpanel',1089 prefix: config.prefix,1090 title: config.title,1091 id: config.prefix + config.type + 'GridPanel',1092 collapsible: true,1093 collapsed: false,1094 hidden: false,1095 store: simpleEntitlementsGridDataStore,1096 cls : 'smallFontGrid wrappingGridCells',1097 columns: config.columns,1098 viewConfig: {1099 emptyText: '#{msgs.role_viewer_roles_unavailable}'1100 },1101 bbar: [1102 Ext.create('SailPoint.ExtendedPagingToolbar', {1103 store: simpleEntitlementsGridDataStore,1104 displayInfo: false,1105 paramBuilder: config.paramBuilder1106 })1107 ]1108 };1109 var simpleEntitlementSectionConfig = {1110 xtype: 'panel',1111 id: config.prefix + config.type + 'SectionPanel',1112 style: 'padding: 10px',1113 border: false,1114 bodyBorder: false,1115 hidden: true,1116 bodyStyle: SailPoint.Role.RoleView.SectionPanelBodyStyle,1117 items: [1118 simpleEntitlementsGridPanelConfig1119 ]1120 };1121 return simpleEntitlementSectionConfig;1122};1123SailPoint.Role.RoleView.createVersionSection = function(config) {1124 var versionSectionPanelConfig = {1125 id: config.prefix + 'versionSectionPanel',1126 border: false,1127 bodyBorder: false,1128 style: 'padding: 10px',1129 contentEl: config.prefix + 'versionSection',1130 hidden: true,1131 autoScroll: false,1132 layout: 'fit',1133 bodyStyle: SailPoint.Role.RoleView.SectionPanelBodyStyle,1134 items: [SailPoint.Role.Version.getGrid({1135 id: config.prefix + 'versionGrid',1136 title: '#{msgs.title_archived_roles}',1137 prefix: config.prefix1138 })]1139 };1140 1141 return versionSectionPanelConfig;1142};1143/*1144 * { 1145 * applications: [{ 1146 * application: 'appName',1147 * attributes: [{1148 * name: 'attrName',1149 * showEntitlementDescription: true | false,1150 * values: [{1151 * valueId: 'id',1152 * isGroup: true | false,1153 * displayName: 'name',1154 * showInfoIcon: true | false,1155 * description: 'description'1156 * application: 'appName', <-- Workaround for XTemplate limitation1157 * value: 'value'1158 * }, {...1159 * }]1160 * }, {...1161 * }]1162 * }, {...1163 * }]1164 * }1165 */1166SailPoint.Role.RoleDetailEntitlementsTemplate = new Ext.XTemplate(1167 '<tpl if="this.isEmpty(applications)">',1168 '<div class="formInfo">#{msgs.no_entitlements_meet_criteria}</div>',1169 '</tpl>',1170 '<tpl for="applications">',1171 '<span style="font-weight:bold">#{msgs.identity_app_entitlements} {application}</span>',1172 '<table class="dashWidth100" style="margin: 0px 0px 3px 0px;"><tbody>',1173 '<tpl for="attributes">',1174 '<tr><td style="padding:3px; padding-right:5px; text-align:left;" class="title">',1175 '#{msgs.label_value_or_values} #{msgs.on} <span class="entitlementTxt">{name}</span>',1176 '</td></tr>',1177 '<tr><td style="padding:2px; text-align:left; class="wide">',1178 '<div class="entitlementTxt" style="padding-left:20px;">',1179 '<tpl if="showEntitlementDescription">',1180 '<div class="entitlementValues">',1181 '</tpl>',1182 '<tpl if="!showEntitlementDescription">',1183 '<div class="entitlementValues style="display:none">',1184 '</tpl>',1185 '<tpl for="values">',1186 '<span id="name_{valueId}">',1187 '<tpl if="isGroup">',1188// '<span> debug: application is {application} and attribute is {parent.name} and value is {value}</span>',1189 '<span class="unboldFakeLink" onclick="viewAccountGroup(\'{application}\', \'{parent.name}\', \'{value:htmlEncode}\');">',1190 '</tpl>',1191 '<tpl if="!isGroup">',1192 '<span>',1193 '</tpl>',1194 '{displayName:htmlEncode}',1195 '</span>',1196 '<tpl if="xindex &lt; xcount">,&nbsp;</tpl>',1197 '<span class="wordbreak">&#8203;</span><span class="wordbreakIE6"><wbr/></span>',1198 '<tpl if={showInfoIcon}',1199 '<img src="', SailPoint.getRelativeUrl('/images/icons/info.png'), '">',1200 '</tpl>',1201 '</span>',1202 '</tpl>',1203 '</div>',1204 '<div class="entitlementDescriptions" style="display:none">',1205 '<tpl for="values">',1206 '<span id="description_{valueId}" class="entitlementTxt">{description:htmlEncode}</span>',1207 '</tpl>',1208 '</div>',1209 '</td></tr>',1210 '</tpl>',1211 '</tbody></table>',1212 '</tpl>', {1213 isEmpty: function(applications) {1214 return (applications.length === 0);1215 }...

Full Screen

Full Screen

alert.component.ts

Source:alert.component.ts Github

copy

Full Screen

1import { Component, OnInit } from '@angular/core';2import { FieldSets } from 'app/pages/common/entity/entity-form/classes/field-sets';3import { FieldSet } from 'app/pages/common/entity/entity-form/models/fieldset.interface';4import { EntityUtils } from 'app/pages/common/entity/utils';5import { T } from 'app/translate-marker';6import { DialogService, WebSocketService } from '../../../services/';7import { AppLoaderService } from '../../../services/app-loader/app-loader.service';8import { FieldConfig } from '../../common/entity/entity-form/models/field-config.interface';9import { EntityFormService } from '../../common/entity/entity-form/services/entity-form.service';10import * as _ from 'lodash';11import helptext from '../../../helptext/system/alert-settings';12import { CoreService, CoreEvent } from 'app/core/services/core.service';13import { Subject } from 'rxjs';14import { EntityToolbarComponent } from 'app/pages/common/entity/entity-toolbar/entity-toolbar.component';15interface AlertCategory {16 id: string;17 title: string;18 classes: {19 id: string;20 title: string;21 level: string;22 }[];23} 24/**25 * This form is unlike other forms in the app which make use of EntityForm.26 * This component's form config is generated based on a response from the27 * middleware.28 */29@Component({30 selector: 'app-system-alert',31 templateUrl: './alert.component.html',32 styleUrls: ['../../common/entity/entity-form/entity-form.component.scss'],33 providers: [EntityFormService],34})35export class AlertConfigComponent implements OnInit {36 public formEvents: Subject<CoreEvent>;37 protected route_success = ['system', 'alertsettings'];38 protected queryCall = 'alertclasses.config';39 protected editCall = 'alertclasses.update';40 protected isEntity = true;41 public fieldSets: FieldSets;42 public fieldConfig: FieldConfig[] = [];43 protected settingOptions: any = [];44 protected warningOptions: any = [45 {label: "INFO", value: "INFO"},46 {label: "NOTICE", value: "NOTICE"},47 {label: "WARNING", value: "WARNING"},48 {label: "ERROR", value: "ERROR"},49 {label: "CRITICAL", value: "CRITICAL"},50 {label: "ALERT", value: "ALERT"},51 {label: "EMERGENCY", value: "EMERGENCY"},52 ];53 public formGroup: any;54 public settingFormGroup: any;55 public isReady = false;56 protected defaults = [];57 public selectedIndex = 0;58 constructor(59 protected core:CoreService, 60 private ws: WebSocketService,61 private entityFormService: EntityFormService,62 protected loader: AppLoaderService,63 public dialog: DialogService64 ) {}65 async ngOnInit() {66 this.loader.open();67 this.ws.call('alert.list_policies', []).subscribe((res) => {68 for (let i = 0; i < res.length; i++) {69 let label = res[i];70 if (res[i] === "IMMEDIATELY") {71 label = res[i] + ' (Default)';72 }73 this.settingOptions.push({ label: label, value: res[i] });74 }75 }, error => {76 this.loader.close();77 new EntityUtils().handleWSError(this, error, this.dialog);78 });79 80 const sets: FieldSet[] = [];81 const cat = this.ws.call("alert.list_categories").toPromise();82 cat.then(categories => {83 this.addButtons(categories);84 categories.forEach((category, index) => {85 const modulo = index % 2;86 let config = [];87 for (let i = 0; i < category.classes.length; i++) {88 const c = category.classes[i];89 const warningOptions = [];90 for (let j = 0; j < this.warningOptions.length; j++) {91 const option = JSON.parse(JSON.stringify( this.warningOptions[j] )); // apparently this is the proper way to clone an object92 if (option.value === c.level) {93 option.label = option.label + " (Default)";94 }95 warningOptions.push(option);96 }97 config.push({98 type: "select",99 name: c.id + '_level',100 inlineLabel: c.title,101 placeholder: T("Set Warning Level"),102 tooltip: helptext.level_tooltip,103 options: warningOptions,104 value: c.level105 },106 {107 type: "select",108 name: c.id + '_policy',109 inlineLabel: " ",110 placeholder: T("Set Frequency"),111 tooltip: helptext.policy_tooltip,112 options: this.settingOptions,113 value: "IMMEDIATELY"114 });115 this.defaults.push({id: c.id, level: c.level, policy: 'IMMEDIATELY'});116 }117 let fieldSet = {118 name: category.title,119 label: true,120 width: "100%",121 config: config122 }123 124 sets.push(fieldSet);125 });126 this.fieldSets = new FieldSets(sets);127 this.fieldConfig = this.fieldSets.configs();128 this.formGroup = this.entityFormService.createFormGroup(this.fieldConfig);129 this.ws.call(this.queryCall).subscribe((res) => {130 this.loader.close();131 for (const k in res.classes) {132 for (const j in res.classes[k]) {133 const prop = k + '_' + j;134 if (this.formGroup.controls[prop]) {135 this.formGroup.controls[prop].setValue(res.classes[k][j]);136 } else {137 console.log("Missing prop: " + prop); // some properties don't exist between both calls?138 }139 }140 }141 },142 (err) => {143 this.loader.close();144 new EntityUtils().handleWSError(this, err, this.dialog)145 });146 }).catch(error => {147 this.loader.close();148 new EntityUtils().handleWSError(this, error, this.dialog);149 });150 }151 addButtons(categories) {152 let options = [];153 categories.forEach((category, index) => {154 options.push({ label: category.title, value: index });155 });156 this.formEvents = new Subject();157 this.formEvents.subscribe((evt: CoreEvent) => {158 if (evt.data.event_control == 'save') {159 this.onSubmit();160 } else {161 this.selectedIndex = evt.data.category.value;162 }163 });164 // Setup Global Actions165 const actionsConfig = {166 actionType: EntityToolbarComponent,167 actionConfig: {168 target: this.formEvents,169 controls: [170 {171 name: 'save',172 label: 'Save',173 type: 'button',174 color: 'primary',175 },176 {177 name: 'category',178 label: 'Category',179 type: 'menu',180 options: options181 }182 ]183 }184 };185 this.core.emit({name:"GlobalActions", data: actionsConfig, sender: this});186 }187 onSubmit() {188 const payload = { classes: {} };189 for (const key in this.formGroup.value) {190 const key_values = key.split('_');191 const alert_class = key_values[0];192 const class_key = key_values[1];193 const def = _.find(this.defaults, {id: alert_class});194 if (def[class_key].toUpperCase() !== this.formGroup.value[key].toUpperCase()) { // do not submit defaults in the payload195 if(!payload.classes[alert_class]) {196 payload.classes[alert_class] = {};197 }198 payload.classes[alert_class][class_key] = this.formGroup.value[key];199 }200 }201 this.loader.open();202 this.ws.call(this.editCall, [payload])203 .subscribe(204 () => this.dialog.Info(T("Settings saved"), '', '300px', 'info', true),205 error => new EntityUtils().handleWSError(this, error, this.dialog)206 )207 .add(() => this.loader.close());208 }...

Full Screen

Full Screen

notification.service.ts

Source:notification.service.ts Github

copy

Full Screen

1/*-2 * #%L3 * Arcade Analytics4 * %%5 * Copyright (C) 2018 - 2019 ArcadeAnalytics6 * %%7 * Licensed under the Apache License, Version 2.0 (the "License");8 * you may not use this file except in compliance with the License.9 * You may obtain a copy of the License at10 *11 * http://www.apache.org/licenses/LICENSE-2.012 *13 * Unless required by applicable law or agreed to in writing, software14 * distributed under the License is distributed on an "AS IS" BASIS,15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.16 * See the License for the specific language governing permissions and17 * limitations under the License.18 * #L%19 */20import { Injectable } from '@angular/core';21import PNotify from 'pnotify/dist/es/PNotifyCompat';22import PNotifyButtons from 'pnotify/dist/es/PNotifyButtons';23PNotify.defaults.styling = 'brighttheme';24PNotify.defaults.icons = 'brighttheme';25@Injectable({ providedIn: 'root' })26export class NotificationService {27 private warningOptions;28 private infoOptions;29 private successOptions;30 private errorOptions;31 constructor() {32 // tslint:disable-next-line:no-unused-expression33 PNotifyButtons; // Initiate the module. Important!34 this.warningOptions = {35 type: 'warning',36 delay: 5000,37 addclass: 'alert alert-warning alert-styled-right',38 text_escape: false,39 buttons: {40 closer: true,41 closer_hover: true,42 sticker: true,43 sticker_hover: true44 }45 };46 this.infoOptions = {47 type: 'info',48 delay: 5000,49 addclass: 'alert alert-info alert-styled-right',50 text_escape: false,51 buttons: {52 closer: true,53 closer_hover: true,54 sticker: true,55 sticker_hover: true56 }57 };58 this.successOptions = {59 type: 'success',60 delay: 2000,61 addclass: 'alert alert-success alert-styled-right',62 text_escape: false,63 buttons: {64 closer: true,65 closer_hover: true,66 sticker: true,67 sticker_hover: true }68 };69 this.errorOptions = {70 type: 'error',71 delay: 5000,72 addclass: 'alert alert-danger alert-styled-right',73 text_escape: true,74 buttons: {75 closer: true,76 closer_hover: true,77 sticker: true,78 sticker_hover: true79 }80 };81 }82 push(type: string, title: string, text: string, timeout?: number, icon?: string|boolean) {83 let options: Object;84 switch (type) {85 case 'warning':86 options = this.warningOptions;87 break;88 case 'info':89 options = this.infoOptions;90 break;91 case 'success':92 options = this.successOptions;93 break;94 case 'error':95 options = this.errorOptions;96 break;97 default:98 options = this.infoOptions;99 break;100 }101 if (title) {102 options['title'] = title;103 }104 options['text'] = text;105 if (timeout) {106 options['delay'] = timeout;107 }108 if (icon) {109 options['icon'] = icon;110 }111 // notification showing112 const notification = new PNotify(options);113 // console logging114 if (type === 'error') {115 console.error(title + ': ' + text);116 } else {117 console.log(title + ': ' + text);118 }119 return notification;120 }121 updateNotification(notification, type: string, title: string, text: string, timeout?: number, icon?: string|boolean) {122 let options: Object;123 switch (type) {124 case 'warning':125 options = this.warningOptions;126 break;127 case 'info':128 options = this.infoOptions;129 break;130 case 'success':131 options = this.successOptions;132 break;133 case 'error':134 options = this.errorOptions;135 break;136 default:137 options = this.infoOptions;138 break;139 }140 options['title'] = title;141 options['text'] = text;142 if (timeout) {143 options['delay'] = timeout;144 }145 if (icon) {146 options['icon'] = icon;147 }148 this.updateNotificationFromOptions(notification, options);149 }150 updateNotificationFromOptions(notification, options) {151 notification.update(options);152 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1console.log(warningOptions());2console.log(warningOptions());3console.log(warningOptions());4console.log(warningOptions());5console.log(warningOptions());6console.log(warningOptions());7console.log(warningOptions());8console.log(warningOptions());9console.log(warningOptions());10console.log(warningOptions());11console.log(warningOptions());12console.log(warningOptions());13console.log(warningOptions());14console.log(warningOptions());15console.log(warningOptions());16console.log(warningOptions());17console.log(warningOptions());18console.log(warningOptions());19console.log(warningOptions());20console.log(warningOptions());21console.log(warningOptions());22console.log(warningOptions());23console.log(warningOptions());

Full Screen

Using AI Code Generation

copy

Full Screen

1const {warningOptions} = require('stryker-parent');2const {warningOptions} = require('stryker-parent');3const {warningOptions} = require('stryker-parent');4const {warningOptions} = require('stryker-parent');5const {warningOptions} = require('stryker-parent');6const {warningOptions} = require('stryker-parent');7const {warningOptions} = require('stryker-parent');8const {warningOptions} = require('stryker-parent');9const {warningOptions} = require('stryker-parent');10const {warningOptions} = require('stryker-parent');11const {warningOptions} = require('stryker-parent');12const {warningOptions} = require('stryker-parent');13const {warningOptions} = require('stryker-parent');14const {warningOptions} = require('stryker-parent');15const {warningOptions} = require('stryker-parent');16const {warningOptions} = require('stryker-parent');17const {warningOptions} = require('stryker-parent');18const {warningOptions} = require('stryker-parent');

Full Screen

Using AI Code Generation

copy

Full Screen

1module.exports = function(config) {2 config.set({3 warningOptions: {4 }5 });6};7module.exports = function(config) {8 config.set({9 warningOptions: {10 }11 });12};

Full Screen

Using AI Code Generation

copy

Full Screen

1const { warningOptions } = require('stryker-parent');2const options = warningOptions({3});4console.log(options);5module.exports = function(config) {6 config.set({7 testRunnerOptions: {8 }9 });10};11const { warning } = require('stryker-api/logging');12const { validateOptions } = require('stryker-api/core');13const { testRunnerSchema } = require('stryker-parent');14module.exports = function(options) {15 const validatedOptions = validateOptions(options, testRunnerSchema);16 if (validatedOptions.errors.length) {17 warning(validatedOptions.errors);18 }19 return validatedOptions;20};21const { warning } = require('stryker-api/logging');22const { validateOptions } = require('stryker-api/core');23const { testRunnerSchema } = require('stryker-parent');24module.exports = function(options) {25 const validatedOptions = validateOptions(options, testRunnerSchema);26 if (validatedOptions.errors.length) {27 warning(validatedOptions.errors);28 }29 return validatedOptions;30};

Full Screen

Using AI Code Generation

copy

Full Screen

1var warningOptions = require('stryker-parent').warningOptions;2var options = warningOptions({3}, 'test');4var warningOptions = require('stryker').warningOptions;5var options = warningOptions({6}, 'test');7var warningOptions = require('stryker-api').warningOptions;8var options = warningOptions({9}, 'test');10var warningOptions = require('stryker-mocha-runner').warningOptions;11var options = warningOptions({12}, 'test');13var warningOptions = require('stryker-mocha-framework').warningOptions;14var options = warningOptions({15}, 'test');16var warningOptions = require('stryker-mocha-require').warningOptions;17var options = warningOptions({18}, 'test');19var warningOptions = require('stryker-jasmine-runner').warningOptions;20var options = warningOptions({21}, 'test');22var warningOptions = require('stryker-jasmine-framework').warningOptions;23var options = warningOptions({24}, 'test');25var warningOptions = require('stryker-jasmine-require').warningOptions;26var options = warningOptions({27}, 'test');28var warningOptions = require('stryker-karma-runner').warningOptions;29var options = warningOptions({30}, 'test');31var warningOptions = require('stryker-karma-framework').warningOptions;32var options = warningOptions({33}, 'test');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { warningOptions } = require('stryker-parent');2module.exports = function(config) {3 warningOptions(config, {4 });5};6module.exports = function(config) {7 require('./test')(config);8};9module.exports = function(config) {10 require('stryker-parent').warningOptions(config, {11 });12};13Type Description string A string value. If the value is not a string, the option is invalid. boolean A boolean value. If the value is not a boolean, the option is invalid. number A number value. If the value is not a number, the option is invalid. object An object value. If the value is not an object, the option is invalid. array An array value. If the value is not an array, the option is invalid. function A function value. If the value is not a function, the option is invalid. regexp A regular expression value. If the value is not a regular expression, the option is invalid. oneOf A value that is one of the provided values. The value is invalid if it is not one of the provided values. The provided values are provided as an array. For example, oneOf:['a','b']. The value is invalid if it is not 'a' or 'b'. oneOfChild A value that is one of the provided values. The value is invalid if it is not one of the provided values. The provided values are provided as an object. For example, oneOfChild:{ a: 'a', b: 'b' }. The value is invalid if it is not 'a' or 'b'. Not all of the provided values need to be used. The value is valid if it is one of the provided values. The key of the object is the name of the option and the value is the type of the option. For example, oneOf

Full Screen

Using AI Code Generation

copy

Full Screen

1const {warningOptions} = require('stryker-parent');2warningOptions();3const {warningOptions} = require('stryker-parent');4warningOptions();5const {warningOptions} = require('stryker-parent');6warningOptions();7const {warningOptions} = require('stryker-parent');8warningOptions();9const {warningOptions} = require('stryker-parent');10warningOptions();11const {warningOptions} = require('stryker-parent');12warningOptions();13const {warningOptions} = require('stryker-parent');14warningOptions();15const {warningOptions} = require('stryker-parent');16warningOptions();17const {warningOptions} = require('stryker-parent');18warningOptions();19const {warningOptions} = require('stryker-parent');20warningOptions();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { warningOptions } = require('stryker-parent');2const config = warningOptions({3});4module.exports = config;518:12:37 (10844) INFO ConfigReader Loaded config stryker.conf.js618:12:37 (10844) INFO Stryker 3.3.1 (mutation testing framework for JavaScript) initialized718:12:37 (10844) INFO Stryker 3.3.1 (mutation testing framework for JavaScript) initialized818:12:37 (10844) INFO ConcurrencyTokenProvider Creating 1 test runners (based on CPU count)918:12:37 (10844) INFO SandboxPool Creating 1 test runners (based on CPU count)1018:12:37 (10844) INFO MutationTestExecutor 1 Mutant(s) generated1118:12:37 (10844) INFO DryRunExecutor 1 Mutant

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run stryker-parent automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful