//require('./provider/stateRuntimeProvider'); require('./directives/scope-controller-runtime-state'); // async function test(ccsServiceNtt) { // let result = await ccsServiceNtt.getNttCCS(); // console.log("##########################\n"+result); // } // (function(orig) { // angular.modules = []; // angular.module = function() { // if (arguments.length > 1) { // angular.modules.push(arguments[0]); // } // return orig.apply(null, arguments); // } // })(angular.module); // angular.module('myitsmApp')['_invokeQueue'].forEach(function(x){ // if(x[2][0]=="MainController") // console.log(x[2][0]) // }); // window.onhashchange = function() { // prevURL = currentURL; // currentURL = window.location.href; // console.log('Previous URL:', prevURL); // console.log('Current URL:', currentURL); // } // angular.module('myitsmApp').provider('runtimeStates',['$stateProvider',function($stateProvider) { // // runtime dependencies for the service can be injected here, at the provider.$get() function. // this.$get = function($q, $timeout, $state) { // for example // return { // addState: function(name, state) { // $stateProvider.state(name, state); // } // } // } // }]); angular.module('myitsmApp').provider('stateFakeProvider', ['$stateProvider','roles', function($stateProvider,roles) { if(ntt.smartit.api.preloadConfigs["routeModifier"] && ntt.smartit.api.preloadConfigs["routeModifier"].length > 0) { let newStates = _.filter(ntt.smartit.api.preloadConfigs["routeModifier"], function(item) { if(item.mode == "add") return true; }); newStates.forEach(tmpState => { tmpState.data.access=eval(tmpState.data.access); $stateProvider.state(tmpState.identifier, tmpState.data); }); } var stateOld = $stateProvider.state; $stateProvider.state = function () { let skip = false; let args = arguments; if(ntt.smartit.api.preloadConfigs["routeModifier"] && ntt.smartit.api.preloadConfigs["routeModifier"].length > 0) { let args = arguments; let found = _.find(ntt.smartit.api.preloadConfigs["routeModifier"], function(item) { if(item.identifier === args[0] || item.identifier === args[1].name) return true; }); if(found) { switch(found.mode) { case "override": if(found.data.access) found.data.access = eval(found.data.access); args[0] = found.data.name; args[1] = found.data; break; case "delete": skip=true; break; default: break; } } } if(!skip) stateOld.apply(stateOld, args); return this; } // runtime dependencies for the service can be injected here, at the provider.$get() function. this.$get = function() { // fake Provider only used to override stateProvider state function return { state: $stateProvider.state } } }]); // angular.module('myitsmApp') // .config(['$stateProvider','roles', function($stateProvider, roles) { // // $stateProvider.state("ticketConsoleStudioPV", { // // name: 'ticketConsoleStudioPV', // // url: '/ticket-consoleStudio', // // controller: 'PwaTicketController', // // data: { // // pageTitle: 'common.labels.incident', // // formName: 'ASF:OverviewConsole/SV_Console', // // targetForm: 'ASF:OverviewConsole', // // targetView: 'SV_Console', // // mode: 'GET' // // }, // // access: [roles.ITSM_AGENT_ROLE] // // }); // // $stateProvider.state("TicketConsolePV", { // // name: 'TicketConsolePV', // // url: '/ASFOverviewConsole', // // controller: 'PwaTicketController', // // data: { // // pageTitle: 'common.labels.incident', // // formName: 'ASF:OverviewConsole/SV_Console', // // targetForm: 'ASF:OverviewConsole', // // targetView: 'SV_Console', // // mode: 'GET' // // }, // // access: [roles.ITSM_AGENT_ROLE] // // }); // }]); // angular.module("myitsmApp").run(["$rootScope", "ccsServiceNtt","$state","ccsModel","$q", function ($rootScope, ccsServiceNtt, $state, ccsModel, $q) { // // test(ccsServiceNtt); // //$state.get("ticketConsoleStudio").url="TEST"; // // let result = ccsServiceNtt.getNttCCS().then(function(result) { // // var x = 0; // // }) // // var x = 0; // // async function test() { // // let result = await ccsServiceNtt.getNttCCS(); // // console.log("##########################\n"+result); // // var x = 0; // // } // // test(); // // $stateProvider.state("TicketConsolePV", { // // name: 'TicketConsolePV', // // url: '/ASFOverviewConsole', // // controller: 'PwaTicketController', // // data: { // // pageTitle: 'common.labels.incident', // // formName: 'ASF:OverviewConsole/SV_Console', // // targetForm: 'ASF:OverviewConsole', // // targetView: 'SV_Console', // // mode: 'GET' // // }, // // access: [roles.ITSM_AGENT_ROLE] // // }); // // var APP_STATES = { // // INDETERMINATE: -1, // // SHOW_LOGIN: 0, // // SHOW_MAIN: 1, // // SHOW_WINDOW: 2 // // }, ANCHORS = { // // DashBoardWithHash: '#/', // // 'Ticket Console': 'ticket-consoleStudio', // // 'Asset Console': 'asset-consoleStudio', // // 'Knowledge Console': 'knowledge-console', // // 'Smart Recorder': 'create/smart-recorder', // // 'Calendar': 'calendarStudio' // // }; // // $rootScope.$on('auth-login-success', function (event, params) { // // console.log('$scope.$on(AUTH_EVENTS.LOGIN_SUCCESS)'); // // event.preventDefault(); // // event.stopPropagation(); // // var $scope = event.currentScope; // // var promises = []; // // if (ANCHORS.DashBoardWithHash === window.location.hash) { // // promises.push(ccsModel.getCCSParameters()); // // if (localStorage.midtierUrl && !params.isSsoEnabled && localStorage.getItem('overridePV') !== 'T') { // // promises.push($scope.homeServerDefer.promise); // // } // // $q.all(promises).then(function (response) { // // $scope.ccsProperties = response[0]; // // if ($scope.ccsProperties && $scope.ccsProperties.landingPage && ANCHORS[$scope.ccsProperties.landingPage]) { // // if (ANCHORS[$scope.ccsProperties.landingPage] === 'calendar' && $scope.ccsProperties.calendarFeatureEnabled // // && $scope.ccsProperties.calendarFeatureEnabled.trim() === 'false') { // // console.log('Landing page :: Dashboard. calendarFeatureEnabled :' + $scope.ccsProperties.calendarFeatureEnabled); // // } // // else { // // console.log('Landing page :: Diverting to === ' + ANCHORS[$scope.ccsProperties.landingPage]); // // if ($scope.isMobile) { // // window.location.hash = ANCHORS['Ticket Console']; // // } // // else { // // window.location.hash = ANCHORS[$scope.ccsProperties.landingPage]; // // } // // } // // } // // if (!params.isSsoEnabled) { // // window.location.reload(false); // // } // // else if (session.alive) { // // console.info('location hash : session alive'); // // $scope.sendMessageToPwaDomain({ isSsoEnabled: params.isSsoEnabled }); // // sessionActiveCallback(); // // if ($scope.isMobile) { // // window.location.hash = ANCHORS['Ticket Console']; // // } // // } // // }); // // } // // else { // // if (!params.isSsoEnabled) { // // localStorage.midtierUrl ? promises.push($scope.homeServerDefer.promise) : promises.push(Promise.resolve()); // // $q.all(promises).then(function () { // // window.location.reload(false); // // }); // // } // // else if (session.alive) { // // console.info('session alive'); // // $scope.sendMessageToPwaDomain({ isSsoEnabled: params.isSsoEnabled }); // // sessionActiveCallback(); // // } // // } // // }); // // // $rootScope.$on('auth-login-success', function (event, params) { // // // window.location.hash="ASFOverviewConsole"; // // // }); // //ccsServiceNtt.getNttCCS().then(function(result) { // /////////EW // // var state = $state.get('ticketConsoleStudio'); // // state.name="ticketConsoleStudioPV" // // state.data = { // // pageTitle: 'common.labels.incident', // // formName: 'ASF:OverviewConsole/SV_Console', // // targetForm: 'ASF:OverviewConsole', // // targetView: 'SV_Console', // // mode: 'GET' // // } // // }); // // $stateProvider.state("ticketConsoleStudioPV", { // // name: 'ticketConsoleStudioPV', // // url: '/ticket-consoleStudio', // // controller: 'PwaTicketController', // // data: { // // pageTitle: 'common.labels.incident', // // formName: 'ASF:OverviewConsole/SV_Console', // // targetForm: 'ASF:OverviewConsole', // // targetView: 'SV_Console', // // mode: 'GET' // // }, // // access: [roles.ITSM_AGENT_ROLE] // // }); // // $rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState) { // // event.preventDefault(); // // // if(toState.name=="ticketConsole" || toState.name=="ticketConsoleStudio") { // // // $state.go("TicketConsolePV", toParams, {location: 'replace'}); // // // } // // //debugger; // // }); // }]); export class routeModifier extends ntt.smartit.api.ICustomModule { name() { return "routeModifier"; } preloadConfig() { return "/config/modStates.json"; } injectTemplates() { return { "views/main.html": [{ id:"routeModifier-controller", method: "add", mode: "partial", type: "jquery", selector: function($jqueryTemplate) { return $jqueryTemplate.find("div")[0]; }, snippet: '', }] } } injectDynTemplates() { return {} } templates() { return [] } i18nLocales() { return {} } } ntt.smartit.api.nttSmartitModules.push(new routeModifier());