mirror of
https://github.com/ansible/awx.git
synced 2026-05-09 18:37:36 -02:30
Moves initial system settings rest call out to resolve
This commit is contained in:
@@ -7,10 +7,10 @@
|
||||
import {N_} from "../i18n";
|
||||
|
||||
export default
|
||||
['Wait', '$state', '$scope', '$rootScope', 'ProcessErrors', 'CheckLicense', 'moment', 'Rest', '$timeout',
|
||||
'$window', 'ConfigService', 'pendoService', 'insightsEnablementService', 'i18n', 'config', 'GetBasePath',
|
||||
function(Wait, $state, $scope, $rootScope, ProcessErrors, CheckLicense, moment, Rest, $timeout,
|
||||
$window, ConfigService, pendoService, insightsEnablementService, i18n, config, GetBasePath) {
|
||||
['Wait', '$state', '$scope', '$rootScope', 'ProcessErrors', 'CheckLicense', 'moment', '$timeout', 'Rest',
|
||||
'$window', 'ConfigService', 'pendoService', 'insightsEnablementService', 'i18n', 'config', 'rhCreds', 'GetBasePath',
|
||||
function(Wait, $state, $scope, $rootScope, ProcessErrors, CheckLicense, moment, $timeout, Rest,
|
||||
$window, ConfigService, pendoService, insightsEnablementService, i18n, config, rhCreds, GetBasePath) {
|
||||
|
||||
const calcDaysRemaining = function(seconds) {
|
||||
// calculate the number of days remaining on the license
|
||||
@@ -61,9 +61,18 @@ export default
|
||||
};
|
||||
|
||||
$scope.rhCreds = {};
|
||||
|
||||
if (rhCreds.REDHAT_USERNAME && rhCreds.REDHAT_USERNAME !== "") {
|
||||
$scope.rhCreds.username = rhCreds.REDHAT_USERNAME;
|
||||
}
|
||||
|
||||
if (rhCreds.REDHAT_PASSWORD && rhCreds.REDHAT_PASSWORD !== "") {
|
||||
$scope.rhCreds.password = rhCreds.REDHAT_PASSWORD;
|
||||
$scope.showPlaceholderPassword = true;
|
||||
}
|
||||
};
|
||||
|
||||
const init = (config) => {
|
||||
const updateRHCreds = (config) => {
|
||||
Rest.setUrl(`${GetBasePath('settings')}system/`);
|
||||
Rest.get()
|
||||
.then(({data}) => {
|
||||
@@ -82,7 +91,7 @@ export default
|
||||
});
|
||||
};
|
||||
|
||||
init(config);
|
||||
initVars(config);
|
||||
|
||||
$scope.getKey = function(event) {
|
||||
// Mimic HTML5 spec, show filename
|
||||
@@ -210,7 +219,7 @@ export default
|
||||
licenseMissing: false
|
||||
});
|
||||
} else {
|
||||
init(config);
|
||||
updateRHCreds(config);
|
||||
$scope.success = true;
|
||||
$rootScope.licenseMissing = false;
|
||||
// for animation purposes
|
||||
|
||||
@@ -42,6 +42,24 @@ export default {
|
||||
return config;
|
||||
});
|
||||
}
|
||||
]
|
||||
],
|
||||
rhCreds: ['Rest', 'GetBasePath', function(Rest, GetBasePath) {
|
||||
Rest.setUrl(`${GetBasePath('settings')}system/`);
|
||||
return Rest.get()
|
||||
.then(({data}) => {
|
||||
const rhCreds = {};
|
||||
if (data.REDHAT_USERNAME && data.REDHAT_USERNAME !== "") {
|
||||
rhCreds.REDHAT_USERNAME = data.REDHAT_USERNAME;
|
||||
}
|
||||
|
||||
if (data.REDHAT_PASSWORD && data.REDHAT_PASSWORD !== "") {
|
||||
rhCreds.REDHAT_PASSWORD = data.REDHAT_PASSWORD;
|
||||
}
|
||||
|
||||
return rhCreds;
|
||||
}).catch(() => {
|
||||
return {};
|
||||
});
|
||||
}]
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user