Skip to content
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

Enable new landing page experience by default #2078

Merged
merged 1 commit into from
Sep 18, 2017
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
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, how long will we keep this flag? Assuming we won't support the old landing page forever.

Copy link
Member Author

@spadgett spadgett Sep 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking we'd remove in 3.8

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" 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