694 lines
34 KiB
JavaScript
694 lines
34 KiB
JavaScript
"use strict";
|
|
(function () {
|
|
'use strict';
|
|
angular.module('myitsmApp', ['ui.router',
|
|
'ui.map',
|
|
'ui.bootstrap',
|
|
'ui.bootstrap-custom',
|
|
'colorpicker.module',
|
|
'ngResource',
|
|
'ngCookies',
|
|
'ngSanitize',
|
|
'ngGrid',
|
|
'ngCkeditor',
|
|
'nvd3ChartDirectives',
|
|
'LocalStorageModule',
|
|
'securityModule',
|
|
'adminModule',
|
|
'userModule',
|
|
'feedModule',
|
|
'dashboardModule',
|
|
'chartModule',
|
|
'ticketModule',
|
|
'searchModule',
|
|
'i18nModule',
|
|
'l10nModule',
|
|
'resourceModule',
|
|
'serviceRequestModule',
|
|
'bmcSystemAlert',
|
|
'personModule',
|
|
'assetModule',
|
|
'createTicketModule',
|
|
'knowledgeArticleModule',
|
|
'knowledgeTeamModule',
|
|
'smartRecorderModule',
|
|
'graphModule',
|
|
'feedModule',
|
|
'templateModule',
|
|
'srdModule',
|
|
'locationModule',
|
|
'changeModule',
|
|
'releaseModule',
|
|
'headerNavigationModule',
|
|
'consoleModule',
|
|
'createProblemModule',
|
|
'mcsmModule',
|
|
'layoutConfigModule',
|
|
'customWidgetsModule',
|
|
'dibari.angular-ellipsis'
|
|
]).constant('DOCSLINK', {
|
|
VERSION: 'Smart IT 1902',
|
|
CUSTOM_FIELDS: 'https://docs.bmc.com/docs/display/smartIT1902/Adding+custom+fields+to+your+views+using+Smart+IT',
|
|
EXPRESSION: 'https://docs.bmc.com/docs/display/smartit1902/Configuration+details+of+expression'
|
|
});
|
|
angular.module('i18nModule', []);
|
|
angular.module('l10nModule', []);
|
|
angular.module('securityModule', []);
|
|
angular.module('adminModule', ['ui.sortable']);
|
|
angular.module('dashboardModule', []);
|
|
angular.module('chartModule', []);
|
|
angular.module('userModule', []);
|
|
angular.module('feedModule', []);
|
|
angular.module('ticketModule', []);
|
|
angular.module('searchModule', []);
|
|
angular.module('resourceModule', []);
|
|
angular.module('serviceRequestModule', []);
|
|
angular.module('personModule', []);
|
|
angular.module('graphModule', []);
|
|
angular.module('assetModule', []);
|
|
angular.module('bmcSystemAlert', ['ui.bootstrap']);
|
|
angular.module('createTicketModule', []);
|
|
angular.module('knowledgeArticleModule', []);
|
|
angular.module('knowledgeTeamModule', []);
|
|
angular.module('smartRecorderModule', []);
|
|
angular.module('feedModule', []);
|
|
angular.module('templateModule', []);
|
|
angular.module('srdModule', []);
|
|
angular.module('locationModule', []);
|
|
angular.module('changeModule', ['daypilot']);
|
|
angular.module('releaseModule', []);
|
|
angular.module('headerNavigationModule', []);
|
|
angular.module('consoleModule', []);
|
|
angular.module('createProblemModule', []);
|
|
angular.module('mcsmModule', []);
|
|
angular.module('layoutConfigModule', []);
|
|
angular.module('customWidgetsModule', []);
|
|
angular.module('myitsmApp')
|
|
.config(['$stateProvider', '$urlRouterProvider', 'roles', '$provide', '$logProvider', 'topicLoggerProvider', 'queryStringParser',
|
|
function ($stateProvider, $urlRouterProvider, roles, $provide, $logProvider, topicLoggerProvider, queryStringParser) {
|
|
// Toggling angular $log.debug messages based on query string parameter
|
|
var queryString = window.location.search, queryParams;
|
|
if (queryString.charAt(queryString.length - 1) === '/') {
|
|
queryString = queryString.substring(0, queryString.length - 1);
|
|
}
|
|
queryParams = queryStringParser.parse(queryString);
|
|
$logProvider.debugEnabled(queryParams.debug === '2');
|
|
if (queryParams.debug && queryParams.debugTopic) {
|
|
queryParams.debugTopic.split(',').forEach(function (topic) {
|
|
topicLoggerProvider.addTopic(topic);
|
|
}, this);
|
|
}
|
|
// expose a provider to reach debugEnabled in $log
|
|
$provide.value('$logProvider', $logProvider);
|
|
$provide.value('topicLoggerProvider', topicLoggerProvider);
|
|
$urlRouterProvider.otherwise('/');
|
|
$stateProvider
|
|
.state('unauthorized', {
|
|
url: '/unauthorized',
|
|
templateUrl: 'views/unauthorized.html',
|
|
access: [],
|
|
controller: ['$scope', 'permissionModel', function ($scope, permissionModel) {
|
|
$scope.isAdminOnlyPersona = permissionModel.hasAdminOnlyRole();
|
|
}]
|
|
})
|
|
.state('dashboard', {
|
|
url: '^/',
|
|
templateUrl: 'views/dashboard/index.html',
|
|
controller: 'DashboardController',
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE, roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('ticketConsole', {
|
|
url: '/ticket-console',
|
|
template: '<console class="ticket-console" console-type="ticket" default-filters="" default-criteria="" display-metric="true" display-filter="true"></console>',
|
|
params: {
|
|
refreshMetadata: false
|
|
},
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE]
|
|
})
|
|
.state('knowledgeConsole', {
|
|
url: '/knowledge-console',
|
|
template: '<console class="ticket-console" console-type="knowledge" default-filters="" default-criteria="" display-metric="true" display-filter="true"></console>',
|
|
access: [roles.ITSM_KNOWLEDGE_USER_ROLE]
|
|
})
|
|
.state('assetConsole', {
|
|
url: '/asset-console',
|
|
template: '<console class="ticket-console" console-type="asset" default-filters="" default-criteria="" display-metric="false" display-filter="true"></console>',
|
|
access: [roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('knowledge', {
|
|
url: '/knowledge/:id',
|
|
templateUrl: 'views/knowledge-article/knowledge-article-profile.html',
|
|
controller: 'KnowledgeArticleProfileController',
|
|
params: {
|
|
id: null,
|
|
editMode: false,
|
|
content: null,
|
|
preventIncrement: null,
|
|
assessMode: false
|
|
},
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE, roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('knowledgeLatest', {
|
|
url: '/knowledge/:version/:id',
|
|
templateUrl: 'views/knowledge-article/knowledge-article-profile.html',
|
|
controller: 'KnowledgeArticleProfileController',
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE, roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('search', {
|
|
url: '/search/{searchText:.*}',
|
|
templateUrl: 'views/search/search-content.html',
|
|
controller: 'SearchController',
|
|
params: {
|
|
searchCriteria: null
|
|
},
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE, roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('search.task', {
|
|
template: '<div preview-task="{{selectedItem.id}}" class="full-height" is-full-version="false"></div>',
|
|
access: []
|
|
})
|
|
.state('search.knowledge', {
|
|
template: '<div preview-knowledge-article="{{selectedItem.id}}" class="full-height" is-full-version="false"></div>',
|
|
access: []
|
|
})
|
|
.state('search.asset', {
|
|
template: '<div preview-asset={{assetIdsObject}} display-menu="true" class="full-height" is-full-version="false"></div>',
|
|
access: []
|
|
})
|
|
.state('search.person', {
|
|
template: '<div preview-person="{{selectedItem.id}}" display-menu="false" class="full-height" is-full-version="false"></div>',
|
|
access: []
|
|
})
|
|
.state('search.workorder', {
|
|
template: '<div preview-work-order="{{selectedItem.id}}" class="full-height" is-full-version="false"></div>',
|
|
access: []
|
|
})
|
|
.state('search.request', {
|
|
template: '<div preview-service-request="{{selectedItem.id}}" class="full-height" is-full-version="false"></div>',
|
|
access: []
|
|
})
|
|
.state('search.sberequest', {
|
|
template: '<div preview-sbe-request="{{selectedItem.id}}" class="full-height" is-full-version="false"></div>',
|
|
access: []
|
|
})
|
|
.state('search.incident', {
|
|
template: '<div preview-incident="{{selectedItem.id}}" class="full-height" is-full-version="false"></div>',
|
|
access: []
|
|
})
|
|
.state('search.change', {
|
|
template: '<div preview-change-request="{{selectedItem.id}}" class="full-height" is-full-version="false"></div>',
|
|
access: []
|
|
})
|
|
.state('search.release', {
|
|
template: '<div preview-release="{{selectedItem.id}}" class="full-height" is-full-version="false"></div>',
|
|
access: []
|
|
})
|
|
.state('search.activity', {
|
|
template: '<div preview-activity="{{selectedItem.id}}" class="full-height" is-full-version="false"></div>',
|
|
access: []
|
|
})
|
|
.state('search.problem', {
|
|
template: '<div preview-problem="{{selectedItem.id}}" class="full-height" is-full-version="false"></div>',
|
|
access: []
|
|
})
|
|
.state('search.knownerror', {
|
|
template: '<div preview-known-error="{{selectedItem.id}}" class="full-height" is-full-version="false"></div>',
|
|
access: []
|
|
})
|
|
.state('person', {
|
|
url: '/person/:id',
|
|
templateUrl: 'views/person/person-profile.html',
|
|
controller: 'PersonProfileController',
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE, roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('asset', {
|
|
url: '/asset/:assetId/:assetClassId',
|
|
templateUrl: 'views/asset/asset-profile.html',
|
|
controller: 'AssetProfileController',
|
|
data: {
|
|
history: { type: 'assets', label: 'asset' }
|
|
},
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_ADMIN_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE, roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('assetCiExplorer', {
|
|
abstract: true,
|
|
url: '/asset/:assetId/:assetClassId',
|
|
templateUrl: 'views/asset/ci-explorer.html',
|
|
controller: 'AssetController',
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE, roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('assetCiExplorer.list', {
|
|
url: '/list-ci',
|
|
templateUrl: 'views/asset/list-ci-explorer.html',
|
|
controller: 'AssetListCiExplorerController',
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE, roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('assetCiExplorer.graphical', {
|
|
url: '/graphical-ci',
|
|
templateUrl: 'views/asset/graphical-ci-explorer.html',
|
|
controller: 'AssetGraphicalCiExplorerController',
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE, roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('createIncident', {
|
|
url: '/create/incident',
|
|
templateUrl: 'views/create/create-incident-v2.html',
|
|
controller: 'CreateIncidentV2Controller',
|
|
access: [roles.ITSM_AGENT_ROLE]
|
|
})
|
|
.state('createKnowledge', {
|
|
url: '/create/knowledge',
|
|
templateUrl: 'views/create/create-ka.html',
|
|
controller: 'CreateKnowledgeArticleController',
|
|
access: [roles.ITSM_KNOWLEDGE_USER_ROLE]
|
|
})
|
|
.state('createAqiQuestions', {
|
|
url: '/create/aqiQuestions',
|
|
templateUrl: 'views/create/aqi-question-sets.html',
|
|
controller: 'createAqiController',
|
|
access: [roles.ITSM_KCS_COACH_ROLE]
|
|
})
|
|
.state('createChange', {
|
|
url: '/create/change',
|
|
template: '<ui-view></ui-view>',
|
|
controller: 'CreateChangeV2Controller',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('createChange.selector', {
|
|
url: '/',
|
|
templateUrl: 'views/change/create-change-selector.html',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('createChange.wizard', {
|
|
url: '/',
|
|
template: '<change-wizard></change-wizard>',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('createChange.wizard.calendar', {
|
|
url: '',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE],
|
|
template: '<calendar></calendar>'
|
|
})
|
|
.state('createChange.wizard.calendar.book', {
|
|
url: '',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE],
|
|
template: '<calendar-book-view></calendar-book-view>'
|
|
})
|
|
.state('createChange.wizard.calendar.day', {
|
|
url: '',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE],
|
|
template: '<calendar-view id="calendarDayView" view-type="Day"></calendar-view>'
|
|
})
|
|
.state('createChange.wizard.calendar.week', {
|
|
url: '',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE],
|
|
template: '<calendar-month-view id="calendarWeekView" view-type="Weeks"></calendar-month-view>'
|
|
})
|
|
.state('createChange.wizard.calendar.month', {
|
|
url: '',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE],
|
|
template: '<calendar-month-view id="calendarMonthView" view-type="Month"></calendar-month-view>'
|
|
})
|
|
.state('changeEditCollisions', {
|
|
url: '/change/:id/collisions',
|
|
templateUrl: 'views/change/edit-dates.html',
|
|
controller: 'EditDatesController',
|
|
data: {
|
|
editMode: true
|
|
},
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('changeEditCollisions.calendar', {
|
|
url: '',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE],
|
|
template: '<calendar></calendar>'
|
|
})
|
|
.state('changeEditCollisions.calendar.book', {
|
|
url: '',
|
|
template: '<calendar-book-view></calendar-book-view>',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('changeEditCollisions.calendar.day', {
|
|
url: '',
|
|
template: '<calendar-view id="calendarDayView" view-type="Day"></calendar-view>',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('changeEditCollisions.calendar.week', {
|
|
url: '',
|
|
template: '<calendar-month-view id="calendarWeekView" view-type="Weeks"></calendar-month-view>',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('changeEditCollisions.calendar.month', {
|
|
url: '',
|
|
template: '<calendar-month-view id="calendarMonthView" view-type="Month"></calendar-month-view>',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('changeEditDates', {
|
|
url: '/change/:id/dates',
|
|
templateUrl: 'views/change/edit-dates.html',
|
|
controller: 'EditDatesController',
|
|
data: {
|
|
editMode: false
|
|
},
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('changeEditDates.calendar', {
|
|
url: '',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE],
|
|
template: '<calendar></calendar>'
|
|
})
|
|
.state('changeEditDates.calendar.book', {
|
|
url: '',
|
|
template: '<calendar-book-view></calendar-book-view>',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('changeEditDates.calendar.day', {
|
|
url: '',
|
|
template: '<calendar-view id="calendarDayView" view-type="Day"></calendar-view>',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('changeEditDates.calendar.week', {
|
|
url: '',
|
|
template: '<calendar-month-view id="calendarWeekView" view-type="Weeks"></calendar-month-view>',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('changeEditDates.calendar.month', {
|
|
url: '',
|
|
template: '<calendar-month-view id="calendarMonthView" view-type="Month"></calendar-month-view>',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('impactGraph', {
|
|
url: '/:type/:id/impactGraph',
|
|
templateUrl: 'views/change/impact-simulator.html',
|
|
controller: 'ImpactAnalysisController',
|
|
params: {
|
|
id: null,
|
|
type: null,
|
|
displayId: null
|
|
},
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('createRelease', {
|
|
url: '/create/release',
|
|
template: '<ui-view></ui-view>',
|
|
controller: 'CreateReleaseController',
|
|
access: [roles.ITSM_RELEASE_USER_ROLE]
|
|
})
|
|
.state('createRelease.selector', {
|
|
url: '/',
|
|
templateUrl: 'views/release/create-release-selector.html',
|
|
access: [roles.ITSM_RELEASE_USER_ROLE]
|
|
})
|
|
.state('createRelease.wizard', {
|
|
url: '/',
|
|
template: '<release-wizard></release-wizard>',
|
|
access: [roles.ITSM_RELEASE_USER_ROLE]
|
|
})
|
|
.state('createActivity', {
|
|
url: '/create/activity',
|
|
templateUrl: 'views/create/create-activity.html',
|
|
controller: 'CreateActivityController',
|
|
access: [roles.ITSM_RELEASE_USER_ROLE]
|
|
})
|
|
.state('smartRecorder', {
|
|
url: '/create/smart-recorder?customer&contact&desc',
|
|
templateUrl: 'views/smart-recorder/smart-recorder.html',
|
|
controller: 'SmartRecorderController',
|
|
access: [roles.ITSM_AGENT_ROLE]
|
|
})
|
|
.state('screenConfiguration', {
|
|
url: '/admin/screen-configuration',
|
|
templateUrl: 'views/admin/screen-configuration/screen-configuration.html',
|
|
controller: 'ScreenConfigurationController',
|
|
access: [roles.ITSM_ADMIN_ROLE]
|
|
}).state('adminConsoleConfig', {
|
|
url: '/admin/admin-console-configuration',
|
|
templateUrl: 'views/admin/console-config/admin-console-configuration.html',
|
|
controller: 'AdminConsoleConfigurationController',
|
|
access: [roles.ITSM_ADMIN_ROLE]
|
|
})
|
|
.state('knowledgeStyleConfiguration', {
|
|
url: '/admin/knowledge-style-configuration',
|
|
templateUrl: 'views/admin/knowledge-style-configuration/knowledge-style-config.html',
|
|
controller: 'KnowledgeStyleConfigController',
|
|
access: [roles.ITSM_ADMIN_ROLE]
|
|
})
|
|
.state('knowledgeTeam', {
|
|
url: '/knowledgeTeam',
|
|
templateUrl: 'views/knowledge-team/knowledge-team-profile.html',
|
|
controller: 'KnowledgeTeamController',
|
|
access: [roles.ITSM_KCS_COACH_ROLE]
|
|
})
|
|
.state('createTask', {
|
|
url: '/create/task',
|
|
templateUrl: 'views/create/create-task-v2.html',
|
|
controller: 'CreateTaskV2Controller',
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE]
|
|
})
|
|
.state('draftIncident', {
|
|
url: '/draft-incident',
|
|
templateUrl: 'views/ticket/profiles/draft-incident-profile.html',
|
|
controller: 'DraftTicketController',
|
|
access: [roles.ITSM_AGENT_ROLE]
|
|
})
|
|
.state('draftChange', {
|
|
url: '/draft-change/:id',
|
|
templateUrl: 'views/ticket/profiles/draft-change-profile.html',
|
|
controller: 'DraftTicketController',
|
|
params: {
|
|
isCopyChange: false,
|
|
copyChangeId: null,
|
|
ticket: null,
|
|
hasRelatedCis: false
|
|
},
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('draftWorkorder', {
|
|
url: '/draft-workorder',
|
|
templateUrl: 'views/ticket/profiles/draft-workorder-profile.html',
|
|
controller: 'DraftTicketController',
|
|
access: [roles.ITSM_AGENT_ROLE]
|
|
})
|
|
.state('draftServicerequest', {
|
|
url: '/draft-request',
|
|
templateUrl: 'views/ticket/profiles/draft-service-request-profile.html',
|
|
controller: 'DraftTicketController',
|
|
access: [roles.ITSM_AGENT_ROLE]
|
|
})
|
|
.state('draftProblem', {
|
|
url: '/draft-problem',
|
|
templateUrl: 'views/ticket/profiles/draft-problem-profile.html',
|
|
controller: 'DraftTicketController',
|
|
access: [roles.ITSM_PROBLEM_USER_ROLE]
|
|
})
|
|
.state('draftKnownerror', {
|
|
url: '/draft-knownerror',
|
|
templateUrl: 'views/ticket/profiles/draft-knownerror-profile.html',
|
|
controller: 'DraftTicketController',
|
|
access: [roles.ITSM_PROBLEM_USER_ROLE]
|
|
})
|
|
.state('incident', {
|
|
url: '/incident/:id',
|
|
templateUrl: 'views/ticket/profiles/incident-profile.html',
|
|
controller: 'TicketProfileController',
|
|
access: [roles.ITSM_AGENT_ROLE]
|
|
})
|
|
.state('workorder', {
|
|
url: '/workorder/:id',
|
|
templateUrl: 'views/ticket/profiles/workorder-profile.html',
|
|
controller: 'TicketProfileController',
|
|
access: [roles.ITSM_AGENT_ROLE]
|
|
})
|
|
.state('task', {
|
|
url: '/task/:id',
|
|
templateUrl: 'views/ticket/profiles/task-profile.html',
|
|
controller: 'TicketProfileController',
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE]
|
|
})
|
|
.state('request', {
|
|
url: '/request/:id',
|
|
templateUrl: 'views/ticket/profiles/service-request-profile.html',
|
|
controller: 'TicketProfileController',
|
|
access: [roles.ITSM_AGENT_ROLE]
|
|
})
|
|
.state('outage', {
|
|
url: '/outage/:id',
|
|
templateUrl: 'views/ticket/ticket-profile.html',
|
|
controller: 'TicketProfileController',
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE]
|
|
})
|
|
.state('createWorkorder', {
|
|
url: '/create/workorder',
|
|
templateUrl: 'views/create/create-work-order-v2.html',
|
|
controller: 'CreateWorkOrderV2Controller',
|
|
access: [roles.ITSM_AGENT_ROLE]
|
|
})
|
|
.state('createBroadcast', {
|
|
url: '/create/broadcast',
|
|
templateUrl: 'views/create/create-broadcast.html',
|
|
controller: 'CreateBroadcastController',
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE, roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('createAsset', {
|
|
url: '/create/asset',
|
|
templateUrl: 'views/create/create-asset.html',
|
|
controller: 'CreateAssetController',
|
|
access: [roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('conversationsHistory', {
|
|
url: '/conversations',
|
|
templateUrl: 'views/chat/history.html',
|
|
controller: 'ChatHistoryController',
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE, roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('change', {
|
|
url: '/change/:id',
|
|
templateUrl: 'views/ticket/profiles/change-profile.html',
|
|
controller: 'TicketProfileController',
|
|
access: [roles.ITSM_CHANGE_USER_ROLE]
|
|
})
|
|
.state('release', {
|
|
url: '/release/:id',
|
|
templateUrl: 'views/ticket/profiles/release-profile.html',
|
|
controller: 'TicketProfileController',
|
|
access: [roles.ITSM_RELEASE_USER_ROLE]
|
|
})
|
|
.state('activity', {
|
|
url: '/activity/:id',
|
|
templateUrl: 'views/ticket/profiles/activity-profile.html',
|
|
controller: 'TicketProfileController',
|
|
access: [roles.ITSM_RELEASE_USER_ROLE]
|
|
})
|
|
.state('knownerror', {
|
|
url: '/knownerror/:id',
|
|
templateUrl: 'views/ticket/profiles/known-error-profile.html',
|
|
controller: 'TicketProfileController',
|
|
access: [roles.ITSM_PROBLEM_USER_ROLE]
|
|
})
|
|
.state('createKnownerror', {
|
|
url: '/create/knownerror',
|
|
templateUrl: 'views/known-error/create-known-error.html',
|
|
controller: 'CreateKnownErrorController',
|
|
access: [roles.ITSM_PROBLEM_USER_ROLE]
|
|
})
|
|
.state('createProblem', {
|
|
url: '/create/problem',
|
|
templateUrl: 'views/problem/create-problem.html',
|
|
controller: 'CreateProblemController',
|
|
access: [roles.ITSM_PROBLEM_USER_ROLE]
|
|
})
|
|
.state('problem', {
|
|
url: '/problem/:id',
|
|
templateUrl: 'views/ticket/profiles/problem-profile.html',
|
|
controller: 'TicketProfileController',
|
|
access: [roles.ITSM_PROBLEM_USER_ROLE]
|
|
})
|
|
.state('location', {
|
|
url: '/location/:id',
|
|
template: '<div class="location-map full-height"><div loading-spinner if="state.loadingMap" centered="true" overlay="true"></div><location-map class="full-height"></location-map></div>',
|
|
controller: 'LocationMapController',
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE]
|
|
})
|
|
.state('chatPopupWindow', {
|
|
url: '/chatPopupWindow',
|
|
template: "<div> <loading-spinner if='!chatWindow' centered='true' overlay='true'></loading-spinner>" +
|
|
"<chat-window is-popup-window='true' chat-room='chatWindow' ng-if='chatWindow'></chat-window> </div>",
|
|
controller: 'ChatPopupWindowController',
|
|
data: { separateWindowMode: true },
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE, roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('EmailPopupWindow', {
|
|
url: '/emailPopupWindow',
|
|
template: "<div> <loading-spinner if='!emailInstance' centered='true' overlay='true'></loading-spinner>" +
|
|
"<email-window email-instance='emailInstance' is-popup-window='true' ng-if='emailInstance'></email-window> </div>",
|
|
controller: 'EmailPopupWindowController',
|
|
data: { separateWindowMode: true },
|
|
access: [roles.ITSM_AGENT_ROLE, roles.ITSM_CHANGE_USER_ROLE, roles.ITSM_KNOWLEDGE_USER_ROLE, roles.ITSM_PROBLEM_USER_ROLE, roles.ITSM_ASSET_USER_ROLE]
|
|
})
|
|
.state('dlp', {
|
|
url: '/dlp/:id',
|
|
templateUrl: 'views/ticket/profiles/data-loss-prevention-profile.html',
|
|
controller: 'dataLossPreventionProfileController',
|
|
access: [roles.ITSM_AGENT_ROLE]
|
|
})
|
|
.state('sberequest', {
|
|
url: '/sberequest/:id',
|
|
templateUrl: 'views/ticket/profiles/sbe-request-profile.html',
|
|
controller: 'TicketProfileController',
|
|
access: [roles.ITSM_SBE_USER_ROLE]
|
|
})
|
|
.state('healthcheck', {
|
|
url: '/healthcheck',
|
|
templateUrl: 'views/admin/health-check/health-check.html',
|
|
controller: 'MonitorController as ctrl',
|
|
access: [roles.ITSM_ADMIN_ROLE]
|
|
});
|
|
}
|
|
])
|
|
// console.debug log level is inconsistent between Chrome/Chromium versions.
|
|
// Currently console.debug requires verbose level. And special setting for console tab in devtools
|
|
// Fix this in Angular way
|
|
.decorator('$log', ['$logProvider', 'topicLoggerProvider', '$delegate', function ($logProvider, topicLoggerProvider, $delegate) {
|
|
// override $log.debug
|
|
$delegate.debug = function () {
|
|
if (!$logProvider.debugEnabled()) {
|
|
return;
|
|
}
|
|
$delegate.log.apply($delegate, arguments);
|
|
};
|
|
$delegate.topic = function () {
|
|
var args = Array.prototype.slice.call(arguments);
|
|
if (!topicLoggerProvider.includesTopic(args[0])) {
|
|
return;
|
|
}
|
|
$delegate.info.apply($delegate, args.slice(1, args.length));
|
|
};
|
|
return $delegate;
|
|
}])
|
|
.run(['$rootScope', '$state', '$location', 'authModel', 'AUTH_EVENTS', 'i18nService', '$q', 'roles', 'permissionModel', '$locale', 'customLocale', '$modalStack', 'DOCSLINK',
|
|
function ($rootScope, $state, $location, authModel, AUTH_EVENTS, i18nService, $q, roles, permissionModel, $locale, customLocale, $modalStack, DOCSLINK) {
|
|
$rootScope.docsLink = DOCSLINK;
|
|
$rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState) {
|
|
//console.log("fromState: " + (fromState && fromState.name) + "; toState: " + (toState && toState.name));
|
|
//START fix to close the modal on browser back button click or keyboard backspace
|
|
//this is a known issue with angular-ui bootstrap modal
|
|
var top = $modalStack.getTop();
|
|
if (top && !(top.value && top.value.modalScope && top.value.modalScope.modalOptions)) {
|
|
$modalStack.dismiss(top.key);
|
|
}
|
|
//END fix
|
|
var authPromise = authModel.isAuthenticated() ? $q.when(1) : authModel.checkSessionStatus();
|
|
authPromise.then(function () {
|
|
if (!authModel.isAuthorized(toState.access)) {
|
|
event.preventDefault();
|
|
if (authModel.isAuthenticated()) {
|
|
//This check should be done To prevent double redirects for admin-only users(from dashboard to unauthorized)
|
|
if (permissionModel.hasAdminOnlyRole()) {
|
|
//This will be true only when user logs in or reloads the page
|
|
if (toState.name === 'dashboard' && !fromState) {
|
|
$state.go('screenConfiguration');
|
|
}
|
|
else {
|
|
$rootScope.$broadcast(AUTH_EVENTS.NOT_AUTHORIZED);
|
|
}
|
|
}
|
|
else {
|
|
// user is not allowed to access this state
|
|
$rootScope.$broadcast(AUTH_EVENTS.NOT_AUTHORIZED);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
/*$rootScope.$on(AUTH_EVENTS.SESSION_ACTIVE, function () {
|
|
console.log("$rootScope.$on(AUTH_EVENTS.SESSION_ACTIVE)");
|
|
$state.go('dashboard');
|
|
});*/
|
|
$rootScope.$on(AUTH_EVENTS.NOT_AUTHORIZED, function () {
|
|
console.log('$rootScope.$on(AUTH_EVENTS.NOT_AUTHORIZED)');
|
|
$state.go('unauthorized');
|
|
});
|
|
angular.merge($locale, customLocale);
|
|
}
|
|
]);
|
|
})();
|