Skip to content

Only show service catalog resources when available #1573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions app/scripts/controllers/overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ angular.module('openshiftConsole').controller('OverviewController', [
'$filter',
'$routeParams',
'AlertMessageService',
'APIService',
'AppsService',
'BuildsService',
'Constants',
Expand All @@ -30,6 +31,7 @@ function OverviewController($scope,
$filter,
$routeParams,
AlertMessageService,
APIService,
AppsService,
BuildsService,
Constants,
Expand All @@ -52,6 +54,14 @@ function OverviewController($scope,
var limitWatches = $filter('isIE')() || $filter('isEdge')();
var DEFAULT_POLL_INTERVAL = 60 * 1000; // milliseconds

// Enable service catalog features if the new experience is enabled and the
// servicecatalog.k8s.io resources are available.
var SERVICE_CATALOG_ENABLED =
_.get(Constants, 'ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page') &&
APIService.apiInfo({ group: 'servicecatalog.k8s.io', resource: 'serviceclasses' }) &&
APIService.apiInfo({ group: 'servicecatalog.k8s.io', resource: 'instances' }) &&
APIService.apiInfo({ group: 'servicecatalog.k8s.io', resource: 'bindings' });

$scope.projectName = $routeParams.project;

// Filters used by this controller.
Expand Down Expand Up @@ -1263,7 +1273,7 @@ function OverviewController($scope,
updateQuotaWarnings();
}, {poll: true, pollInterval: DEFAULT_POLL_INTERVAL}));

if(Constants.ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page) {
if (SERVICE_CATALOG_ENABLED) {
watches.push(DataService.watch({
group: 'servicecatalog.k8s.io',
resource: 'instances'
Expand All @@ -1279,7 +1289,7 @@ function OverviewController($scope,
}, {poll: limitWatches, pollInterval: DEFAULT_POLL_INTERVAL}));
}

if(Constants.ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page) {
if (SERVICE_CATALOG_ENABLED) {
watches.push(DataService.watch({
group: 'servicecatalog.k8s.io',
resource: 'bindings'
Expand All @@ -1296,7 +1306,7 @@ function OverviewController($scope,
state.limitRanges = response.by("metadata.name");
});

if(Constants.ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page) {
if (SERVICE_CATALOG_ENABLED) {
// TODO: update to behave like ImageStreamResolver
// - we may not even need to list these... perhaps just fetch the ones we need when needed
DataService.list({
Expand Down
Loading