From b9fec38b7c9779092197d8e8f2b269e66d05e5e6 Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Mon, 25 Nov 2024 17:30:58 -0500 Subject: [PATCH 1/6] Integrate user download funcitonality --- .../institutional-users-list/component.ts | 23 ++++++++++++++- .../institutional-users-list/styles.scss | 5 ++++ .../institutional-users-list/template.hbs | 29 ++++++++++++------- translations/en-us.yml | 1 + 4 files changed, 47 insertions(+), 11 deletions(-) diff --git a/app/institutions/dashboard/-components/institutional-users-list/component.ts b/app/institutions/dashboard/-components/institutional-users-list/component.ts index 62c32591dc..d47910c689 100644 --- a/app/institutions/dashboard/-components/institutional-users-list/component.ts +++ b/app/institutions/dashboard/-components/institutional-users-list/component.ts @@ -9,6 +9,7 @@ import Intl from 'ember-intl/services/intl'; import InstitutionModel from 'ember-osf-web/models/institution'; import InstitutionDepartmentsModel from 'ember-osf-web/models/institution-department'; import Analytics from 'ember-osf-web/services/analytics'; +import { RelationshipWithLinks } from 'osf-api'; interface Column { key: string; @@ -184,6 +185,27 @@ export default class InstitutionalUsersList extends Component - - - - + + + {{t 'institutions.dashboard.format_labels.json'}} + diff --git a/translations/en-us.yml b/translations/en-us.yml index 0416c52097..8fa1318100 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -818,6 +818,7 @@ institutions: format_labels: csv: '.csv' tsv: '.tsv' + json: 'JSON' json_table: 'JSON (table)' json_direct: 'JSON (direct)' download: 'Download' From eaec875b1d05245f93697375148c00984e899d52 Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Mon, 25 Nov 2024 18:53:48 -0500 Subject: [PATCH 2/6] Tests and analytics --- .../institutional-users-list/template.hbs | 6 ++++++ .../component-test.ts | 21 ++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/institutions/dashboard/-components/institutional-users-list/template.hbs b/app/institutions/dashboard/-components/institutional-users-list/template.hbs index 875a8c5fab..e6689f5e62 100644 --- a/app/institutions/dashboard/-components/institutional-users-list/template.hbs +++ b/app/institutions/dashboard/-components/institutional-users-list/template.hbs @@ -95,6 +95,8 @@ + `); assert.dom('[data-test-header]') .exists({ count: 9 }, '9 default headers'); @@ -70,6 +70,11 @@ module('Integration | routes | institutions | dashboard | -components | institut .exists({ count: 5 }, '5 in the list with public project'); assert.dom('[data-test-item="privateProjects"]') .exists({ count: 5 }, '5 in the list with private projects'); + + // Test download buttons + assert.dom('[data-test-download-csv]').exists('CSV download button'); + assert.dom('[data-test-download-tsv]').exists('TSV download button'); + assert.dom('[data-test-download-json]').exists('JSON download button'); }); test('it sorts', async function(assert) { @@ -105,10 +110,10 @@ module('Integration | routes | institutions | dashboard | -components | institut this.set('model', model); await render(hbs` - + `); assert.dom('[data-test-item="user_name"]') .exists({ count: 3 }, '3 users'); From 5d5cc130a409cba710ec54f0c7fec78e6e641d17 Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Tue, 26 Nov 2024 14:01:58 -0500 Subject: [PATCH 3/6] Update styles --- .../-components/institutional-users-list/styles.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/institutions/dashboard/-components/institutional-users-list/styles.scss b/app/institutions/dashboard/-components/institutional-users-list/styles.scss index c47b301306..12bebe7345 100644 --- a/app/institutions/dashboard/-components/institutional-users-list/styles.scss +++ b/app/institutions/dashboard/-components/institutional-users-list/styles.scss @@ -9,6 +9,10 @@ .download-dropdown-content { display: flex; flex-direction: column; + align-items: flex-start; + border: 1px solid $color-border-gray; + padding: 8px; + width: max-content; } .table { From a24039ae83cc812e12f462d53c00c577c7375d20 Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Tue, 26 Nov 2024 14:06:13 -0500 Subject: [PATCH 4/6] Update test selectors --- .../-components/institutional-users-list/component-test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/routes/institutions/dashboard/-components/institutional-users-list/component-test.ts b/tests/integration/routes/institutions/dashboard/-components/institutional-users-list/component-test.ts index 9aded532b9..c17f9e4381 100644 --- a/tests/integration/routes/institutions/dashboard/-components/institutional-users-list/component-test.ts +++ b/tests/integration/routes/institutions/dashboard/-components/institutional-users-list/component-test.ts @@ -72,9 +72,9 @@ module('Integration | routes | institutions | dashboard | -components | institut .exists({ count: 5 }, '5 in the list with private projects'); // Test download buttons - assert.dom('[data-test-download-csv]').exists('CSV download button'); - assert.dom('[data-test-download-tsv]').exists('TSV download button'); - assert.dom('[data-test-download-json]').exists('JSON download button'); + assert.dom('[data-test-csv-download-button]').exists('CSV download button'); + assert.dom('[data-test-tsv-download-button]').exists('TSV download button'); + assert.dom('[data-test-json-download-button]').exists('JSON download button'); }); test('it sorts', async function(assert) { From 0717aa7d635104c64a62515c538ec2e4a22aba5f Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Tue, 26 Nov 2024 14:48:41 -0500 Subject: [PATCH 5/6] Actually fix test this time --- .../-components/institutional-users-list/component-test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/routes/institutions/dashboard/-components/institutional-users-list/component-test.ts b/tests/integration/routes/institutions/dashboard/-components/institutional-users-list/component-test.ts index c17f9e4381..6faf08a688 100644 --- a/tests/integration/routes/institutions/dashboard/-components/institutional-users-list/component-test.ts +++ b/tests/integration/routes/institutions/dashboard/-components/institutional-users-list/component-test.ts @@ -72,6 +72,7 @@ module('Integration | routes | institutions | dashboard | -components | institut .exists({ count: 5 }, '5 in the list with private projects'); // Test download buttons + await click('[data-test-download-dropdown]'); assert.dom('[data-test-csv-download-button]').exists('CSV download button'); assert.dom('[data-test-tsv-download-button]').exists('TSV download button'); assert.dom('[data-test-json-download-button]').exists('JSON download button'); From e1d5a908635d7a1637acf3abb0b06ca1f1be731f Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Tue, 26 Nov 2024 15:47:16 -0500 Subject: [PATCH 6/6] Clean up --- .../dashboard/-components/institutional-users-list/template.hbs | 1 + translations/en-us.yml | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/institutions/dashboard/-components/institutional-users-list/template.hbs b/app/institutions/dashboard/-components/institutional-users-list/template.hbs index e6689f5e62..c36eeb8be3 100644 --- a/app/institutions/dashboard/-components/institutional-users-list/template.hbs +++ b/app/institutions/dashboard/-components/institutional-users-list/template.hbs @@ -88,6 +88,7 @@ diff --git a/translations/en-us.yml b/translations/en-us.yml index 8fa1318100..7c52167096 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -819,8 +819,6 @@ institutions: csv: '.csv' tsv: '.tsv' json: 'JSON' - json_table: 'JSON (table)' - json_direct: 'JSON (direct)' download: 'Download' select_default: 'All Departments' users_list: