diff --git a/changes.d/1982.feat.md b/changes.d/1982.feat.md new file mode 100644 index 000000000..4d9dc76d1 --- /dev/null +++ b/changes.d/1982.feat.md @@ -0,0 +1 @@ +Add link to Jupyter Lab from the Dashboard (if Jupyter Lab is installed). diff --git a/package.json b/package.json index 141de90df..28232714e 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "mitt": "3.0.1", "nprogress": "1.0.0-1", "preact": "10.24.3", + "simple-icons": "2.17.1", "subscriptions-transport-ws": "0.11.0", "svg-pan-zoom": "3.6.2", "vue": "3.4.11", diff --git a/src/model/User.model.js b/src/model/User.model.js index ab447859b..d3517ca2c 100644 --- a/src/model/User.model.js +++ b/src/model/User.model.js @@ -16,7 +16,7 @@ */ export default class User { - constructor ({ username, owner, permissions, mode, initials, color }) { + constructor ({ username, owner, permissions, mode, initials, color, extensions }) { /** * @type {string} */ @@ -47,5 +47,9 @@ export default class User { * @type {string | null} */ this.color = color + /** + * Jupyter server extensions. + */ + this.extensions = extensions } } diff --git a/src/utils/icons.js b/src/utils/icons.js new file mode 100644 index 000000000..6394085c2 --- /dev/null +++ b/src/utils/icons.js @@ -0,0 +1,32 @@ +/** + * Copyright (C) NIWA & British Crown (Met Office) & Contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * SVG icons for use in the Cylc UI: + * - Centralise icons for use throughout multiple components. + * - Define custom icons. + * - Reformat icons for other source. + * + * Note, the `` component expects icons in the MDI format i.e.: + * - A string representing an SVG path. + * - Consisting of a bezier curve (e.g. `M 0,0 C 1,1 Z`). + * - That fits within a 24px box. + */ + +import { Jupyter } from 'simple-icons' + +export const jupyterLogo = Jupyter.svg.replace(/.*d="(.*)".*/, '$1') diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 62a2ee101..71d047378 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -95,6 +95,27 @@ along with this program. If not, see . You are not running Cylc UI via Cylc Hub. +
+ + + + Jupyter Lab + + + Open Jupyter Lab in a new browser tab. + + + + Jupyter Lab is not installed. + +
@@ -141,6 +162,7 @@ along with this program. If not, see . diff --git a/src/views/UserProfile.vue b/src/views/UserProfile.vue index b5c62e190..3d34de22d 100644 --- a/src/views/UserProfile.vue +++ b/src/views/UserProfile.vue @@ -48,6 +48,21 @@ along with this program. If not, see . + + + Jupyter Server Extensions + + + + + + {{ $t('UserProfile.permissions') }} diff --git a/tests/e2e/specs/dashboard.cy.js b/tests/e2e/specs/dashboard.cy.js index a7e0e568a..f5e67e6a9 100644 --- a/tests/e2e/specs/dashboard.cy.js +++ b/tests/e2e/specs/dashboard.cy.js @@ -54,6 +54,12 @@ describe('Dashboard', () => { .should('have.class', 'v-list-item--disabled') }) + it('Disables Jupyter Lab button when not installed', () => { + cy + .get('#jupyter-lab-button') + .should('have.class', 'v-list-item--disabled') + }) + for (const ref of ['workflow-table-link', 'user-settings-link', 'quickstart-link']) { it(`Visits ${ref}`, () => { cy.get(`[data-cy=${ref}`) diff --git a/yarn.lock b/yarn.lock index 462b14b5a..4f1c6b945 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3609,6 +3609,7 @@ __metadata: nyc: "npm:17.1.0" preact: "npm:10.24.3" sass: "npm:1.77.8" + simple-icons: "npm:2.17.1" sinon: "npm:19.0.2" standard: "npm:17.1.2" subscriptions-transport-ws: "npm:0.11.0" @@ -8984,6 +8985,13 @@ __metadata: languageName: node linkType: hard +"simple-icons@npm:2.17.1": + version: 2.17.1 + resolution: "simple-icons@npm:2.17.1" + checksum: 10c0/134bcac6e5c9f737dafe2d24a323f78259dd5a8bb31ea0034469ccac837242ec75982a1fd63e23e33f516e0fedb65cb254209e414142ac4d6ccb75d5fba041ee + languageName: node + linkType: hard + "simple-update-notifier@npm:^2.0.0": version: 2.0.0 resolution: "simple-update-notifier@npm:2.0.0"