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

[ENG-6280][ENG-6281] Add download dashboard buttons move archive link #2386

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@
>
<div local-class='banner'>
<img src='{{@institution.bannerUrl}}' alt='{{@institution.name}}'>
{{#if @institution.linkToExternalReportsArchive}}
<div>
<OsfLink
data-test-link-to-reports-archive
data-analytics-name='Link to archived reports'
@target='_blank'
@fakeButton={{true}}
@href={{@institution.linkToExternalReportsArchive}}
>
<EmberTooltip @side='bottom'>
{{t 'institutions.dashboard.download_past_reports_label'}}
</EmberTooltip>
<FaIcon
@icon='chart-pie'
/>
</OsfLink>
</div>
{{/if}}
</div>
<ul
data-analytics-scope='Dashboard tabs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,18 @@ input:checked + .slider::before {
margin-right: 5px;
font-weight: bold;
}

.download-button-group {
display: inline-flex;
padding-left: 10px;
align-content: center;

div {
color: #2d6a9f;
}

.download-dropdown {
margin-left: 3px;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,43 @@
</div>
{{/if}}
</BasicDropdown>
<div local-class='download-button-group'>
{{#if @institution.linkToExternalReportsArchive}}
<OsfLink
data-test-link-to-reports-archive
data-analytics-name='Link to archived reports'
@target='_blank'
@fakeButton={{true}}
@href={{@institution.linkToExternalReportsArchive}}
>
<EmberTooltip @side='bottom'>
{{t 'institutions.dashboard.download_past_reports_label'}}
</EmberTooltip>
<FaIcon @icon='chart-pie'/>
</OsfLink>
{{/if}}
<div local-class='download-dropdown'>
<ResponsiveDropdown @renderInPlace={{true}} @buttonStyling={{true}} as |dd| >
<dd.trigger data-test-download-dropdown local-class='download-dropdown-trigger'>
<FaIcon @icon='download' />
</dd.trigger>
<dd.content local-class='download-dropdown-content'>
<Button local-class='download-option' {{on 'click' (queue this.downloadCsv dd.close)}}>
{{t 'institutions.dashboard.format_labels.csv'}}
</Button>
<Button local-class='download-option' {{on 'click' (queue this.downloadTsv dd.close)}}>
{{t 'institutions.dashboard.format_labels.tsv'}}
</Button>
<Button local-class='download-option' {{on 'click' (queue this.downloadJsonTable dd.close)}}>
{{t 'institutions.dashboard.format_labels.json_table'}}
</Button>
<Button local-class='download-option' {{on 'click' (queue this.downloadJsonDirect dd.close)}}>
{{t 'institutions.dashboard.format_labels.json_direct'}}
</Button>
</dd.content>
</ResponsiveDropdown>
</div>
</div>
</div>
<PaginatedList::HasMany
local-class='table'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ module('Integration | institutions | dashboard | -components | object-list', hoo
`);

// Elements from InstitutionDashboarWrapper are present
assert.dom('[data-test-link-to-reports-archive]').exists('Link to download prior reports exists');
assert.dom('[data-test-page-tab="summary"]').exists('Summary tab exists');

// Elements in the top bar are present
Expand Down
10 changes: 10 additions & 0 deletions app/institutions/dashboard/-components/object-list/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,13 @@
.blue-text-button {
color: $color-link-dark;
}

.download-dropdown-trigger {
color: $color-bg-blue-dark;
}

.download-button-group {
align-content: center;
display: inline-flex;
padding-left: 10px;
}
39 changes: 39 additions & 0 deletions app/institutions/dashboard/-components/object-list/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,45 @@ as |list|>
</div>
</dd.content>
</ResponsiveDropdown>
<div local-class='download-button-group'>
{{#if @institution.linkToExternalReportsArchive}}
<div>
<OsfLink
data-test-link-to-reports-archive
data-analytics-name='Link to archived reports'
@target='_blank'
@fakeButton={{true}}
@href={{@institution.linkToExternalReportsArchive}}
>
<EmberTooltip @side='bottom'>
{{t 'institutions.dashboard.download_past_reports_label'}}
</EmberTooltip>
<FaIcon
@icon='chart-pie'
/>
</OsfLink>
</div>
{{/if}}
<ResponsiveDropdown @renderInPlace={{true}} @buttonStyling={{true}} as |dd| >
<dd.trigger data-test-download-dropdown local-class='download-dropdown-trigger'>
<FaIcon @icon='download' />
</dd.trigger>
<dd.content local-class='download-dropdown-content'>
<Button
local-class='download-option'
{{on 'click' (queue this.downloadCsv dd.close)}}
>
{{t 'institutions.dashboard.format_labels.csv'}}
</Button>
<Button
local-class='download-option'
{{on 'click' (queue this.downloadTsv dd.close)}}
>
{{t 'institutions.dashboard.format_labels.tsv'}}
</Button>
</dd.content>
</ResponsiveDropdown>
</div>
</div>
</div>
<div local-class='table-wrapper'>
Expand Down
10 changes: 8 additions & 2 deletions tests/acceptance/institutions/dashboard-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ module(moduleName, hooks => {
"Still at '/institutions/has-users/dashboard'.",
);

assert.dom('[data-test-link-to-reports-archive]').exists('Link to download prior reports exists');

assert.dom('[data-test-page-tab="summary"]').exists('Summary tab exists');
assert.dom('[data-test-page-tab="users"]').exists('Users tab exists');
assert.dom('[data-test-page-tab="projects"]').exists('Projects tab exists');
Expand All @@ -38,21 +36,29 @@ module(moduleName, hooks => {
await click('[data-test-page-tab="users"]');
await percySnapshot(`${moduleName} - users`);
assert.dom('[data-test-page-tab="users"]').hasClass('active', 'Users tab is active');
assert.dom('[data-test-link-to-reports-archive]').exists('Link to download prior reports exists');
assert.dom('[data-test-download-dropdown]').exists('Link to download file formats');

// Projects tab
await click('[data-test-page-tab="projects"]');
await percySnapshot(`${moduleName} - projects`);
assert.dom('[data-test-page-tab="projects"]').hasClass('active', 'Projects tab is active');
assert.dom('[data-test-link-to-reports-archive]').exists('Link to download prior reports exists');
assert.dom('[data-test-download-dropdown]').exists('Link to download file formats');

// Registrations tab
await click('[data-test-page-tab="registrations"]');
await percySnapshot(`${moduleName} - registrations`);
assert.dom('[data-test-page-tab="registrations"]').hasClass('active', 'Registrations tab is active');
assert.dom('[data-test-link-to-reports-archive]').exists('Link to download prior reports exists');
assert.dom('[data-test-download-dropdown]').exists('Link to download file formats');

// Preprints tab
await click('[data-test-page-tab="preprints"]');
await percySnapshot(`${moduleName} - preprints`);
assert.dom('[data-test-page-tab="preprints"]').hasClass('active', 'Preprints tab is active');
assert.dom('[data-test-link-to-reports-archive]').exists('Link to download prior reports exists');
assert.dom('[data-test-download-dropdown]').exists('Link to download file formats');
});

test('institutions dashboard: projects, registrations, and preprints tab', async function(assert) {
Expand Down
7 changes: 7 additions & 0 deletions translations/en-us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,13 @@ institutions:
title: '{institutionName} Dashboard'
download_past_reports_label: 'Previous reports'
download_csv: 'Download CSV'
download_tsv: 'Download TSV'
format_labels:
csv: '.csv'
tsv: '.tsv'
json_table: 'JSON (table)'
json_direct: 'JSON (direct)'
download: 'Download'
select_default: 'All Departments'
users_list:
name: Name
Expand Down
Loading