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

fix(centraldash): fix quickling broken on params #243

Merged
merged 14 commits into from
Feb 3, 2025
33 changes: 19 additions & 14 deletions components/centraldashboard/cypress/e2e/main-page.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,31 @@ describe('Main Page', () => {
cy.get('main-page').shadow().find('dashboard-view').should('exist');
// create new notebook link
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Quick-Links').should('exist');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Quick-Links').find('iframe-link').should('exist').and('have.length', 1).and('have.prop', 'href', '/en/new?ns=test-namespace');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Quick-Links').find('iframe-link').should('exist').and('have.length', 1).and('have.prop', 'href', '/en/new');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Quick-Links').find('iframe-link').find('div.header').should('have.text', 'Create a new Notebook server');
// documentation links
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').should('exist');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').should('have.length', 4);
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(0).should('have.prop', 'href', 'https://statcan.github.io/aaw/');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(0).find('div.header').should('have.text', 'Advanced Analytics Workspace Docs');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').should('have.length', 5);
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(0).should('have.prop', 'href', 'https://zone.pages.cloud.statcan.ca/docs/en/');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(0).find('div.header').should('have.text', 'The Zone Documentation');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(0).find('aside').should('have.text', 'Helpful guides about our data and analysis tools');

cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(1).should('have.prop', 'href', 'https://www.youtube.com/playlist?list=PL1zlA2D7AHugkDdiyeUHWOKGKUd3MB_nD');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(1).find('div.header').should('have.text', 'Video Tutorial Series');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(1).find('aside').should('have.text', 'YouTube playlist of videos for getting started with Advanced Analytics Workspace tools');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(1).should('have.prop', 'href', 'https://054gc.sharepoint.com/:v:/s/BusinessTransformationProject-Projetdetransformationd%27affaires/EadkAnASIZpMtwg_AFcrpKgBB7m7DujjRW1qytlcvgtzyw?e=C43f5v');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(1).find('div.header').should('have.text', 'The Zone Workshop');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(1).find('aside').should('have.text', 'Basic instructions when new to the zone!');

cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(2).should('have.prop', 'href', 'https://statcan-aaw.slack.com/');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(2).find('div.header').should('have.text', 'Community Chat');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(2).find('aside').should('have.text', 'Slack workspace for discussion/support - requires sign-up for emails outside @canada.ca');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(2).should('have.prop', 'href', 'https://054gc-my.sharepoint.com/:v:/g/personal/souheil_yazji_statcan_gc_ca/EdEcN9rRejJNt_WaxAmO5h0Bsi-PK3ZbTDrIxaka9yr0mA?e=sxEmIP&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(2).find('div.header').should('have.text', 'Advanced Instructions Video 1');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(2).find('aside').should('have.text', 'Instruction for advanced users part 1');

cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(3).should('have.prop', 'href', 'https://054gc-my.sharepoint.com/:v:/g/personal/souheil_yazji_statcan_gc_ca/EX4R2PbQmm5DjeXzL2DQtuUBgp1MJiQ2GCoWtxqcVBGuwQ?e=PCfB2f');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(3).find('div.header').should('have.text', 'Advanced Instructions Video 2');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(3).find('aside').should('have.text', 'Instruction for advanced users part 2');

cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(4).should('have.prop', 'href', 'https://054gc-my.sharepoint.com/:v:/g/personal/souheil_yazji_statcan_gc_ca/Eb6J5KMIPWZAoU33m7iesZkBs1HDx0OT8rLSn_Sr-QtlnA?e=8Ni8jg');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(4).find('div.header').should('have.text', 'Advanced Instructions Video 3');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(4).find('aside').should('have.text', 'Instruction for advanced users part 3');

cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(3).should('have.prop', 'href', 'https://www.kubeflow.org/docs/');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(3).find('div.header').should('have.text', 'Official Kubeflow Docs');
cy.get('main-page').shadow().find('dashboard-view').shadow().find('paper-card#Documentation').find('a').eq(3).find('aside').should('have.text', 'Advanced documentation for installing, running, and using Kubeflow');
//activities tab
cy.get('main-page').shadow().find('#ViewTabs > paper-tabs > paper-tab:nth-child(2)').click();
cy.url().should('eq', 'http://localhost:8080/activity?ns=test-namespace');
Expand Down Expand Up @@ -238,4 +243,4 @@ describe('Main Page', () => {
cy.get('main-page').shadow().find('dashboard-view').shadow().find('notebook-default-card').shadow().find('paper-toast#DefaultNotebookSuccess').should('have.text', "New default notebook successfully created!");
});
});
})
})
43 changes: 30 additions & 13 deletions components/centraldashboard/cypress/fixtures/dashboard-links.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,49 @@
{
"text": "Create a new Notebook server",
"desc": "Notebook Servers",
"link": "/en/new?ns={ns}",
"link": "/en/new",
"type": "internal"
},
{
"text": "New Feature Request",
"desc": "Request a new feature",
"link": "https://jirab.statcan.ca/browse/ZPS",
"type": "external"
},
{
"text": "Report a Bug",
"desc": "If an unexpected error occurs within the Zone",
"link": "https://teams.microsoft.com/l/channel/19%3A6b1e8caa87c34cab8ea7aaca66431bf0%40thread.tacv2/Incident%20Report%20-%20Rapport%20d%20incident?groupId=0650f167-deca-4966-b84f-b3494ab40b1d",
"type": "external"
}
],
"documentationItems": [
{
"text": "Advanced Analytics Workspace Docs",
"text": "The Zone Documentation",
"desc": "Helpful guides about our data and analysis tools",
"link": "https://statcan.github.io/aaw/"
"link": "https://zone.pages.cloud.statcan.ca/docs/en/"
},
{
"text": "Video Tutorial Series",
"desc": "YouTube playlist of videos for getting started with Advanced Analytics Workspace tools",
"link": "https://www.youtube.com/playlist?list=PL1zlA2D7AHugkDdiyeUHWOKGKUd3MB_nD"
"text": "The Zone Workshop",
"desc": "Basic instructions when new to the zone!",
"link": "https://054gc.sharepoint.com/:v:/s/BusinessTransformationProject-Projetdetransformationd%27affaires/EadkAnASIZpMtwg_AFcrpKgBB7m7DujjRW1qytlcvgtzyw?e=C43f5v"
},
{
"text": "Community Chat",
"desc": "Slack workspace for discussion/support - requires sign-up for emails outside @canada.ca",
"link": "https://statcan-aaw.slack.com/"
"text": "Advanced Instructions Video 1",
"desc": "Instruction for advanced users part 1",
"link": "https://054gc-my.sharepoint.com/:v:/g/personal/souheil_yazji_statcan_gc_ca/EdEcN9rRejJNt_WaxAmO5h0Bsi-PK3ZbTDrIxaka9yr0mA?e=sxEmIP&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D"
},
{
"text": "Official Kubeflow Docs",
"desc": "Advanced documentation for installing, running, and using Kubeflow",
"link": "https://www.kubeflow.org/docs/"
"text": "Advanced Instructions Video 2",
"desc": "Instruction for advanced users part 2",
"link": "https://054gc-my.sharepoint.com/:v:/g/personal/souheil_yazji_statcan_gc_ca/EX4R2PbQmm5DjeXzL2DQtuUBgp1MJiQ2GCoWtxqcVBGuwQ?e=PCfB2f"
},
{
"text": "Advanced Instructions Video 3",
"desc": "Instruction for advanced users part 3",
"link": "https://054gc-my.sharepoint.com/:v:/g/personal/souheil_yazji_statcan_gc_ca/Eb6J5KMIPWZAoU33m7iesZkBs1HDx0OT8rLSn_Sr-QtlnA?e=8Ni8jg"
}
],
],
"securityMessages": [
"Statistics Canada networks are routinely monitored to ensure user compliance with the DAS Terms and Conditions. Inappropriate or unauthorized use of DAS will result in removal of all privileges and access to the DAS environments."
]
Expand Down
20 changes: 1 addition & 19 deletions components/centraldashboard/public/components/dashboard-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import './pipelines-card.js';
import './resource-chart.js';
import {getGCPData} from './resources/cloud-platform-data.js';
import utilitiesMixin from './utilities-mixin.js';

// eslint-disable-next-line max-len
export class DashboardView extends mixinBehaviors([AppLocalizeBehavior], utilitiesMixin(PolymerElement)) {
static get template() {
Expand All @@ -40,10 +39,7 @@ export class DashboardView extends mixinBehaviors([AppLocalizeBehavior], utiliti
documentationItems: Array,
quickLinks: Array,
securityMessages: Array,
namespace: {
type: Object,
observer: '_namespaceChanged',
},
namespace: Object,
platformDetails: Object,
metrics: Object,
platformInfo: {
Expand All @@ -67,20 +63,6 @@ export class DashboardView extends mixinBehaviors([AppLocalizeBehavior], utiliti
this.platformDetails = getGCPData(gcpProject);
}
}

/**
* Rewrites the links adding the namespace as a query parameter.
* @param {namespace} namespace
*/
_namespaceChanged(namespace) {
this.quickLinks.map((quickLink) => {
quickLink.link = this.buildHref(quickLink.link, {ns: namespace});
return quickLink;
});
// We need to deep-copy and re-assign in order to trigger the
// re-rendering of the component
this.quickLinks = JSON.parse(JSON.stringify(this.quickLinks));
}
}

customElements.define('dashboard-view', DashboardView);
Loading