Merge branch 'downstream' into devel

This commit is contained in:
Ryan Petrello
2019-04-26 08:02:04 -04:00
40 changed files with 1133 additions and 1185 deletions

View File

@@ -26,6 +26,7 @@ function (data, $scope, moment, $state, InventoryData, InsightsService,
InventoryData.summary_fields.insights_credential && InventoryData.summary_fields.insights_credential.id) ?
InventoryData.summary_fields.insights_credential.id : null;
$scope.canRemediate = CanRemediate;
$scope.platformId = $scope.reports_dataset.platform_id;
}
function filter(str){
@@ -40,7 +41,7 @@ function (data, $scope, moment, $state, InventoryData, InsightsService,
};
$scope.viewDataInInsights = function(){
window.open(`https://access.redhat.com/insights/inventory?machine=${$scope.$parent.host.insights_system_id}`, '_blank');
window.open(`https://cloud.redhat.com/insights/inventory/${$scope.platformId}/insights`, '_blank');
};
$scope.remediateInventory = function(inv_id, insights_credential){

View File

@@ -7,10 +7,10 @@
export default function(){
return function(plan) {
if(plan === null || plan === undefined){
return "PLAN: Not Available <a href='https://access.redhat.com/insights/info/' target='_blank'>CREATE A NEW PLAN IN INSIGHTS</a>";
return "PLAN: Not Available <a href='https://cloud.redhat.com/insights/remediations/' target='_blank'>CREATE A NEW PLAN IN INSIGHTS</a>";
} else {
let name = (plan.maintenance_plan.name === null) ? "Unnamed Plan" : plan.maintenance_plan.name;
return `<a href="https://access.redhat.com/insights/planner/${plan.maintenance_plan.maintenance_id}" target="_blank">${name} (${plan.maintenance_plan.maintenance_id})</a>`;
let name = (plan.name === null) ? "Unnamed Plan" : plan.name;
return `<a href="https://cloud.redhat.com/insights/remediations/${plan.id}" target="_blank">${name} (${plan.id})</a>`;
}
};
}

View File

@@ -7,10 +7,10 @@
export default ['$scope', '$location', '$stateParams', 'GenerateForm',
'ProjectsForm', 'Rest', 'Alert', 'ProcessErrors', 'GetBasePath',
'GetProjectPath', 'GetChoices', 'Wait', '$state', 'CreateSelect2', 'i18n',
'ConfigData', 'resolvedModels', 'scmCredentialType',
'ConfigData', 'resolvedModels', 'scmCredentialType', 'insightsCredentialType',
function($scope, $location, $stateParams, GenerateForm, ProjectsForm, Rest,
Alert, ProcessErrors, GetBasePath, GetProjectPath, GetChoices, Wait, $state,
CreateSelect2, i18n, ConfigData, resolvedModels, scmCredentialType) {
CreateSelect2, i18n, ConfigData, resolvedModels, scmCredentialType, insightsCredentialType) {
let form = ProjectsForm(),
base = $location.path().replace(/^\//, '').split('/')[0],
@@ -191,9 +191,13 @@ export default ['$scope', '$location', '$stateParams', 'GenerateForm',
$scope.lookupCredential = function(){
// Perform a lookup on the credential_type. Git, Mercurial, and Subversion
// all use SCM as their credential type.
let lookupCredentialType = scmCredentialType;
if ($scope.scm_type.value === 'insights') {
lookupCredentialType = insightsCredentialType;
}
$state.go('.credential', {
credential_search: {
credential_type: scmCredentialType,
credential_type: lookupCredentialType,
page_size: '5',
page: '1'
}

View File

@@ -8,12 +8,12 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest',
'Alert', 'ProcessErrors', 'GenerateForm', 'Prompt', 'isNotificationAdmin',
'GetBasePath', 'GetProjectPath', 'Authorization', 'GetChoices', 'Empty',
'Wait', 'ProjectUpdate', '$state', 'CreateSelect2', 'ToggleNotification',
'i18n', 'OrgAdminLookup', 'ConfigData', 'scmCredentialType',
'i18n', 'OrgAdminLookup', 'ConfigData', 'scmCredentialType', 'insightsCredentialType',
function($scope, $rootScope, $stateParams, ProjectsForm, Rest, Alert,
ProcessErrors, GenerateForm, Prompt, isNotificationAdmin, GetBasePath,
GetProjectPath, Authorization, GetChoices, Empty, Wait, ProjectUpdate,
$state, CreateSelect2, ToggleNotification, i18n, OrgAdminLookup,
ConfigData, scmCredentialType) {
ConfigData, scmCredentialType, insightsCredentialType) {
let form = ProjectsForm(),
defaultUrl = GetBasePath('projects') + $stateParams.project_id + '/',
@@ -310,10 +310,13 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest',
$scope.lookupCredential = function(){
// Perform a lookup on the credential_type. Git, Mercurial, and Subversion
// all use SCM as their credential type.
let lookupCredentialType = scmCredentialType;
if ($scope.scm_type.value === 'insights') {
lookupCredentialType = insightsCredentialType;
}
$state.go('.credential', {
credential_search: {
credential_type: scmCredentialType,
credential_type: lookupCredentialType,
page_size: '5',
page: '1'
}

View File

@@ -36,7 +36,23 @@ function ResolveScmCredentialType (GetBasePath, Rest, ProcessErrors) {
});
}
function ResolveInsightsCredentialType (GetBasePath, Rest, ProcessErrors) {
Rest.setUrl(GetBasePath('credential_types') + '?name=Insights');
return Rest.get()
.then(({ data }) => {
return data.results[0].id;
})
.catch(({ data, status }) => {
ProcessErrors(null, data, status, null, {
hdr: 'Error!',
msg: 'Failed to get credential type data: ' + status
});
});
}
ResolveScmCredentialType.$inject = ['GetBasePath', 'Rest', 'ProcessErrors'];
ResolveInsightsCredentialType.$inject = ['GetBasePath', 'Rest', 'ProcessErrors'];
export default
@@ -70,6 +86,7 @@ angular.module('Projects', [])
const stateIndex = res.states.findIndex(s => s.name === projectsAddName);
res.states[stateIndex].resolve.scmCredentialType = ResolveScmCredentialType;
res.states[stateIndex].resolve.insightsCredentialType = ResolveInsightsCredentialType;
return res;
});
@@ -113,6 +130,7 @@ angular.module('Projects', [])
const stateIndex = res.states.findIndex(s => s.name === projectsEditName);
res.states[stateIndex].resolve.scmCredentialType = ResolveScmCredentialType;
res.states[stateIndex].resolve.insightsCredentialType = ResolveInsightsCredentialType;
return res;
});