From f220f7f0bb75feb9dc7af24fbab3ab8d86a43ce1 Mon Sep 17 00:00:00 2001 From: yacchin1205 <968739+yacchin1205@users.noreply.github.com> Date: Mon, 27 Jul 2026 15:36:33 +0900 Subject: [PATCH] Add JAIRO Cloud publication support to the service switcher --- app/styles/_components.scss | 15 +++++++++------ config/environment.d.ts | 1 + config/environment.js | 2 ++ .../addon/components/osf-navbar/component.ts | 19 ++++++------------- .../addon/components/osf-navbar/template.hbs | 5 +---- tests/acceptance/dashboard-test.ts | 2 +- tests/acceptance/guid-user/quickfiles-test.ts | 4 ++-- .../components/osf-navbar/component-test.ts | 2 +- 8 files changed, 23 insertions(+), 27 deletions(-) diff --git a/app/styles/_components.scss b/app/styles/_components.scss index 9efe773a7..8ec40c902 100644 --- a/app/styles/_components.scss +++ b/app/styles/_components.scss @@ -799,11 +799,6 @@ font-size: 24px; } } - - /* Decreases distance between "OSF" and current service "PREPRINTS", for example */ - .current-service { - margin-left: -4px; - } } /* Overrides the color, relative position, and font size of dropdown menus (both service and auth) */ @@ -813,11 +808,15 @@ &.service-dropdown { top: 17px; left: -120px; - width: 200px; + width: auto; li>a { font-size: 18px; } + + @media (max-width: 767px) { + left: -54px; + } } &.auth-dropdown { @@ -849,6 +848,10 @@ content: ''; top: -8px; left: 126px; + + @media (max-width: 767px) { + left: 61px; + } } } diff --git a/config/environment.d.ts b/config/environment.d.ts index 0adecbf4f..c604638d3 100644 --- a/config/environment.d.ts +++ b/config/environment.d.ts @@ -74,6 +74,7 @@ declare const config: { backend: string; redirectUri?: string; url: string; + oasysUrl: string; webApiNamespace: string; apiUrl: string; apiVersion: string; diff --git a/config/environment.js b/config/environment.js index c7c8c1628..eeea7cc16 100644 --- a/config/environment.js +++ b/config/environment.js @@ -43,6 +43,7 @@ const { OSF_STATUS_COOKIE: statusCookie = 'osf_status', OSF_COOKIE_DOMAIN: cookieDomain = 'localhost', OSF_URL: url = 'http://localhost:5000/', + OASYS_URL: oasysUrl = '', OSF_API_URL: apiUrl = 'http://localhost:8000', OSF_API_VERSION: apiVersion = '2.20', OSF_RENDER_URL: renderUrl = 'http://localhost:7778/render', @@ -167,6 +168,7 @@ module.exports = function(environment) { backend, redirectUri, url, + oasysUrl, webApiNamespace: 'api/v1', apiUrl, apiVersion, diff --git a/lib/osf-components/addon/components/osf-navbar/component.ts b/lib/osf-components/addon/components/osf-navbar/component.ts index 79eafd215..e4f077ebc 100644 --- a/lib/osf-components/addon/components/osf-navbar/component.ts +++ b/lib/osf-components/addon/components/osf-navbar/component.ts @@ -12,35 +12,28 @@ import defaultTo from 'ember-osf-web/utils/default-to'; import styles from './styles'; import template from './template'; -const osfURL = config.OSF.url; +const oasysURL = config.OSF.oasysUrl; +const { pageName } = config.OSF; export enum OSFService { HOME = 'HOME', - PREPRINTS = 'PREPRINTS', - REGISTRIES = 'REGISTRIES', - MEETINGS = 'MEETINGS', - INSTITUTIONS = 'INSTITUTIONS', + JAIRO_CLOUD = 'JAIRO Cloud公開支援機能', } interface ServiceLink { name: string; + label: string; route?: string; href?: string; disabled?: boolean; } export const OSF_SERVICES: ServiceLink[] = [ - { name: OSFService.HOME, route: 'home' }, - { name: OSFService.PREPRINTS, href: `${osfURL}preprints/` }, - { name: OSFService.REGISTRIES, route: 'registries', disabled: true }, - { name: OSFService.MEETINGS, route: 'meetings' }, - { name: OSFService.INSTITUTIONS, route: 'institutions' }, + { name: OSFService.HOME, label: pageName, route: 'home' }, + ...(oasysURL ? [{ name: OSFService.JAIRO_CLOUD, label: OSFService.JAIRO_CLOUD, href: oasysURL }] : []), ]; const { - OSF: { - pageName, - }, navbar: { useDropdown, }, diff --git a/lib/osf-components/addon/components/osf-navbar/template.hbs b/lib/osf-components/addon/components/osf-navbar/template.hbs index 1ddfb092c..3414ed5a0 100644 --- a/lib/osf-components/addon/components/osf-navbar/template.hbs +++ b/lib/osf-components/addon/components/osf-navbar/template.hbs @@ -21,9 +21,6 @@ @href={{this._activeService.href}} > - {{#if this.useNavDropdown}} - {{this._activeService.name}} - {{/if}} @@ -50,7 +47,7 @@ @route={{service.route}} @href={{service.href}} > - {{t 'general.OSF' title=this.title}}{{service.name}} + {{service.label}} {{/each}} diff --git a/tests/acceptance/dashboard-test.ts b/tests/acceptance/dashboard-test.ts index 3d1eb28fe..67474e00a 100644 --- a/tests/acceptance/dashboard-test.ts +++ b/tests/acceptance/dashboard-test.ts @@ -45,7 +45,7 @@ module('Acceptance | dashboard', hooks => { assert.equal(currentURL(), '/dashboard', 'We stayed on the proper page'); assert.dom('nav.navbar').exists(); - assert.dom('nav.navbar .service-name').hasText('OSF HOME'); + assert.dom('nav.navbar .service-name').hasText('OSF'); assert.dom('nav.navbar .secondary-nav-dropdown .nav-profile-name') .hasText(currentUser.fullName, 'User\'s name is in navbar'); diff --git a/tests/acceptance/guid-user/quickfiles-test.ts b/tests/acceptance/guid-user/quickfiles-test.ts index bd242fa5f..ff1433533 100644 --- a/tests/acceptance/guid-user/quickfiles-test.ts +++ b/tests/acceptance/guid-user/quickfiles-test.ts @@ -30,7 +30,7 @@ module('Acceptance | Guid User Quickfiles', hooks => { 'Should have element after visit (guid routing / visit helper problem)', ); assert.dom('nav.navbar').exists(); - assert.dom('nav.navbar .service-name').hasText('OSF HOME'); + assert.dom('nav.navbar .service-name').hasText('OSF'); assert.dom('nav.navbar .secondary-nav-dropdown').doesNotExist('Should not have user menu if not logged in'); const files = this.element.querySelectorAll('[data-test-file-item-link]'); assert.equal(files.length, 5, `Check for proper number of files in list. Found ${files.length}`); @@ -42,7 +42,7 @@ module('Acceptance | Guid User Quickfiles', hooks => { server.createList('file', 5, { user }); await visit(`/--user/${user.id}/quickfiles`); assert.dom('nav.navbar').exists(); - assert.dom('nav.navbar .service-name').hasText('OSF HOME'); + assert.dom('nav.navbar .service-name').hasText('OSF'); assert.dom('nav.navbar .secondary-nav-dropdown .nav-profile-name') .hasText(currentUser.fullName, 'User\'s name is in navbar'); const files = this.element.querySelectorAll('[data-test-file-item-link]'); diff --git a/tests/integration/components/osf-navbar/component-test.ts b/tests/integration/components/osf-navbar/component-test.ts index 22e7fdb98..9d711e066 100644 --- a/tests/integration/components/osf-navbar/component-test.ts +++ b/tests/integration/components/osf-navbar/component-test.ts @@ -27,7 +27,7 @@ module('Integration | Component | osf-navbar', hooks => { test('it renders', async assert => { await render(hbs`{{osf-navbar}}`); assert.dom('.service-name').includesText('OSF'); - assert.dom('.current-service').hasText('HOME'); + assert.dom('.current-service').doesNotExist(); }); test('service-dropdown: logged in', async function(assert) {