Skip to content

Commit 0334f28

Browse files
committed
Merge branch 'release/20.7.0'
2 parents 0e16d7b + e6c5337 commit 0334f28

File tree

8 files changed

+34
-42
lines changed

8 files changed

+34
-42
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [20.7.0] - 2020-07-01
8+
## Added
9+
- user metrics CSV export on the institutional dashboard
10+
711
## [20.6.1] - 2020-06-29
812
## Fixed
913
- broken UI due to `ember-responsive` ignoring our `app/breakpoints.ts`
@@ -1615,7 +1619,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
16151619
### Added
16161620
- Quick Files
16171621

1618-
[Unreleased]: https://github.com/CenterForOpenScience/ember-osf-web/compare/20.6.1...develop
1622+
[Unreleased]: https://github.com/CenterForOpenScience/ember-osf-web/compare/20.7.0...develop
1623+
[20.7.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/20.7.0
16191624
[20.6.1]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/20.6.1
16201625
[20.6.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/20.6.0
16211626
[20.5.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/20.5.0

app/institutions/dashboard/controller.ts

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
1-
import { action, computed } from '@ember/object';
1+
import Controller from '@ember/controller';
2+
import { computed } from '@ember/object';
23
import { alias } from '@ember/object/computed';
4+
import { inject as service } from '@ember/service';
35

4-
import Controller from '@ember/controller';
56
import { InstitutionsDashboardModel } from 'ember-osf-web/institutions/dashboard/route';
67
import InstitutionModel from 'ember-osf-web/models/institution';
78
import InstitutionDepartmentModel from 'ember-osf-web/models/institution-department';
89
import InstitutionSummaryMetricModel from 'ember-osf-web/models/institution-summary-metric';
10+
import CurrentUser from 'ember-osf-web/services/current-user';
11+
import { addQueryParam } from 'ember-osf-web/utils/url-parts';
912

1013
export default class InstitutionsDashboardController extends Controller {
14+
@service currentUser!: CurrentUser;
15+
1116
@alias('model.taskInstance.value') modelValue?: InstitutionsDashboardModel;
1217
@alias('modelValue.institution') institution?: InstitutionModel;
1318
@alias('modelValue.summaryMetrics') summaryMetrics?: InstitutionSummaryMetricModel;
1419
@alias('modelValue.departmentMetrics') departmentMetrics?: InstitutionDepartmentModel[];
1520
@alias('modelValue.totalUsers') totalUsers?: number;
1621

17-
csvImgSrc: string = '/assets/images/institutions/csv.svg';
18-
19-
// TODO: add csv link back when ENG-1810 is done
20-
@computed('institution.links.csv')
21-
get csvHref() {
22-
// return this.institution ? this.institution.links.csv : '#';
23-
return '#';
24-
}
25-
26-
@action
27-
onCsvButtonMouseEnter() {
28-
this.set('csvImgSrc', '/assets/images/institutions/csv-hover.svg');
29-
}
30-
31-
@action
32-
onCsvButtonMouseLeave() {
33-
this.set('csvImgSrc', '/assets/images/institutions/csv.svg');
22+
@computed('institution')
23+
get csvHref(): string {
24+
const { institution } = this;
25+
if (institution) {
26+
const url = institution.hasMany('userMetrics').link();
27+
return addQueryParam(url, 'format', 'csv');
28+
}
29+
return '';
3430
}
3531
}
3632

app/institutions/dashboard/styles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
}
2525

2626
.csv-button {
27+
display: inline-block;
2728
width: 40px;
2829
height: 40px;
2930
background: #fff;

app/institutions/dashboard/template.hbs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,17 @@
1313
/>
1414
</div>
1515
<div local-class='panel-wrapper'>
16-
{{!-- TODO: comment this back in when ENG-1810 is implemented + tested + merged--}}
17-
{{!-- <OsfLink
18-
data-analytics-name='Download CSV'
19-
class='btn btn-primary'
20-
local-class='csv-button'
21-
@target='_blank'
22-
@href={{this.csvHref}}
23-
onmouseenter={{action 'onCsvButtonMouseEnter'}}
24-
onmouseleave={{action 'onCsvButtonMouseLeave'}}
25-
>
26-
<img src={{this.csvImgSrc}}
27-
alt={{t 'institutions.dashboard.download_csv'}}
16+
{{#if this.csvHref}}
17+
<OsfLink
18+
data-analytics-name='Download CSV'
19+
aria-label={{t 'institutions.dashboard.download_csv'}}
20+
local-class='csv-button'
21+
download='user-metrics.csv'
22+
@href={{this.csvHref}}
2823
>
29-
</OsfLink> --}}
24+
<FaIcon @icon='table' />
25+
</OsfLink>
26+
{{/if}}
3027
<Institutions::Dashboard::-Components::Panel
3128
local-class='sso-users-connected'
3229
@isLoading={{this.model.taskInstance.isRunning}}

app/models/institution.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@ import InstitutionSummaryMetricModel from 'ember-osf-web/models/institution-summ
66
import InstitutionDepartmentsModel from './institution-department';
77
import InstitutionUserModel from './institution-user';
88
import NodeModel from './node';
9-
import OsfModel, { OsfLinks } from './osf-model';
9+
import OsfModel from './osf-model';
1010
import RegistrationModel from './registration';
1111
import UserModel from './user';
1212

1313
const { attr, belongsTo, hasMany } = DS;
1414

15-
export interface InstitutionLinks extends OsfLinks {
16-
csv: string;
17-
}
18-
1915
/* eslint-disable camelcase */
2016
export interface Assets {
2117
banner?: string;
@@ -30,7 +26,6 @@ export interface Department {
3026
}
3127

3228
export default class InstitutionModel extends OsfModel {
33-
@attr() links!: InstitutionLinks;
3429
@attr('string') name!: string;
3530
@attr('fixstring') description!: string;
3631
@attr('string') authUrl!: string;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ember-osf-web",
3-
"version": "20.6.1",
3+
"version": "20.7.0",
44
"description": "Ember front-end for the Open Science Framework",
55
"license": "Apache-2.0",
66
"author": "Center for Open Science <[email protected]>",

public/assets/images/institutions/csv-hover.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/assets/images/institutions/csv.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)