mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
submitting changes after PR feedback
adding translate directive to partial, performing a lookup on credential_types for the credential on the project page, and some other small changes
This commit is contained in:
parent
38ce6c7226
commit
ff46e46b69
@ -33,44 +33,32 @@ function (data, $scope, moment, $state, resourceData) {
|
||||
}
|
||||
if(filter === "solvable"){
|
||||
$scope.reports = _.filter($scope.reports_dataset.reports, function(report){
|
||||
if(report.maintenance_actions.length > 0){
|
||||
return report;
|
||||
}
|
||||
return (report.maintenance_actions.length > 0);
|
||||
});
|
||||
}
|
||||
if(filter === "not_solvable"){
|
||||
$scope.reports = _.filter($scope.reports_dataset.reports, function(report){
|
||||
if(report.maintenance_actions.length === 0){
|
||||
return report;
|
||||
}
|
||||
return (report.maintenance_actions.length === 0);
|
||||
});
|
||||
}
|
||||
if(filter === "critical"){
|
||||
$scope.reports = _.filter($scope.reports_dataset.reports, function(report){
|
||||
if(report.rule.severity === 'CRITICAL'){
|
||||
return report;
|
||||
}
|
||||
return (report.rule.severity === 'CRITICAL');
|
||||
});
|
||||
}
|
||||
if(filter === "high"){
|
||||
$scope.reports = _.filter($scope.reports_dataset.reports, function(report){
|
||||
if(report.rule.severity === 'ERROR'){
|
||||
return report;
|
||||
}
|
||||
return (report.rule.severity === 'ERROR');
|
||||
});
|
||||
}
|
||||
if(filter === "medium"){
|
||||
$scope.reports = _.filter($scope.reports_dataset.reports, function(report){
|
||||
if(report.rule.severity === 'WARN'){
|
||||
return report;
|
||||
}
|
||||
return (report.rule.severity === 'WARN');
|
||||
});
|
||||
}
|
||||
if(filter === "low"){
|
||||
$scope.reports = _.filter($scope.reports_dataset.reports, function(report){
|
||||
if(report.rule.severity === 'INFO'){
|
||||
return report;
|
||||
}
|
||||
return (report.rule.severity === 'INFO');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -1,38 +1,38 @@
|
||||
<div class="InsightsLastCheck"
|
||||
ng-show="isCheckingIn=false">
|
||||
<i class="fa icon-job-failed InsightsIcon-warning"></i>
|
||||
This machine has not checked in with Insights in {{last_check_in}} hours
|
||||
<translate>This machine has not checked in with Insights in {{last_check_in}} hours</translate>
|
||||
</div>
|
||||
<div class="InsightsNav">
|
||||
<div class="InsightsNav-rightSide">
|
||||
<div class="InsightsNav-anchor" ng-click="filter('total')"
|
||||
ng-class="{'is-currentFilter' : (currentFilter === 'total')}">
|
||||
<div class="InsightsNav-badgeTitle">Total Issues</div>
|
||||
<div class="InsightsNav-badgeTitle"><translate>Total Issues</translate></div>
|
||||
<span class="badge List-titleBadge InsightsNav-totalIssues">{{reports_dataset.reports.length}}</span>
|
||||
</div>
|
||||
|
||||
<div class="InsightsNav-anchor" ng-click="filter('critical')"
|
||||
ng-class="{'is-currentFilter' : (currentFilter === 'critical')}"
|
||||
ng-show="critical_count>0">
|
||||
<div class="InsightsNav-badgeTitle">Critical</div>
|
||||
<div class="InsightsNav-badgeTitle"><translate>Critical</translate></div>
|
||||
<span class="badge List-titleBadge InsightsNav-criticalIssues">{{critical_count}}</span>
|
||||
</div>
|
||||
<div class="InsightsNav-anchor" ng-click="filter('high')"
|
||||
ng-class="{'is-currentFilter' : (currentFilter === 'high')}"
|
||||
ng-show="high_count>0">
|
||||
<div class="InsightsNav-badgeTitle">High</div>
|
||||
<div class="InsightsNav-badgeTitle"><translate>High</translate></div>
|
||||
<span class="badge List-titleBadge InsightsNav-highIssues">{{high_count}}</span>
|
||||
</div>
|
||||
<div class="InsightsNav-anchor" ng-click="filter('medium')"
|
||||
ng-class="{'is-currentFilter' : (currentFilter === 'medium')}"
|
||||
ng-show="med_count>0">
|
||||
<div class="InsightsNav-badgeTitle">Medium</div>
|
||||
<div class="InsightsNav-badgeTitle"><translate>Medium</translate></div>
|
||||
<span class="badge List-titleBadge InsightsNav-mediumIssues">{{med_count}}</span>
|
||||
</div>
|
||||
<div class="InsightsNav-anchor" ng-click="filter('low')"
|
||||
ng-class="{'is-currentFilter' : (currentFilter === 'low')}"
|
||||
ng-show="low_count>0">
|
||||
<div class="InsightsNav-badgeTitle">Low</div>
|
||||
<div class="InsightsNav-badgeTitle"><translate>Low</translate></div>
|
||||
<span class="badge List-titleBadge InsightsNav-lowIssues">{{low_count}}</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -41,13 +41,13 @@
|
||||
<div class="InsightsNav-anchor" ng-click="filter('solvable')"
|
||||
ng-class="{'is-currentFilter' : (currentFilter === 'solvable')}"
|
||||
ng-show="solvable_count>0">
|
||||
<div class="InsightsNav-badgeTitle">Solvable With Playbook</div>
|
||||
<div class="InsightsNav-badgeTitle"><translate>Solvable With Playbook</translate></div>
|
||||
<span class="badge List-titleBadge InsightsNav-solvableBadge">{{solvable_count}}</span>
|
||||
</div>
|
||||
<div class="InsightsNav-anchor" ng-click="filter('not_solvable')"
|
||||
ng-class="{'is-currentFilter' : (currentFilter === 'not_solvable')}"
|
||||
ng-show="not_solvable_count>0">
|
||||
<div class="InsightsNav-badgeTitle">Not Solvable With Playbook</div>
|
||||
<div class="InsightsNav-badgeTitle"><translate>Not Solvable With Playbook</translate></div>
|
||||
<span class="badge List-titleBadge InsightsNav-solvableBadge">{{not_solvable_count}}</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -64,7 +64,7 @@
|
||||
aw-tool-tip="Medium Risk" data-placement="top">
|
||||
<img class="InsightsIcon" src="/static/assets/i_severity_low.svg" ng-show="report.rule.severity === 'INFO'"
|
||||
aw-tool-tip="Low Risk" data-placement="top">
|
||||
<div class="InsightsRow-description">ISSUE: {{report.rule.description}}</div>
|
||||
<div class="InsightsRow-description"><translate>ISSUE: {{report.rule.description}}</translate></div>
|
||||
<span class="Form-title--is_superuser">{{report.rule.category}}</span>
|
||||
</div>
|
||||
<div class="InsightsRow-body">{{report.rule.summary}}</div>
|
||||
|
@ -7,9 +7,10 @@
|
||||
export default ['$scope', '$location', '$stateParams', 'GenerateForm',
|
||||
'ProjectsForm', 'Rest', 'Alert', 'ProcessErrors', 'GetBasePath',
|
||||
'GetProjectPath', 'GetChoices', 'Wait', '$state', 'CreateSelect2', 'i18n',
|
||||
'CredentialTypes',
|
||||
function($scope, $location, $stateParams, GenerateForm, ProjectsForm, Rest,
|
||||
Alert, ProcessErrors, GetBasePath, GetProjectPath, GetChoices, Wait, $state,
|
||||
CreateSelect2, i18n) {
|
||||
CreateSelect2, i18n, CredentialTypes) {
|
||||
|
||||
var form = ProjectsForm(),
|
||||
base = $location.path().replace(/^\//, '').split('/')[0],
|
||||
@ -153,7 +154,7 @@ export default ['$scope', '$location', '$stateParams', 'GenerateForm',
|
||||
break;
|
||||
default:
|
||||
$scope.credentialLabel = "SCM Credential";
|
||||
$scope.urlPopover = '<p> ' + i18n._('URL popover text');
|
||||
$scope.urlPopover = '<p> ' + i18n._('URL popover text') + '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,10 +163,15 @@ export default ['$scope', '$location', '$stateParams', 'GenerateForm',
|
||||
$state.go('projects');
|
||||
};
|
||||
$scope.lookupCredential = function(){
|
||||
let credType = ($scope.scm_type.value === "insights") ? 13 : 2; //insights cred type is 13, SCM is 2
|
||||
// Perform a lookup on the credential_type. Git, Mercurial, and Subversion
|
||||
// all use SCM as their credential type.
|
||||
let credType = _.filter(CredentialTypes, function(credType){
|
||||
return ($scope.scm_type.value !== "insights" && credType.kind === "scm" ||
|
||||
$scope.scm_type.value === "insights" && credType.kind === "insights");
|
||||
});
|
||||
$state.go('.credential', {
|
||||
credential_search: {
|
||||
credential_type: credType,
|
||||
credential_type: credType[0].id,
|
||||
page_size: '5',
|
||||
page: '1'
|
||||
}
|
||||
|
@ -8,11 +8,11 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest',
|
||||
'Alert', 'ProcessErrors', 'GenerateForm', 'Prompt', 'ClearScope',
|
||||
'GetBasePath', 'GetProjectPath', 'Authorization', 'GetChoices', 'Empty',
|
||||
'Wait', 'ProjectUpdate', '$state', 'CreateSelect2', 'ToggleNotification',
|
||||
'i18n',
|
||||
'i18n', 'CredentialTypes',
|
||||
function($scope, $rootScope, $stateParams, ProjectsForm, Rest, Alert,
|
||||
ProcessErrors, GenerateForm, Prompt, ClearScope, GetBasePath,
|
||||
GetProjectPath, Authorization, GetChoices, Empty, Wait, ProjectUpdate,
|
||||
$state, CreateSelect2, ToggleNotification, i18n) {
|
||||
$state, CreateSelect2, ToggleNotification, i18n, CredentialTypes) {
|
||||
|
||||
ClearScope('htmlTemplate');
|
||||
|
||||
@ -290,10 +290,15 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest',
|
||||
};
|
||||
|
||||
$scope.lookupCredential = function(){
|
||||
let credType = ($scope.scm_type.value === "insights") ? 13 : 2; //insights cred type is 13, SCM is 2
|
||||
// Perform a lookup on the credential_type. Git, Mercurial, and Subversion
|
||||
// all use SCM as their credential type.
|
||||
let credType = _.filter(CredentialTypes, function(credType){
|
||||
return ($scope.scm_type.value !== "insights" && credType.kind === "scm" ||
|
||||
$scope.scm_type.value === "insights" && credType.kind === "insights");
|
||||
});
|
||||
$state.go('.credential', {
|
||||
credential_search: {
|
||||
credential_type: credType,
|
||||
credential_type: credType[0].id,
|
||||
page_size: '5',
|
||||
page: '1'
|
||||
}
|
||||
|
@ -28,7 +28,24 @@ angular.module('Projects', [revisions.name])
|
||||
.config(['$stateProvider', 'stateDefinitionsProvider',
|
||||
function($stateProvider, stateDefinitionsProvider) {
|
||||
let stateDefinitions = stateDefinitionsProvider.$get();
|
||||
|
||||
var projectResolve = {
|
||||
CredentialTypes: ['Rest', '$stateParams', 'GetBasePath', 'ProcessErrors',
|
||||
(Rest, $stateParams, GetBasePath, ProcessErrors) => {
|
||||
var path = GetBasePath('credential_types');
|
||||
Rest.setUrl(path);
|
||||
return Rest.get()
|
||||
.then(function(data) {
|
||||
return (data.data.results);
|
||||
}).catch(function(response) {
|
||||
ProcessErrors(null, response.data, response.status, null, {
|
||||
hdr: 'Error!',
|
||||
msg: 'Failed to get credential tpyes. GET returned status: ' +
|
||||
response.status
|
||||
});
|
||||
});
|
||||
}
|
||||
]
|
||||
};
|
||||
// lazily generate a tree of substates which will replace this node in ui-router's stateRegistry
|
||||
// see: stateDefinition.factory for usage documentation
|
||||
$stateProvider.state({
|
||||
@ -55,6 +72,10 @@ angular.module('Projects', [revisions.name])
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
label: N_('PROJECTS')
|
||||
},
|
||||
resolve: {
|
||||
add: projectResolve,
|
||||
edit: projectResolve
|
||||
}
|
||||
})
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user