mirror of
https://github.com/ansible/awx.git
synced 2026-05-18 06:47:41 -02:30
Adding insights routes and files
This commit is contained in:
57
awx/ui/client/src/inventories/insights/insights.block.less
Normal file
57
awx/ui/client/src/inventories/insights/insights.block.less
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
@import "../../shared/branding/colors.default.less";
|
||||||
|
|
||||||
|
.InsightsNav{
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
border: 1px solid #B7B7B7;
|
||||||
|
border-radius:5px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.InsightsNav-rightSide{
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
flex: 1 0 auto;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 10px 0px 10px 0px
|
||||||
|
}
|
||||||
|
|
||||||
|
.InsightsNav-leftSide{
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
flex: 1 0 auto;
|
||||||
|
justify-content: flex-end;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.InsightsNav-totalIssues{
|
||||||
|
background-color: @default-link;
|
||||||
|
color: @default-bg;
|
||||||
|
}
|
||||||
|
|
||||||
|
.InsightsNav-criticalIssues{
|
||||||
|
background-color: @default-err;
|
||||||
|
}
|
||||||
|
|
||||||
|
.InsightsNav-highIssues{
|
||||||
|
background-color:@default-warning;
|
||||||
|
}
|
||||||
|
|
||||||
|
.InsightsNav-mediumIssues{
|
||||||
|
background-color: @default-succ;
|
||||||
|
}
|
||||||
|
|
||||||
|
.InsightsNav-lowIssues{
|
||||||
|
background-color: @default-succ;
|
||||||
|
}
|
||||||
|
|
||||||
|
.InsightsNav-solvableBadge{
|
||||||
|
background-color: @b7grey;
|
||||||
|
}
|
||||||
|
.InsightsNav-solvableBadge:last-of-type{
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
/*************************************************
|
||||||
|
* Copyright (c) 2017 Ansible, Inc.
|
||||||
|
*
|
||||||
|
* All Rights Reserved
|
||||||
|
*************************************************/
|
||||||
|
|
||||||
|
export default ['$scope', 'Facts', 'ParseTypeChange', 'ParseVariableString',
|
||||||
|
function ($scope, Facts, ParseTypeChange, ParseVariableString) {
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
// $scope.insights
|
||||||
|
}
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
}];
|
||||||
20
awx/ui/client/src/inventories/insights/insights.partial.html
Normal file
20
awx/ui/client/src/inventories/insights/insights.partial.html
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<div class="InsightsNav">
|
||||||
|
<div class="InsightsNav-rightSide">
|
||||||
|
<div class="JobResults-badgeTitle">Total Issues</div>
|
||||||
|
<span class="badge List-titleBadge InsightsNav-totalIssues">4</span>
|
||||||
|
<div class="JobResults-badgeTitle">Critical</div>
|
||||||
|
<span class="badge List-titleBadge InsightsNav-criticalIssues">1</span>
|
||||||
|
<div class="JobResults-badgeTitle">High</div>
|
||||||
|
<span class="badge List-titleBadge InsightsNav-highIssues">1</span>
|
||||||
|
<div class="JobResults-badgeTitle">Medium</div>
|
||||||
|
<span class="badge List-titleBadge InsightsNav-mediumIssues">1</span>
|
||||||
|
<div class="JobResults-badgeTitle">Low</div>
|
||||||
|
<span class="badge List-titleBadge InsightsNav-lowIssues">1</span>
|
||||||
|
</div>
|
||||||
|
<div class="InsightsNav-leftSide">
|
||||||
|
<div class="JobResults-badgeTitle">Solvable With Playbook</div>
|
||||||
|
<span class="badge List-titleBadge InsightsNav-solvableBadge">4</span>
|
||||||
|
<div class="JobResults-badgeTitle">Not Solvable With Playbook</div>
|
||||||
|
<span class="badge List-titleBadge InsightsNav-solvableBadge">1</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
11
awx/ui/client/src/inventories/insights/main.js
Normal file
11
awx/ui/client/src/inventories/insights/main.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/*************************************************
|
||||||
|
* Copyright (c) 2017 Ansible, Inc.
|
||||||
|
*
|
||||||
|
* All Rights Reserved
|
||||||
|
*************************************************/
|
||||||
|
|
||||||
|
import controller from './insights.controller';
|
||||||
|
|
||||||
|
export default
|
||||||
|
angular.module('insightsDashboard', [])
|
||||||
|
.controller('InsightsController', controller);
|
||||||
@@ -20,6 +20,7 @@ import InventoryForm from './inventory.form';
|
|||||||
import InventoryManageService from './inventory-manage.service';
|
import InventoryManageService from './inventory-manage.service';
|
||||||
import adHocRoute from './adhoc/adhoc.route';
|
import adHocRoute from './adhoc/adhoc.route';
|
||||||
import ansibleFacts from './ansible_facts/main';
|
import ansibleFacts from './ansible_facts/main';
|
||||||
|
import insights from './insights/main';
|
||||||
import { copyMoveGroupRoute, copyMoveHostRoute } from './copy-move/copy-move.route';
|
import { copyMoveGroupRoute, copyMoveHostRoute } from './copy-move/copy-move.route';
|
||||||
import copyMove from './copy-move/main';
|
import copyMove from './copy-move/main';
|
||||||
export default
|
export default
|
||||||
@@ -34,6 +35,7 @@ angular.module('inventory', [
|
|||||||
inventoryEdit.name,
|
inventoryEdit.name,
|
||||||
inventoryList.name,
|
inventoryList.name,
|
||||||
ansibleFacts.name,
|
ansibleFacts.name,
|
||||||
|
insights.name,
|
||||||
copyMove.name
|
copyMove.name
|
||||||
])
|
])
|
||||||
.factory('InventoryForm', InventoryForm)
|
.factory('InventoryForm', InventoryForm)
|
||||||
@@ -72,6 +74,34 @@ angular.module('inventory', [
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function insightsConfig(stateName) {
|
||||||
|
return {
|
||||||
|
name: stateName,
|
||||||
|
url: '/insights',
|
||||||
|
ncyBreadcrumb: {
|
||||||
|
label: N_("INSIGHTS")
|
||||||
|
},
|
||||||
|
views: {
|
||||||
|
'related': {
|
||||||
|
controller: 'InsightsController',
|
||||||
|
templateUrl: templateUrl('inventories/insights/insights')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
Facts: ['$stateParams', 'GetBasePath', 'Rest',
|
||||||
|
function($stateParams, GetBasePath, Rest) {
|
||||||
|
let ansibleFactsUrl = GetBasePath('hosts') + $stateParams.host_id + '/ansible_facts';
|
||||||
|
Rest.setUrl(ansibleFactsUrl);
|
||||||
|
return Rest.get()
|
||||||
|
.success(function(data) {
|
||||||
|
return data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function generateInventoryStates() {
|
function generateInventoryStates() {
|
||||||
|
|
||||||
let basicInventoryAdd = stateDefinitions.generateTree({
|
let basicInventoryAdd = stateDefinitions.generateTree({
|
||||||
@@ -257,6 +287,8 @@ angular.module('inventory', [
|
|||||||
|
|
||||||
let relatedHostsAnsibleFacts = factsConfig('inventories.edit.hosts.edit.ansible_facts');
|
let relatedHostsAnsibleFacts = factsConfig('inventories.edit.hosts.edit.ansible_facts');
|
||||||
let nestedHostsAnsibleFacts = factsConfig('inventories.edit.groups.edit.nested_hosts.edit.ansible_facts');
|
let nestedHostsAnsibleFacts = factsConfig('inventories.edit.groups.edit.nested_hosts.edit.ansible_facts');
|
||||||
|
let relatedHostsInsights = insightsConfig('inventories.edit.hosts.edit.insights');
|
||||||
|
let nestedHostsInsights = insightsConfig('inventories.edit.groups.edit.nested_hosts.edit.insights');
|
||||||
|
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
basicInventoryAdd,
|
basicInventoryAdd,
|
||||||
@@ -306,6 +338,8 @@ angular.module('inventory', [
|
|||||||
stateExtender.buildDefinition(editSchedule),
|
stateExtender.buildDefinition(editSchedule),
|
||||||
stateExtender.buildDefinition(relatedHostsAnsibleFacts),
|
stateExtender.buildDefinition(relatedHostsAnsibleFacts),
|
||||||
stateExtender.buildDefinition(nestedHostsAnsibleFacts),
|
stateExtender.buildDefinition(nestedHostsAnsibleFacts),
|
||||||
|
stateExtender.buildDefinition(relatedHostsInsights),
|
||||||
|
stateExtender.buildDefinition(nestedHostsInsights),
|
||||||
stateExtender.buildDefinition(copyMoveGroupRoute),
|
stateExtender.buildDefinition(copyMoveGroupRoute),
|
||||||
stateExtender.buildDefinition(copyMoveHostRoute)
|
stateExtender.buildDefinition(copyMoveHostRoute)
|
||||||
])
|
])
|
||||||
@@ -359,6 +393,7 @@ angular.module('inventory', [
|
|||||||
});
|
});
|
||||||
|
|
||||||
let hostAnsibleFacts = factsConfig('hosts.edit.ansible_facts');
|
let hostAnsibleFacts = factsConfig('hosts.edit.ansible_facts');
|
||||||
|
let hostInsights = insightsConfig('hosts.edit.insights');
|
||||||
|
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
hostTree
|
hostTree
|
||||||
@@ -367,7 +402,8 @@ angular.module('inventory', [
|
|||||||
states: _.reduce(generated, (result, definition) => {
|
states: _.reduce(generated, (result, definition) => {
|
||||||
return result.concat(definition.states);
|
return result.concat(definition.states);
|
||||||
}, [
|
}, [
|
||||||
stateExtender.buildDefinition(hostAnsibleFacts)
|
stateExtender.buildDefinition(hostAnsibleFacts),
|
||||||
|
stateExtender.buildDefinition(hostInsights)
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user