mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 19:07:36 -02:30
cloneDeep list config and add additional ignored field params
This commit is contained in:
@@ -20,7 +20,7 @@ import './lists';
|
|||||||
import './widgets';
|
import './widgets';
|
||||||
import './help';
|
import './help';
|
||||||
import './filters';
|
import './filters';
|
||||||
import {Home, HomeGroups, HomeHosts} from './controllers/Home';
|
import {Home, HomeGroups} from './controllers/Home';
|
||||||
import {SocketsController} from './controllers/Sockets';
|
import {SocketsController} from './controllers/Sockets';
|
||||||
import {CredentialsAdd, CredentialsEdit, CredentialsList} from './controllers/Credentials';
|
import {CredentialsAdd, CredentialsEdit, CredentialsList} from './controllers/Credentials';
|
||||||
import {JobsListController} from './controllers/Jobs';
|
import {JobsListController} from './controllers/Jobs';
|
||||||
@@ -175,7 +175,6 @@ var tower = angular.module('Tower', [
|
|||||||
'CredentialsHelper',
|
'CredentialsHelper',
|
||||||
'StreamListDefinition',
|
'StreamListDefinition',
|
||||||
'HomeGroupListDefinition',
|
'HomeGroupListDefinition',
|
||||||
'HomeHostListDefinition',
|
|
||||||
'ActivityDetailDefinition',
|
'ActivityDetailDefinition',
|
||||||
'VariablesHelper',
|
'VariablesHelper',
|
||||||
'SchedulesListDefinition',
|
'SchedulesListDefinition',
|
||||||
@@ -269,25 +268,6 @@ var tower = angular.module('Tower', [
|
|||||||
}
|
}
|
||||||
}).
|
}).
|
||||||
|
|
||||||
state('dashboardHosts', {
|
|
||||||
url: '/home/hosts?has_active_failures&name&id',
|
|
||||||
templateUrl: urlPrefix + 'partials/subhome.html',
|
|
||||||
controller: HomeHosts,
|
|
||||||
data: {
|
|
||||||
activityStream: true,
|
|
||||||
activityStreamTarget: 'host'
|
|
||||||
},
|
|
||||||
ncyBreadcrumb: {
|
|
||||||
parent: 'dashboard',
|
|
||||||
label: "HOSTS"
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
features: ['FeaturesService', function(FeaturesService) {
|
|
||||||
return FeaturesService.get();
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}).
|
|
||||||
|
|
||||||
state('jobs', {
|
state('jobs', {
|
||||||
url: '/jobs',
|
url: '/jobs',
|
||||||
templateUrl: urlPrefix + 'partials/jobs.html',
|
templateUrl: urlPrefix + 'partials/jobs.html',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*************************************************
|
/*************************************************
|
||||||
* Copyright (c) 2015 Ansible, Inc.
|
* Copyright (c) 2016 Ansible, Inc.
|
||||||
*
|
*
|
||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
@@ -155,7 +155,6 @@ export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $locatio
|
|||||||
|
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
|
|
||||||
var generator = GenerateList,
|
var generator = GenerateList,
|
||||||
list = HomeGroupList,
|
list = HomeGroupList,
|
||||||
defaultUrl = GetBasePath('groups'),
|
defaultUrl = GetBasePath('groups'),
|
||||||
@@ -517,112 +516,3 @@ HomeGroups.$inject = ['$rootScope', '$log', '$scope', '$filter', '$compile', '$l
|
|||||||
* @description This loads the page for 'home/hosts'
|
* @description This loads the page for 'home/hosts'
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function HomeHosts($scope, $location, $stateParams, HomeHostList, GenerateList, ProcessErrors, ReturnToCaller, ClearScope,
|
|
||||||
GetBasePath, SearchInit, PaginateInit, FormatDate, SetStatus, ToggleHostEnabled, HostsEdit, Find, ShowJobSummary) {
|
|
||||||
|
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
|
||||||
//scope.
|
|
||||||
|
|
||||||
var generator = GenerateList,
|
|
||||||
list = HomeHostList,
|
|
||||||
defaultUrl = GetBasePath('hosts');
|
|
||||||
|
|
||||||
if ($scope.removePostRefresh) {
|
|
||||||
$scope.removePostRefresh();
|
|
||||||
}
|
|
||||||
$scope.removePostRefresh = $scope.$on('PostRefresh', function () {
|
|
||||||
for (var i = 0; i < $scope.hosts.length; i++) {
|
|
||||||
$scope.hosts[i].inventory_name = $scope.hosts[i].summary_fields.inventory.name;
|
|
||||||
//SetHostStatus($scope['hosts'][i]);
|
|
||||||
SetStatus({
|
|
||||||
$scope: $scope,
|
|
||||||
host: $scope.hosts[i]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
generator.inject(list, { mode: 'edit', scope: $scope });
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
SearchInit({
|
|
||||||
scope: $scope,
|
|
||||||
set: 'hosts',
|
|
||||||
list: list,
|
|
||||||
url: defaultUrl
|
|
||||||
});
|
|
||||||
|
|
||||||
PaginateInit({
|
|
||||||
scope: $scope,
|
|
||||||
list: list,
|
|
||||||
url: defaultUrl
|
|
||||||
});
|
|
||||||
|
|
||||||
// Process search params
|
|
||||||
if ($stateParams.name) {
|
|
||||||
$scope[HomeHostList.iterator + 'InputDisable'] = false;
|
|
||||||
$scope[HomeHostList.iterator + 'SearchValue'] = $stateParams.name;
|
|
||||||
$scope[HomeHostList.iterator + 'SearchField'] = 'name';
|
|
||||||
$scope[HomeHostList.iterator + 'SearchFieldLabel'] = list.fields.name.label;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($stateParams.id) {
|
|
||||||
$scope[HomeHostList.iterator + 'InputDisable'] = false;
|
|
||||||
$scope[HomeHostList.iterator + 'SearchValue'] = $stateParams.id;
|
|
||||||
$scope[HomeHostList.iterator + 'SearchField'] = 'id';
|
|
||||||
$scope[HomeHostList.iterator + 'SearchFieldLabel'] = list.fields.id.label;
|
|
||||||
$scope[HomeHostList.iterator + 'SearchSelectValue'] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($stateParams.has_active_failures) {
|
|
||||||
$scope[HomeHostList.iterator + 'InputDisable'] = true;
|
|
||||||
$scope[HomeHostList.iterator + 'SearchValue'] = $stateParams.has_active_failures;
|
|
||||||
$scope[HomeHostList.iterator + 'SearchField'] = 'has_active_failures';
|
|
||||||
$scope[HomeHostList.iterator + 'SearchFieldLabel'] = HomeHostList.fields.has_active_failures.label;
|
|
||||||
$scope[HomeHostList.iterator + 'SearchSelectValue'] = ($stateParams.has_active_failures === 'true') ? { value: 1 } : { value: 0 };
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.search(list.iterator);
|
|
||||||
|
|
||||||
$scope.refreshHosts = function() {
|
|
||||||
$scope.search(list.iterator);
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.toggleHostEnabled = function (id, sources) {
|
|
||||||
ToggleHostEnabled({
|
|
||||||
host_id: id,
|
|
||||||
external_source: sources,
|
|
||||||
host_scope: $scope
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.editHost = function (host_id) {
|
|
||||||
var host = Find({
|
|
||||||
list: $scope.hosts,
|
|
||||||
key: 'id',
|
|
||||||
val: host_id
|
|
||||||
});
|
|
||||||
if (host) {
|
|
||||||
HostsEdit({
|
|
||||||
host_scope: $scope,
|
|
||||||
host_id: host_id,
|
|
||||||
inventory_id: host.inventory,
|
|
||||||
group_id: null,
|
|
||||||
hostsReload: false,
|
|
||||||
mode: 'edit'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.showJobSummary = function (job_id) {
|
|
||||||
ShowJobSummary({
|
|
||||||
job_id: job_id
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
HomeHosts.$inject = ['$scope', '$location', '$stateParams', 'HomeHostList', 'generateList', 'ProcessErrors', 'ReturnToCaller',
|
|
||||||
'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'SetStatus', 'ToggleHostEnabled', 'HostsEdit',
|
|
||||||
'Find', 'ShowJobSummary'
|
|
||||||
];
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams,
|
|||||||
mode = (base === 'projects') ? 'edit' : 'select',
|
mode = (base === 'projects') ? 'edit' : 'select',
|
||||||
url = (base === 'teams') ? GetBasePath('teams') + $stateParams.team_id + '/projects/' : defaultUrl,
|
url = (base === 'teams') ? GetBasePath('teams') + $stateParams.team_id + '/projects/' : defaultUrl,
|
||||||
choiceCount = 0;
|
choiceCount = 0;
|
||||||
|
|
||||||
view.inject(list, { mode: mode, scope: $scope });
|
view.inject(list, { mode: mode, scope: $scope });
|
||||||
|
|
||||||
$rootScope.flashMessage = null;
|
$rootScope.flashMessage = null;
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import dashboardCounts from './counts/main';
|
|||||||
import dashboardGraphs from './graphs/main';
|
import dashboardGraphs from './graphs/main';
|
||||||
import dashboardLists from './lists/main';
|
import dashboardLists from './lists/main';
|
||||||
import dashboardDirective from './dashboard.directive';
|
import dashboardDirective from './dashboard.directive';
|
||||||
|
import dashboardHosts from './hosts/main';
|
||||||
|
|
||||||
export default
|
export default
|
||||||
angular.module('dashboard', [dashboardCounts.name, dashboardGraphs.name, dashboardLists.name])
|
angular.module('dashboard', [dashboardHosts.name, dashboardCounts.name, dashboardGraphs.name, dashboardLists.name])
|
||||||
.directive('dashboard', dashboardDirective);
|
.directive('dashboard', dashboardDirective);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import AllJobs from "./lists/AllJobs";
|
|||||||
import Credentials from "./lists/Credentials";
|
import Credentials from "./lists/Credentials";
|
||||||
import Groups from "./lists/Groups";
|
import Groups from "./lists/Groups";
|
||||||
import HomeGroups from "./lists/HomeGroups";
|
import HomeGroups from "./lists/HomeGroups";
|
||||||
import HomeHosts from "./lists/HomeHosts";
|
|
||||||
import Hosts from "./lists/Hosts";
|
import Hosts from "./lists/Hosts";
|
||||||
import Inventories from "./lists/Inventories";
|
import Inventories from "./lists/Inventories";
|
||||||
import InventoryGroups from "./lists/InventoryGroups";
|
import InventoryGroups from "./lists/InventoryGroups";
|
||||||
@@ -39,7 +38,6 @@ export
|
|||||||
Credentials,
|
Credentials,
|
||||||
Groups,
|
Groups,
|
||||||
HomeGroups,
|
HomeGroups,
|
||||||
HomeHosts,
|
|
||||||
Hosts,
|
Hosts,
|
||||||
Inventories,
|
Inventories,
|
||||||
InventoryGroups,
|
InventoryGroups,
|
||||||
|
|||||||
@@ -1,103 +0,0 @@
|
|||||||
/*************************************************
|
|
||||||
* Copyright (c) 2015 Ansible, Inc.
|
|
||||||
*
|
|
||||||
* All Rights Reserved
|
|
||||||
*************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
export default
|
|
||||||
angular.module('HomeHostListDefinition', [])
|
|
||||||
.value('HomeHostList', {
|
|
||||||
|
|
||||||
name: 'hosts',
|
|
||||||
iterator: 'host',
|
|
||||||
selectTitle: 'Add Existing Hosts',
|
|
||||||
editTitle: 'Hosts',
|
|
||||||
listTitle: 'Hosts',
|
|
||||||
index: false,
|
|
||||||
hover: true,
|
|
||||||
well: true,
|
|
||||||
|
|
||||||
fields: {
|
|
||||||
status: {
|
|
||||||
label: "",
|
|
||||||
iconOnly: true,
|
|
||||||
icon: "{{ 'icon-job-' + host.active_failures }}",
|
|
||||||
awToolTip: "{{ host.badgeToolTip }}",
|
|
||||||
awTipPlacement: "right",
|
|
||||||
dataPlacement: "right",
|
|
||||||
awPopOver: "{{ host.job_status_html }}",
|
|
||||||
ngClick:"bob",
|
|
||||||
columnClass: "List-staticColumn--smallStatus",
|
|
||||||
searchable: false,
|
|
||||||
nosort: true
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
key: true,
|
|
||||||
label: 'Name',
|
|
||||||
columnClass: 'col-lg-5 col-md-5 col-sm-5 col-xs-8 ellipsis List-staticColumnAdjacent',
|
|
||||||
ngClass: "{ 'host-disabled-label': !host.enabled }",
|
|
||||||
ngClick: "editHost(host.id)"
|
|
||||||
},
|
|
||||||
inventory_name: {
|
|
||||||
label: 'Inventory',
|
|
||||||
sourceModel: 'inventory',
|
|
||||||
sourceField: 'name',
|
|
||||||
columnClass: 'col-lg-5 col-md-4 col-sm-4 hidden-xs elllipsis',
|
|
||||||
linkTo: "{{ '/#/inventories/' + host.inventory }}"
|
|
||||||
},
|
|
||||||
enabled: {
|
|
||||||
label: 'Disabled?',
|
|
||||||
searchSingleValue: true,
|
|
||||||
searchType: 'boolean',
|
|
||||||
searchValue: 'false',
|
|
||||||
searchOnly: true
|
|
||||||
},
|
|
||||||
has_active_failures: {
|
|
||||||
label: 'Has failed jobs?',
|
|
||||||
searchSingleValue: true,
|
|
||||||
searchType: 'boolean',
|
|
||||||
searchValue: 'true',
|
|
||||||
searchOnly: true
|
|
||||||
},
|
|
||||||
has_inventory_sources: {
|
|
||||||
label: 'Has external source?',
|
|
||||||
searchSingleValue: true,
|
|
||||||
searchType: 'boolean',
|
|
||||||
searchValue: 'true',
|
|
||||||
searchOnly: true
|
|
||||||
},
|
|
||||||
id: {
|
|
||||||
label: 'ID',
|
|
||||||
searchOnly: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
fieldActions: {
|
|
||||||
|
|
||||||
columnClass: 'col-lg-2 col-md-3 col-sm-3 col-xs-4',
|
|
||||||
|
|
||||||
/*active_failures: {
|
|
||||||
//label: 'Job Status',
|
|
||||||
//ngHref: "\{\{'/#/hosts/' + host.id + '/job_host_summaries/?inventory=' + inventory_id \}\}",
|
|
||||||
awPopOver: "{{ host.job_status_html }}",
|
|
||||||
dataTitle: "{{ host.job_status_title }}",
|
|
||||||
awToolTip: "{{ host.badgeToolTip }}",
|
|
||||||
awTipPlacement: 'top',
|
|
||||||
dataPlacement: 'left',
|
|
||||||
iconClass: "{{ 'fa icon-failures-' + host.has_active_failures }}"
|
|
||||||
}*/
|
|
||||||
edit: {
|
|
||||||
label: 'Edit',
|
|
||||||
ngClick: "editHost(host.id)",
|
|
||||||
icon: 'icon-edit',
|
|
||||||
awToolTip: 'Edit host',
|
|
||||||
dataPlacement: 'top'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
actions: {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
@@ -1,16 +1,21 @@
|
|||||||
export default ['GetBasePath', function(GetBasePath) {
|
export default ['GetBasePath', function(GetBasePath) {
|
||||||
// given the list, return the fields that need searching
|
// given the list, return the fields that need searching
|
||||||
this.getList = function(list) {
|
this.getList = function(list) {
|
||||||
var f = _.clone(list.fields);
|
var f = _.cloneDeep(list.fields);
|
||||||
return JSON.stringify(Object
|
return JSON.stringify(Object
|
||||||
.keys(f)
|
.keys(f)
|
||||||
.filter(function(i) {
|
.filter(function(i) {
|
||||||
return (f[i]
|
return (f[i]
|
||||||
.searchable !== false);
|
.searchable !== false);
|
||||||
}).map(function(i) {
|
}).map(function(i) {
|
||||||
|
// delete any fields which might include AngularJS interpolation tags {{ }}
|
||||||
delete f[i].awToolTip;
|
delete f[i].awToolTip;
|
||||||
|
delete f[i].awPopover;
|
||||||
|
delete f[i].linkTo;
|
||||||
|
delete f[i].dataTitle;
|
||||||
delete f[i].ngClass;
|
delete f[i].ngClass;
|
||||||
delete f[i].ngClick;
|
delete f[i].ngClick;
|
||||||
|
delete f[i].icon;
|
||||||
return {[i]: f[i]};
|
return {[i]: f[i]};
|
||||||
}).reduce(function (acc, i) {
|
}).reduce(function (acc, i) {
|
||||||
var key = Object.keys(i);
|
var key = Object.keys(i);
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
export default ['$scope', 'Refresh', 'tagSearchService',
|
export default ['$scope', 'Refresh', 'tagSearchService',
|
||||||
function($scope, Refresh, tagSearchService) {
|
function($scope, Refresh, tagSearchService) {
|
||||||
// JSONify passed field elements that can be searched
|
// JSONify passed field elements that can be searched
|
||||||
$scope.list = JSON.parse($scope.list);
|
console.log($scope.list)
|
||||||
|
$scope.list = angular.fromJson($scope.list);
|
||||||
// Access config lines from list spec
|
// Access config lines from list spec
|
||||||
$scope.listConfig = $scope.$parent.list;
|
$scope.listConfig = $scope.$parent.list;
|
||||||
// Grab options for the left-dropdown of the searchbar
|
// Grab options for the left-dropdown of the searchbar
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', '$log', fu
|
|||||||
obj.value = value;
|
obj.value = value;
|
||||||
obj.label = label;
|
obj.label = label;
|
||||||
obj.type = type;
|
obj.type = type;
|
||||||
|
obj.basePath = field['basePath'] || null;
|
||||||
|
|
||||||
|
|
||||||
// return the built option
|
// return the built option
|
||||||
if (type === 'select') {
|
if (type === 'select') {
|
||||||
@@ -79,7 +78,7 @@ export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', '$log', fu
|
|||||||
|
|
||||||
if (needsRequest.length) {
|
if (needsRequest.length) {
|
||||||
// make the options request to reutrn the typeOptions
|
// make the options request to reutrn the typeOptions
|
||||||
Rest.setUrl(needsRequest[0].basePath ? needsRequest[0].basePath : basePath);
|
Rest.setUrl(needsRequest[0].basePath ? GetBasePath(needsRequest[0].basePath) : basePath);
|
||||||
Rest.options()
|
Rest.options()
|
||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user