mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 20:00:43 -03:30
changes to insights
- better error handling for an invventory missing an insights cred - better error handling for missing reports/no reports - feedback from UX - adding refresh button
This commit is contained in:
parent
8b0c5e796b
commit
32ddd8dab9
@ -64,14 +64,15 @@
|
||||
}
|
||||
|
||||
.InsightsNav-anchor.is-currentFilter{
|
||||
background-color: @f2grey;
|
||||
padding-top: 5px;
|
||||
border-bottom: 5px solid @menu-link-btm-hov;
|
||||
border-bottom: 5px solid @b7grey;
|
||||
}
|
||||
|
||||
.InsightsNav-anchor:hover{
|
||||
background-color: @menu-link-bg-hov;
|
||||
background-color: @f2grey;
|
||||
padding-top: 5px;
|
||||
border-bottom: 5px solid @menu-link-btm-hov;
|
||||
border-bottom: 5px solid @b7grey;
|
||||
}
|
||||
|
||||
.InsightsNav-totalIssues{
|
||||
@ -99,6 +100,22 @@
|
||||
background-color: @b7grey;
|
||||
}
|
||||
|
||||
.InsightsNav-refresh{
|
||||
color: @default-icon;
|
||||
cursor: pointer;
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.InsightsNav-refresh:hover{
|
||||
color: @default-link;
|
||||
}
|
||||
|
||||
.InsightsBody-missingIssues{
|
||||
color: @default-icon;
|
||||
margin: 10px 0px 10px 0px;
|
||||
}
|
||||
|
||||
.InsightsRow{
|
||||
margin-top:10px;
|
||||
}
|
||||
|
||||
@ -9,8 +9,8 @@ export default [ 'InsightsData', '$scope', 'moment', '$state', 'InventoryData',
|
||||
function (data, $scope, moment, $state, InventoryData, InsightsService) {
|
||||
|
||||
function init() {
|
||||
$scope.reports = data.reports;
|
||||
$scope.reports_dataset = data;
|
||||
$scope.reports = (data && data.reports) ? data.reports : [];
|
||||
$scope.reports_dataset = (data) ? data : {};
|
||||
$scope.currentFilter = "total";
|
||||
$scope.solvable_count = filter('solvable').length;
|
||||
$scope.not_solvable_count = filter('not_solvable').length;
|
||||
@ -20,8 +20,11 @@ function (data, $scope, moment, $state, InventoryData, InsightsService) {
|
||||
$scope.low_count =filter('low').length;
|
||||
let a = moment(), b = moment($scope.reports_dataset.last_check_in);
|
||||
$scope.last_check_in = a.diff(b, 'hours');
|
||||
$scope.inventory = InventoryData;
|
||||
$scope.insights_credential = InventoryData.summary_fields.insights_credential.id;
|
||||
$scope.inventory = (InventoryData) ? InventoryData : {};
|
||||
$scope.insights_credential = (InventoryData && InventoryData.summary_fields &&
|
||||
InventoryData.summary_fields.insights_credential && InventoryData.summary_fields.insights_credential.id) ?
|
||||
InventoryData.summary_fields.insights_credential.id : null;
|
||||
|
||||
}
|
||||
|
||||
function filter(str){
|
||||
|
||||
@ -50,10 +50,22 @@
|
||||
<div class="InsightsNav-badgeTitle"><translate>Not Solvable With Playbook</translate></div>
|
||||
<span class="badge List-titleBadge InsightsNav-solvableBadge">{{not_solvable_count}}</span>
|
||||
</div>
|
||||
<div ng-click="refresh()">
|
||||
<i class="fa fa-refresh InsightsNav-refresh"
|
||||
aw-tool-tip="Refresh Insights" data-placement="left" data-original-title="" title=""
|
||||
ng-hide="!insights_credential">
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="InsightsBody">
|
||||
<div class="InsightsBody-missingIssues" ng-show="reports.length===0 && insights_credential" translate>
|
||||
No scan jobs have been run on this host.
|
||||
</div>
|
||||
<div class="InsightsBody-missingIssues" ng-show="!insights_credential" translate>
|
||||
The Insights Credential for {{inventory.name}} was not found.
|
||||
</div>
|
||||
<div class="InsightsRow" ng-repeat="report in reports">
|
||||
<div class="InsightsRow-title">
|
||||
<img class="InsightsIcon" src="/static/assets/i_severity_critical.svg" ng-show="report.rule.severity === 'CRITICAL'"
|
||||
@ -76,6 +88,6 @@
|
||||
|
||||
<div class="buttons Form-buttons">
|
||||
<button type="button" class="btn btn-sm Form-primaryButton" ng-click="viewDataInInsights()"> <i class="fa fa-sign-out"></i> VIEW DATA IN INSIGHTS</button>
|
||||
<button type="button" class="btn btn-sm Form-primaryButton" ng-click="remediateInventory(inventory.id, inventory.name, insights_credential)"> REMEDIATE INVENTORY</button>
|
||||
<button type="button" class="btn btn-sm Form-primaryButton" ng-click="remediateInventory(inventory.id, inventory.name, insights_credential)" ng-hide="reports.length === 0 || !insights_credential"> REMEDIATE INVENTORY</button>
|
||||
<button type="button" class="btn btn-sm Form-cancelButton" ng-click="formCancel()"> Close</button>
|
||||
</div>
|
||||
|
||||
@ -32,6 +32,7 @@ function InventoriesEdit($scope, $location,
|
||||
|
||||
$scope.insights_credential_name = (inventoryData.summary_fields.insights_credential && inventoryData.summary_fields.insights_credential.name) ? inventoryData.summary_fields.insights_credential.name : null;
|
||||
$scope.insights_credential = (inventoryData.summary_fields.insights_credential && inventoryData.summary_fields.insights_credential.id) ? inventoryData.summary_fields.insights_credential.id : null;
|
||||
$scope.is_insights = (inventoryData.summary_fields.insights_credential && inventoryData.summary_fields.insights_credential.id) ? true : false;
|
||||
$scope.organization_name = inventoryData.summary_fields.organization.name;
|
||||
$scope.inventory_variables = inventoryData.variables === null || inventoryData.variables === '' ? '---' : ParseVariableString(inventoryData.variables);
|
||||
$scope.parseType = 'yaml';
|
||||
|
||||
@ -201,7 +201,7 @@ function(i18n, InventoryCompletedJobsList) {
|
||||
relatedButtons: {
|
||||
remediate_inventory: {
|
||||
ngClick: 'remediateInventory(id, name, insights_credential)',
|
||||
ngShow: 'insights_credential!==null && mode !== "add"',
|
||||
ngShow: 'is_insights && mode !== "add"',
|
||||
label: i18n._('Remediate Inventory'),
|
||||
class: 'Form-primaryButton'
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
@cgrey: #CCCCCC;
|
||||
@f7grey: #F7F7F7;
|
||||
@insights-yellow: #dedc4f;
|
||||
@f2grey: #f2f2f2;
|
||||
|
||||
|
||||
@default-warning: #F0AD4E;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user