Skip to content

Commit

Permalink
Enable new landing page experience by default
Browse files Browse the repository at this point in the history
  • Loading branch information
spadgett committed Sep 15, 2017
1 parent f2945e1 commit 2d38197
Show file tree
Hide file tree
Showing 14 changed files with 127 additions and 142 deletions.
21 changes: 6 additions & 15 deletions app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ angular
templateUrl: 'views/projects.html',
controller: 'ProjectsController'
};
if (_.get(window, 'OPENSHIFT_CONSTANTS.ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page')) {
if (_.get(window, 'OPENSHIFT_CONSTANTS.DISABLE_SERVICE_CATALOG_LANDING_PAGE')) {
landingPageRoute = projectsPageRoute;
$routeProvider.when('/projects', {
redirectTo: '/'
});
} else {
landingPageRoute = {
templateUrl: 'views/landing-page.html',
controller: 'LandingPageController',
reloadOnSearch: false
};
$routeProvider.when('/projects', projectsPageRoute);
} else {
landingPageRoute = projectsPageRoute;
$routeProvider.when('/projects', {
redirectTo: '/'
});
}

$routeProvider
Expand Down Expand Up @@ -496,15 +496,6 @@ angular
// content (e.g. using :before pseudo-elements).
$('body').addClass('ios');
}
})
.run(function($rootScope){
// if the service catalog landing page is enabled,
// set global variable for use in views
// and add class to body
if (_.get(window, 'OPENSHIFT_CONSTANTS.ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page')) {
$rootScope.globalTechPreviewIndicator = true;
$('body').addClass('tech-preview');
}
});

hawtioPluginLoader.addModule('openshiftConsole');
16 changes: 11 additions & 5 deletions app/scripts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,21 @@ angular.extend(window.OPENSHIFT_CONSTANTS, {
// when users navigate away from a page without saving.
DISABLE_CONFIRM_ON_EXIT: false,

// This blacklist hides certain kinds from the "Other Resources" page because they are unpersisted, disallowed for most end users, or not supported by openshift but exist in kubernetes
// Disable the new landing page and service catalog experience.
DISABLE_SERVICE_CATALOG_LANDING_PAGE: false,

// This blacklist hides certain kinds from the "Other Resources" page because
// they are unpersisted, disallowed for most end users, or not supported by
// openshift but exist in kubernetes.
AVAILABLE_KINDS_BLACKLIST: [],
// Currently disables watch on events used by the drawer

// Currently disables watch on events used by the drawer.
DISABLE_GLOBAL_EVENT_WATCH: false,

ENABLE_TECH_PREVIEW_FEATURE: {
// Enable the new landing page and service catalog experience
service_catalog_landing_page: false,
// Set to `true` when the template service broker is enabled for the cluster in master-config.yaml
// Set to true when the template service broker is enabled for the cluster in master-config.yaml.
template_service_broker: false,
// Set to true if the service catalog supports pod presets for binding services to applications.
pod_presets: false
},

Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/createProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ angular.module('openshiftConsole')
$window,
AuthService,
Constants) {
var landingPageEnabled = _.get(Constants, 'ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page');
var landingPageEnabled = !Constants.DISABLE_SERVICE_CATALOG_LANDING_PAGE;

$scope.onProjectCreated = function(encodedProjectName) {
if (landingPageEnabled) {
Expand Down
1 change: 1 addition & 0 deletions app/scripts/controllers/overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ function OverviewController($scope,
var DEFAULT_POLL_INTERVAL = 60 * 1000; // milliseconds

$scope.projectName = $routeParams.project;
overview.catalogLandingPageEnabled = !Constants.DISABLE_SERVICE_CATALOG_LANDING_PAGE;

// Filters used by this controller.
var annotation = $filter('annotation');
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/directives/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ angular.module('openshiftConsole')
_.set($scope, 'ordering.panelName', panelName);
};

$scope.catalogLandingPageEnabled = _.get(Constants, 'ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page');
$scope.catalogLandingPageEnabled = !Constants.DISABLE_SERVICE_CATALOG_LANDING_PAGE;
var select = $elem.find('.selectpicker');
var options = [];

Expand Down
2 changes: 1 addition & 1 deletion app/scripts/extensions/nav/helpDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ angular.module('openshiftConsole')
}
);

if (_.get(window, 'OPENSHIFT_CONSTANTS.ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page')) {
if (!_.get(window, 'OPENSHIFT_CONSTANTS.DISABLE_SERVICE_CATALOG_LANDING_PAGE')) {
var tourConfig = _.get(window, 'OPENSHIFT_CONSTANTS.GUIDED_TOURS.landing_page_tour');
if (tourConfig && tourConfig.enabled && tourConfig.steps) {
options.push(
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/services/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ angular.module("openshiftConsole")
// 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') &&
!Constants.SERVICE_CATALOG_ENABLED &&
APIService.apiInfo({ group: 'servicecatalog.k8s.io', resource: 'serviceclasses' }) &&
APIService.apiInfo({ group: 'servicecatalog.k8s.io', resource: 'serviceinstances' }) &&
APIService.apiInfo({ group: 'servicecatalog.k8s.io', resource: 'serviceinstancecredentials' });
Expand Down
8 changes: 4 additions & 4 deletions app/views/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ <h2>Get started with your project.</h2>
image, or add components like databases and message queues.
</p>
<p class="gutter-top">
<a ng-if="!('service_catalog_landing_page' | enableTechPreviewFeature)" ng-href="project/{{projectName}}/create" class="btn btn-lg btn-primary">
Add to Project
</a>
<a ng-if="'service_catalog_landing_page' | enableTechPreviewFeature" ng-href="./" class="btn btn-lg btn-primary">
<a ng-if="overview.catalogLandingPageEnabled" ng-href="./" class="btn btn-lg btn-primary">
Browse Catalog
</a>
<a ng-if="!overview.catalogLandingPageEnabled" ng-href="project/{{projectName}}/create" class="btn btn-lg btn-primary">
Add to Project
</a>
</p>
</div>
<div ng-if="!(project.metadata.name | canIAddToProject)">
Expand Down
Loading

0 comments on commit 2d38197

Please sign in to comment.