From 632f3ca56781931e112ebac430ca6a0549ca6ba3 Mon Sep 17 00:00:00 2001 From: Ken Hoes Date: Fri, 18 Mar 2016 15:22:41 -0400 Subject: [PATCH] More route work and directive --- awx/ui/client/src/helpers/Hosts.js | 8 ++++--- .../manage/inventory-manage.partial.html | 5 ++--- awx/ui/client/src/inventories/manage/main.js | 10 ++++----- .../inventories/manage/manage-hosts/main.js | 13 +++++++++++ .../manage-hosts/manage-hosts.controller.js | 12 +++++----- .../manage-hosts/manage-hosts.directive.js | 6 ++--- .../manage/manage-hosts/manage-hosts.route.js | 22 +++++++++++++------ awx/ui/client/src/shared/Utilities.js | 18 ++++++++++++++- 8 files changed, 67 insertions(+), 27 deletions(-) create mode 100644 awx/ui/client/src/inventories/manage/manage-hosts/main.js diff --git a/awx/ui/client/src/helpers/Hosts.js b/awx/ui/client/src/helpers/Hosts.js index f55b1199d2..1e4e22bec7 100644 --- a/awx/ui/client/src/helpers/Hosts.js +++ b/awx/ui/client/src/helpers/Hosts.js @@ -437,12 +437,14 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name, .factory('HostsEdit', ['$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'HostForm', 'GenerateForm', 'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'ParseTypeChange', 'Wait', 'Find', 'SetStatus', 'ApplyEllipsis', - 'ToJSON', 'ParseVariableString', 'CreateDialog', 'TextareaResize', + 'ToJSON', 'ParseVariableString', 'CreateDialog', 'TextareaResize', 'ScopePass', function($rootScope, $location, $log, $stateParams, Rest, Alert, HostForm, GenerateForm, Prompt, ProcessErrors, GetBasePath, HostsReload, ParseTypeChange, Wait, Find, SetStatus, ApplyEllipsis, ToJSON, - ParseVariableString, CreateDialog, TextareaResize) { + ParseVariableString, CreateDialog, TextareaResize, ScopePass) { return function(params) { - + ScopePass.set(params); + var passing = ScopePass.get(); + console.info(passing); var parent_scope = params.host_scope, group_scope = params.group_scope, host_id = params.host_id, diff --git a/awx/ui/client/src/inventories/manage/inventory-manage.partial.html b/awx/ui/client/src/inventories/manage/inventory-manage.partial.html index 816f2fb040..c04eb31552 100644 --- a/awx/ui/client/src/inventories/manage/inventory-manage.partial.html +++ b/awx/ui/client/src/inventories/manage/inventory-manage.partial.html @@ -1,7 +1,6 @@
- -
In the ui view - +
+
diff --git a/awx/ui/client/src/inventories/manage/main.js b/awx/ui/client/src/inventories/manage/main.js index 14bcb8a5e5..c33658777f 100644 --- a/awx/ui/client/src/inventories/manage/main.js +++ b/awx/ui/client/src/inventories/manage/main.js @@ -11,9 +11,9 @@ import manageHostsDirective from './manage-hosts/manage-hosts.directive'; import manageHostsRoute from './manage-hosts/manage-hosts.route'; export default - angular.module('inventoryManage', []) +angular.module('inventoryManage', []) .directive('manageHosts', manageHostsDirective) - .run(['$stateExtender', function($stateExtender) { - $stateExtender.addState(route); - $stateExtender.addState(manageHostsRoute); - }]); + .run(['$stateExtender', function($stateExtender) { + $stateExtender.addState(route); + $stateExtender.addState(manageHostsRoute); + }]); diff --git a/awx/ui/client/src/inventories/manage/manage-hosts/main.js b/awx/ui/client/src/inventories/manage/manage-hosts/main.js new file mode 100644 index 0000000000..3815d1bc98 --- /dev/null +++ b/awx/ui/client/src/inventories/manage/manage-hosts/main.js @@ -0,0 +1,13 @@ +/************************************************* + * Copyright (c) 2015 Ansible, Inc. + * + * All Rights Reserved + *************************************************/ + +import route from './manage-hosts.route'; + +export default + angular.module('manageHosts', []) + .run(['$stateExtender', function($stateExtender) { + $stateExtender.addState(route); + }]); diff --git a/awx/ui/client/src/inventories/manage/manage-hosts/manage-hosts.controller.js b/awx/ui/client/src/inventories/manage/manage-hosts/manage-hosts.controller.js index 01dda998c1..3f38abfaaf 100644 --- a/awx/ui/client/src/inventories/manage/manage-hosts/manage-hosts.controller.js +++ b/awx/ui/client/src/inventories/manage/manage-hosts/manage-hosts.controller.js @@ -5,16 +5,18 @@ *************************************************/ function manageHostDirectiveController($q, $rootScope, $scope, $state, - $stateParams, $compile, Rest, ProcessErrors, + $stateParams, $compile, ScopePass, Rest, ProcessErrors, CreateDialog, GetBasePath, Wait, GenerateList, GroupList, SearchInit, PaginateInit, GetRootGroups) { - var vm = this; + var vm = this; + console.info(ScopePass); - }; +}; export default ['$q', '$rootScope', '$scope', '$state', '$stateParams', - 'ScopePass', '$compile', 'Rest', 'ProcessErrors', 'CreateDialog', + 'ScopePass', '$compile', 'ScopePass', 'Rest', 'ProcessErrors', 'CreateDialog', 'GetBasePath', 'Wait', 'generateList', 'GroupList', 'SearchInit', - 'PaginateInit', 'GetRootGroups', manageHostDirectiveController + 'PaginateInit', 'GetRootGroups', + manageHostDirectiveController ]; diff --git a/awx/ui/client/src/inventories/manage/manage-hosts/manage-hosts.directive.js b/awx/ui/client/src/inventories/manage/manage-hosts/manage-hosts.directive.js index 531e965ee9..734d043019 100644 --- a/awx/ui/client/src/inventories/manage/manage-hosts/manage-hosts.directive.js +++ b/awx/ui/client/src/inventories/manage/manage-hosts/manage-hosts.directive.js @@ -17,9 +17,9 @@ export default ['templateUrl', link: function(scope, element, attrs) { }, - // controller: manageHostsController, - // controllerAs: 'vm', - // bindToController: true + controller: manageHostsController, + controllerAs: 'vm', + bindToController: true }; } ]; diff --git a/awx/ui/client/src/inventories/manage/manage-hosts/manage-hosts.route.js b/awx/ui/client/src/inventories/manage/manage-hosts/manage-hosts.route.js index c8de0182be..ec9679fccb 100644 --- a/awx/ui/client/src/inventories/manage/manage-hosts/manage-hosts.route.js +++ b/awx/ui/client/src/inventories/manage/manage-hosts/manage-hosts.route.js @@ -4,23 +4,31 @@ * All Rights Reserved *************************************************/ -import { - templateUrl -} from '../../../shared/template-url/template-url.factory'; +// import { +// templateUrl +// } from '../../../shared/template-url/template-url.factory'; + +import manageHostDirectiveController from './manage-hosts.controller' export default { name: 'inventoryManage.manageHosts', route: '/managehosts', - template: 'SOMETHING', + //template: '
SOMETHING
', + views: { + "manage@inventoryManage" : { + template: '
the template from route
' + } + }, // data: { // activityStream: true, // activityStreamTarget: 'inventory', // activityStreamId: 'inventory_id' // }, - // ncyBreadcrumb: { - // label: "INVENTORY MANAGE" - // }, + ncyBreadcrumb: { + label: "INVENTORY MANAGE" + }, + controller: manageHostDirectiveController, // resolve: { // features: ['FeaturesService', function(FeaturesService) { // return FeaturesService.get(); diff --git a/awx/ui/client/src/shared/Utilities.js b/awx/ui/client/src/shared/Utilities.js index 434526cd7d..3190bb775e 100644 --- a/awx/ui/client/src/shared/Utilities.js +++ b/awx/ui/client/src/shared/Utilities.js @@ -871,4 +871,20 @@ angular.module('Utilities', ['RestServices', 'Utilities', 'sanitizeFilter']) }; } -]); +]) +.factory('ScopePass', function() { + var savedData = {} + + function set(data) { + savedData = data; + } + + function get() { + return savedData; + } + + return { + set: set, + get: get + } +});