X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=sdnr%2Fwireless-transport%2Fcode-Carbon-SR1%2Fapps%2Fdlux%2Fdlux-web%2Fsrc%2Fapp%2Fcore%2Fcore.services.js;fp=sdnr%2Fwireless-transport%2Fcode-Carbon-SR1%2Fapps%2Fdlux%2Fdlux-web%2Fsrc%2Fapp%2Fcore%2Fcore.services.js;h=0000000000000000000000000000000000000000;hb=1c1e7f98416875f3ee78af9103865c32f95a82a0;hp=d7e24fd408ca1fb06c915dbe38aa63e6c7069f7c;hpb=6a893bb0ae984d15076394d9225d4873ad953791;p=ccsdk%2Fapps.git diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/dlux/dlux-web/src/app/core/core.services.js b/sdnr/wireless-transport/code-Carbon-SR1/apps/dlux/dlux-web/src/app/core/core.services.js deleted file mode 100644 index d7e24fd4..00000000 --- a/sdnr/wireless-transport/code-Carbon-SR1/apps/dlux/dlux-web/src/app/core/core.services.js +++ /dev/null @@ -1,181 +0,0 @@ -define(['jquery'], function ($) { - 'use strict'; - - var TopBarHelper = function () { - var ids = []; - var ctrls = []; - - this.addToView = function (url) { - $.ajax({ - url: url, - method: 'GET', - async: false - }).done(function (data) { - ids.push(data); - }); - }; - - this.getViews = function () { - var template = ''; - - for (var i = 0; i < ids.length; ++i) { - template += ids[i]; - } - - return template; - }; - - this.addControllerUrl = function (url) { - ctrls.push(url); - }; - - this.getControllers = function () { - return ctrls; - }; - - this.$get = ['apiToken', function (apiToken) { - return new TopBarHelper(apiToken); - }]; - }; - - var NavHelper = function () { - var ids = []; - var ctrls = []; - var menu = []; - - function NavHelperProvider() { - this.addToView = function (url) { - $.ajax({ - url: url, - method: 'GET', - async: false - }).done(function (data) { - ids.push(data); - }); - }; - - this.getViews = function () { - var template = ''; - - for (var i = 0; i < ids.length; ++i) { - template += ids[i]; - } - - return template; - }; - - this.addControllerUrl = function (url) { - ctrls.push(url); - }; - - this.getControllers = function () { - return ctrls; - }; - - var getMenuWithId = function (menu, level) { - if (menu === undefined) { - return null; - } - var currentLevel = level[0]; - - var menuItem = $.grep(menu, function (item) { - return item.id === currentLevel; - })[0]; - - if (level.length === 1) { - return menuItem; - } else { - return getMenuWithId(menuItem.submenu, level.slice(1)); - } - }; - - this.addToMenu = function (id, obj) { - var lvl = id.split('.'); - obj.id = lvl.pop(); - - if (lvl.length === 0) { - menu.push(obj); - } else { - var menuItem = getMenuWithId(menu, lvl); - - if (menuItem) { - if (!menuItem.submenu) { - menuItem.submenu = []; - } - menuItem.submenu.push(obj); - } else { - var submenu = { - 'id': lvl[0], - 'title': lvl[0], - 'active': '', - 'submenu': [obj] - }; - menu.push(submenu); - } - } - }; - - this.getMenu = function () { - return menu; - }; - - this.$get = function NavHelperFactory() { - return new NavHelperProvider(); - }; - } - var persistentProvider = new NavHelperProvider(); - - return persistentProvider; - - }; - - var ContentHelper = function () { - var ids = []; - var ctrls = []; - - function ContentHelperProvider() { - this.addToView = function (url) { - $.ajax({ - url: url, - method: 'GET', - async: false - }).done(function (data) { - ids.push(data); - }); - }; - - this.getViews = function () { - var template = ''; - - for (var i = 0; i < ids.length; ++i) { - template += ids[i]; - } - - return template; - }; - - this.addControllerUrl = function (url) { - ctrls.push(url); - }; - - this.getControllers = function () { - return ctrls; - }; - - this.$get = function ContentHelperFactory() { - return new ContentHelperProvider(); - }; - } - var persistentProvider = new ContentHelperProvider(); - - return persistentProvider; - - }; - - return { - ContentHelper: ContentHelper, - NavHelper: NavHelper, - TopBarHelper: TopBarHelper - }; - -});