From d3f798dab53a27a8f9414245efa1d4b7cd519dcf Mon Sep 17 00:00:00 2001 From: Neil MacDougall Date: Thu, 22 Aug 2019 21:40:19 +0100 Subject: [PATCH 1/5] Gate Helm feature on tech preview and always hide CF nav items --- .../frontend/app/custom/custom.module.ts | 12 +++++------ .../app/custom/helm/helm.store.module.ts | 3 ++- src/jetstream/plugins/monocular/main.go | 20 ++++++++----------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/custom-src/frontend/app/custom/custom.module.ts b/custom-src/frontend/app/custom/custom.module.ts index cbcc12110c..bc74c5f846 100644 --- a/custom-src/frontend/app/custom/custom.module.ts +++ b/custom-src/frontend/app/custom/custom.module.ts @@ -14,11 +14,14 @@ import { KubernetesSetupModule } from './kubernetes/kubernetes.setup.module'; import { KubeHealthCheck } from './kubernetes/store/kubernetes.actions'; import { SuseAboutInfoComponent } from './suse-about-info/suse-about-info.component'; import { SuseLoginComponent } from './suse-login/suse-login.component'; +import { HelmModule } from './helm/helm.module'; +import { HelmSetupModule } from './helm/helm.setup.module'; const SuseCustomizations: CustomizationsMetadata = { copyright: '© 2019 SUSE', hasEula: true, - aboutInfoComponent: SuseAboutInfoComponent + aboutInfoComponent: SuseAboutInfoComponent, + alwaysShowNavForEndpointTypes: (typ) => false, }; @NgModule({ @@ -27,11 +30,8 @@ const SuseCustomizations: CustomizationsMetadata = { SharedModule, MDAppModule, KubernetesSetupModule, - // #150 - Uncomment to enable helm plugin - // --------------------------------------- - // HelmModule, - // HelmSetupModule - // --------------------------------------- + HelmModule, + HelmSetupModule ], declarations: [ SuseLoginComponent, diff --git a/custom-src/frontend/app/custom/helm/helm.store.module.ts b/custom-src/frontend/app/custom/helm/helm.store.module.ts index 0453fb0a20..520d8577d8 100644 --- a/custom-src/frontend/app/custom/helm/helm.store.module.ts +++ b/custom-src/frontend/app/custom/helm/helm.store.module.ts @@ -14,7 +14,8 @@ const helmEndpointTypes: EndpointTypeExtensionConfig[] = [{ imagePath: '/core/assets/custom/helm.svg', homeLink: (guid) => ['/monocular/repos', guid], entitySchemaKeys: monocularEntityKeys, - doesNotSupportConnect: true + doesNotSupportConnect: true, + techPreview: true, }]; @StratosExtension({ diff --git a/src/jetstream/plugins/monocular/main.go b/src/jetstream/plugins/monocular/main.go index a834164206..20913e5b25 100644 --- a/src/jetstream/plugins/monocular/main.go +++ b/src/jetstream/plugins/monocular/main.go @@ -45,19 +45,15 @@ func (m *Monocular) GetChartStore() chartsvc.ChartSvcDatastore { // Init performs plugin initialization func (m *Monocular) Init() error { - return errors.New("Manually disabled") - // #150 - Uncomment to enable helm plugin - // --------------------------------------- - // m.ConfigureSQL() - - // m.chartSvcRoutes = chartsvc.GetRoutes() - - // m.InitSync() - - // m.syncOnStartup() + if !m.portalProxy.GetConfig().EnableTechPreview { + return errors.New("Feature is in Tech Preview") + } - // return nil - // --------------------------------------- + m.ConfigureSQL() + m.chartSvcRoutes = chartsvc.GetRoutes() + m.InitSync() + m.syncOnStartup() + return nil } func (m *Monocular) syncOnStartup() { From 75ec74f585db6f026f8544057ac2fe071754abc0 Mon Sep 17 00:00:00 2001 From: Neil MacDougall Date: Thu, 22 Aug 2019 21:47:52 +0100 Subject: [PATCH 2/5] Enable kube dashboard with tech preview mode --- src/jetstream/plugins/kubernetes/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/jetstream/plugins/kubernetes/main.go b/src/jetstream/plugins/kubernetes/main.go index b8b0598ed5..5588b3b172 100644 --- a/src/jetstream/plugins/kubernetes/main.go +++ b/src/jetstream/plugins/kubernetes/main.go @@ -2,6 +2,7 @@ package kubernetes import ( "net/url" + "strconv" "strings" "errors" @@ -143,7 +144,8 @@ func (c *KubernetesSpecification) Init() error { UserInfo: c.GetGKEUserFromToken, }) - c.portalProxy.GetConfig().PluginConfig[KubeDashboardPluginConfigSetting] = "false" + // Kube dashboard is enabled by Tech Preview mode + c.portalProxy.GetConfig().PluginConfig[KubeDashboardPluginConfigSetting] = strconv.FormatBool(c.portalProxy.GetConfig().EnableTechPreview) return nil } From c78dfdef3cf280b44c1f089356f6304963980b6f Mon Sep 17 00:00:00 2001 From: Neil MacDougall Date: Wed, 28 Aug 2019 10:11:49 +0100 Subject: [PATCH 3/5] Fix bad merge issue --- src/jetstream/plugins/kubernetes/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jetstream/plugins/kubernetes/main.go b/src/jetstream/plugins/kubernetes/main.go index ed4bb07e60..ab12bfe713 100644 --- a/src/jetstream/plugins/kubernetes/main.go +++ b/src/jetstream/plugins/kubernetes/main.go @@ -97,8 +97,8 @@ func (c *KubernetesSpecification) Init() error { c.AddAuthProvider(auth.InitKubeConfigAuth(c.portalProxy)) // Kube dashboard is enabled by Tech Preview mode - c.portalProxy.GetConfig().PluginConfig[KubeDashboardPluginConfigSetting] = strconv.FormatBool(c.portalProxy.GetConfig().EnableTechPreview - + c.portalProxy.GetConfig().PluginConfig[KubeDashboardPluginConfigSetting] = strconv.FormatBool(c.portalProxy.GetConfig().EnableTechPreview) + return nil } From fdf2ba3f87b31d0e54ddb8a15059dfffd5a94ec2 Mon Sep 17 00:00:00 2001 From: Neil MacDougall Date: Wed, 28 Aug 2019 10:12:25 +0100 Subject: [PATCH 4/5] Fix bad merge issue --- src/jetstream/plugins/kubernetes/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jetstream/plugins/kubernetes/main.go b/src/jetstream/plugins/kubernetes/main.go index ab12bfe713..a6d7f13716 100644 --- a/src/jetstream/plugins/kubernetes/main.go +++ b/src/jetstream/plugins/kubernetes/main.go @@ -97,7 +97,7 @@ func (c *KubernetesSpecification) Init() error { c.AddAuthProvider(auth.InitKubeConfigAuth(c.portalProxy)) // Kube dashboard is enabled by Tech Preview mode - c.portalProxy.GetConfig().PluginConfig[KubeDashboardPluginConfigSetting] = strconv.FormatBool(c.portalProxy.GetConfig().EnableTechPreview) + c.portalProxy.GetConfig().PluginConfig[kubeDashboardPluginConfigSetting] = strconv.FormatBool(c.portalProxy.GetConfig().EnableTechPreview) return nil } From 64d772aefde060c652646809563eca6062117586 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Wed, 28 Aug 2019 14:31:10 +0100 Subject: [PATCH 5/5] Fix e2e tests --- .../cloud-foundry-list-cf-e2e.spec.ts | 13 ++-------- src/test-e2e/endpoints/endpoints-e2e.spec.ts | 25 +++---------------- src/test-e2e/po/side-nav.po.ts | 12 +++++++-- 3 files changed, 16 insertions(+), 34 deletions(-) diff --git a/src/test-e2e/cloud-foundry/cloud-foundry-list-cf-e2e.spec.ts b/src/test-e2e/cloud-foundry/cloud-foundry-list-cf-e2e.spec.ts index 68fb0bcc78..2d193d6eb6 100644 --- a/src/test-e2e/cloud-foundry/cloud-foundry-list-cf-e2e.spec.ts +++ b/src/test-e2e/cloud-foundry/cloud-foundry-list-cf-e2e.spec.ts @@ -15,17 +15,8 @@ describe('CF Endpoints Dashboard - ', () => { .clearAllEndpoints(); }); - beforeEach(() => { - nav.goto(SideNavMenuItem.CloudFoundry); - cloudFoundry.loadingIndicator.waitUntilNotShown(); - }); - - it('should be the Endpoints page', () => { - expect(cloudFoundry.isActivePage()).toBeTruthy(); - }); - - it('should show the `no registered endpoints` message', () => { - expect(cloudFoundry.hasNoCloudFoundryMessage).toBeTruthy(); + it('No CF side nav when no CF connected', () => { + expect(nav.isMenuItemPresent(SideNavMenuItem.CloudFoundry)).toBeFalsy(); }); }); diff --git a/src/test-e2e/endpoints/endpoints-e2e.spec.ts b/src/test-e2e/endpoints/endpoints-e2e.spec.ts index 486018cad5..4aa2dfbaff 100644 --- a/src/test-e2e/endpoints/endpoints-e2e.spec.ts +++ b/src/test-e2e/endpoints/endpoints-e2e.spec.ts @@ -1,18 +1,12 @@ -import { ApplicationsPage } from '../applications/applications.po'; -import { CfTopLevelPage } from '../cloud-foundry/cf-level/cf-top-level-page.po'; import { e2e } from '../e2e'; import { ConsoleUserType } from '../helpers/e2e-helpers'; import { MenuComponent } from '../po/menu.po'; import { SideNavMenuItem } from '../po/side-nav.po'; import { SnackBarPo } from '../po/snackbar.po'; -import { ServicesPage } from '../services/services.po'; import { EndpointsPage } from './endpoints.po'; describe('Endpoints', () => { const endpointsPage = new EndpointsPage(); - const applications = new ApplicationsPage(); - const services = new ServicesPage(); - const cloudFoundry = new CfTopLevelPage(); describe('Workflow on log in (admin/non-admin + no endpoints/some endpoints) -', () => { describe('As Admin -', () => { @@ -46,19 +40,8 @@ describe('Endpoints', () => { expect(endpointsPage.isActivePage()).toBeTruthy(); }); - it('Should show application wall with \'no clusters\' message', () => { - endpointsPage.sideNav.goto(SideNavMenuItem.Applications); - expect(applications.hasNoCloudFoundryMessage()).toBeTruthy(); - }); - - it('Should show services view with \'no clusters\' message', () => { - endpointsPage.sideNav.goto(SideNavMenuItem.Services); - expect(services.hasNoCloudFoundryMessage()).toBeTruthy(); - }); - - it('Should show Cloud Foundry view with \'no clusters\' message', () => { - endpointsPage.sideNav.goto(SideNavMenuItem.CloudFoundry); - expect(cloudFoundry.hasNoCloudFoundryMessage()).toBeTruthy(); + it('No CF side nav when no CF connected', () => { + expect(endpointsPage.sideNav.isMenuItemPresent(SideNavMenuItem.CloudFoundry)).toBeFalsy(); }); it('Welcome snackbar message should be displayed', () => { @@ -121,8 +104,8 @@ describe('Endpoints', () => { const menu = new MenuComponent(); menu.waitUntilShown(); menu.getItemMap().then(items => { - expect(items['connect']).toBeDefined(); - expect(items['disconnect']).not.toBeDefined(); + expect(items.connect).toBeDefined(); + expect(items.disconnect).not.toBeDefined(); }); return menu.close(); }); diff --git a/src/test-e2e/po/side-nav.po.ts b/src/test-e2e/po/side-nav.po.ts index 92ea249ebc..1e258f5509 100644 --- a/src/test-e2e/po/side-nav.po.ts +++ b/src/test-e2e/po/side-nav.po.ts @@ -1,4 +1,4 @@ -import { browser, by, element, promise } from 'protractor'; +import { browser, by, element, ElementFinder, promise } from 'protractor'; import { E2EHelpers } from '../helpers/e2e-helpers'; import { Component } from './component.po'; @@ -23,9 +23,17 @@ export class SideNavigation extends Component { // Goto the specified menu item goto(menuItem: SideNavMenuItem): promise.Promise { - return this.helpers.waitForElementAndClick(element(by.cssContainingText('.side-nav__item', menuItem))) + return this.helpers.waitForElementAndClick(this.getMenuItem(menuItem)) .then(() => browser.actions().mouseMove({ x: 500, y: 0 }).perform()) .then(() => browser.sleep(500)); } + isMenuItemPresent(menuItem: SideNavMenuItem) { + return this.getMenuItem(menuItem).isPresent(); + } + + getMenuItem(menuItem: SideNavMenuItem): ElementFinder { + return this.locator.element(by.cssContainingText('.side-nav__item', menuItem)); + } + }