Skip to content

Commit

Permalink
Show repositories for AddOn products only if they're available
Browse files Browse the repository at this point in the history
  • Loading branch information
Santiago Petrone committed Oct 11, 2016
1 parent cc48972 commit c842ab8
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,35 @@
Upgrade7NodesRepositoriesCheckController.$inject = [
'$translate',
'upgradeFactory',
'crowbarFactory',
'NODES_PRODUCTS_REPO_CHECKS_MAP'
];
// @ngInject
function Upgrade7NodesRepositoriesCheckController(
$translate,
upgradeFactory,
crowbarFactory,
NODES_PRODUCTS_REPO_CHECKS_MAP
) {
var vm = this;
var vm = this,
addonsRepos = {
'SLE12-SP2-HA-Pool': {
status: false,
label: 'upgrade7.steps.nodes-repository-checks.repositories.codes.SLE12-SP2-HA-Pool'
},
'SLE12-SP2-HA-Updates': {
status: false,
label: 'upgrade7.steps.nodes-repository-checks.repositories.codes.SLE12-SP2-HA-Updates'
},
'SUSE-Enterprise-Storage-4-Pool': {
status: false,
label: 'upgrade7.steps.nodes-repository-checks.repositories.codes.SUSE-Enterprise-Storage-4-Pool'
},
'SUSE-Enterprise-Storage-4-Updates': {
status: false,
label: 'upgrade7.steps.nodes-repository-checks.repositories.codes.SUSE-Enterprise-Storage-4-Updates'
}
};
vm.repoChecks = {
completed: false,
valid: false,
Expand All @@ -42,29 +62,30 @@
'SUSE-OpenStack-Cloud-7-Updates': {
status: false,
label: 'upgrade7.steps.nodes-repository-checks.repositories.codes.SUSE-OpenStack-Cloud-7-Updates'
},
'SLE12-SP2-HA-Pool': {
status: false,
label: 'upgrade7.steps.nodes-repository-checks.repositories.codes.SLE12-SP2-HA-Pool'
},
'SLE12-SP2-HA-Updates': {
status: false,
label: 'upgrade7.steps.nodes-repository-checks.repositories.codes.SLE12-SP2-HA-Updates'
},
'SUSE-Enterprise-Storage-4-Pool': {
status: false,
label: 'upgrade7.steps.nodes-repository-checks.repositories.codes.SUSE-Enterprise-Storage-4-Pool'
},
'SUSE-Enterprise-Storage-4-Updates': {
status: false,
label: 'upgrade7.steps.nodes-repository-checks.repositories.codes.SUSE-Enterprise-Storage-4-Updates'
}
},
runRepoChecks: runRepoChecks,
running: false,
spinnerVisible: false
};

activate();

/**
* Activation of the Nodes and AddOns Repository checks page
*/
function activate() {
crowbarFactory.getEntity().then(function (entityResponse) {
if (! _.isEmpty(entityResponse.data.addons)) {
_.forEach(entityResponse.data.addons, function (addon) {
_.forEach(NODES_PRODUCTS_REPO_CHECKS_MAP[addon], function (addonRepository) {
_.set(vm.repoChecks.checks, addonRepository, addonsRepos[addonRepository]);
});

});
}
});
}
/**
* Validate Nodes Repositories required for Cloud 7 Upgrade
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*global bard $controller $httpBackend should assert upgradeFactory $q $rootScope */
describe('Upgrade Flow - Nodes Repositories Checks Controller', function () {
/*global bard $controller $httpBackend should assert upgradeFactory $q $rootScope crowbarFactory */
fdescribe('Upgrade Flow - Nodes Repositories Checks Controller', function () {
var controller,
failingRepoChecks = {
'ceph': {
Expand Down Expand Up @@ -145,6 +145,15 @@ describe('Upgrade Flow - Nodes Repositories Checks Controller', function () {
failingErrors = {
error_message: 'Authentication failure'
},
entityResponse = {
data: {
'version': '4.0',
'addons': [
'ceph',
'ha'
]
}
},
passingReposChecksResponse = {
data: passingRepoChecks
},
Expand All @@ -166,12 +175,17 @@ describe('Upgrade Flow - Nodes Repositories Checks Controller', function () {
bard.inject(
'$controller',
'upgradeFactory',
'crowbarFactory',
'$q',
'$httpBackend',
'$rootScope',
'NODES_PRODUCTS_REPO_CHECKS_MAP'
);

bard.mockService(crowbarFactory, {
getEntity: $q.when(entityResponse)
});

//Create the controller
controller = $controller('Upgrade7NodesRepositoriesCheckController');

Expand Down

0 comments on commit c842ab8

Please sign in to comment.