-
Notifications
You must be signed in to change notification settings - Fork 57
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-5024] feature/insti-dash-improv #2395
Merged
Merged
Changes from all commits
Commits
Show all changes
110 commits
Select commit
Hold shift + click to select a range
f8b6683
[ENG-6074] Rework institutions dashboard page (#2289)
futa-ikeda 9b3174a
update user model for institutional dashboard (#2299)
Johnetordoff 6028288
[ENG-6078][ENG-6080] Link to past reports (#2296)
futa-ikeda 1ef837e
Link to reports updates (#2302)
futa-ikeda 5cc1654
[ENG-6116] Sort User Columns for Institutional Dashboard User table (…
Johnetordoff 8dbbb81
[ENG-6181] Update search mirage view (#2318)
futa-ikeda f6311c4
[ENG-6117] Add Filter for Orcid on Instutional Dashboard (#2315)
Johnetordoff 28f7b48
[ENG-6194] Add functionality to show/hide certain columns in table (#…
Johnetordoff ad2647a
match dropdown select colors and details
ae93ff2
add total user label to user list
9de661e
clean-up for CR
403b884
Added a new total count kpi
bp-cos c852096
Added a new test and removed an old one
bp-cos e4267ce
Fixed some api issues
bp-cos 168e260
Removed old tests
bp-cos 08dd57f
Merge branch 'feature/insti-dash-improv' of https://github.com/Center…
e7a3496
Updates to add the project total
bp-cos 61f0429
Added a test with test-data elements
bp-cos 1671617
Merge branch 'feature/insti-dash-improv' of https://github.com/Center…
e3e1c76
make clicking apply close dropdown and make table scrollable for mobile
7921928
tweak slider animation
2a9cbc7
Updated the model
bp-cos 7361501
Added all the new attributes
bp-cos 84859d0
make user table always scrollable
bc05082
updated the mirage institution and institution-summary-metric factory
bp-cos 8052f7f
Added the new attributes to the mirage files
bp-cos ac605ac
Updates to make mirage numbers more realistic
bp-cos 25d34a4
Merge pull request #2327 from Johnetordoff/improve-mobile-styling-ins…
Johnetordoff eed4a4d
Added the dynamic registration data to the component and fixed the tests
bp-cos e98cdc2
Added the dynamic preprint data to the component and fixed the tests
bp-cos 8add1f9
Updates to css and html
bp-cos b68e7a7
Merge branch 'develop' into feature/insti-dash-improv
futa-ikeda fdc3cb7
[ENG-6182] Add table to projects tab (#2335)
futa-ikeda a9056a2
[ENG-6183] Project list filtering (#2345)
futa-ikeda f3d5e19
Added a new doughnut component
bp-cos f14f292
Fixed the mobile formatting and made the graphs dynamic
bp-cos 72ea5a3
Updates for all the love
bp-cos d8f54d6
Added a very rudimentary test for the chart-kpi wrapper
bp-cos 0f41eab
Added some more tests
bp-cos c7ffc35
Added additional tests and more dynamic data
bp-cos d4a3e4f
Minor updates for comments
bp-cos 8596ddc
Removed a pauseTeset
bp-cos 3259cfd
[ENG-6184] Allow sorting for project list (#2348)
futa-ikeda f5a8b13
Added the registration chart
bp-cos 735e45a
Added total osf projects
bp-cos e07510e
Added licenses and updated tests
bp-cos 763cc02
Added add-ons and storage regions
bp-cos 9bc8adf
Added data storage
bp-cos 658e0e3
Finished the kpis
bp-cos afedf85
Added the correct chart types
bp-cos 17c2216
Added a new util for human readable bytes to the model
bp-cos 0dd3be5
[ENG-6328] Show hide cols (#2350)
futa-ikeda 449b9a8
fix preprint typo for institutional dashboard
411f63e
Merge pull request #2354 from Johnetordoff/fix-preprints
Johnetordoff 72ca3cf
make total user count dynamic for the user tab
73268f9
Update month data fields to be strings (#2358)
futa-ikeda 651c7a4
Merge pull request #2359 from Johnetordoff/update-total-user-for-dash…
Johnetordoff faa9268
[ENG-6368] Share summary graphs (#2361)
futa-ikeda 6e42b4d
[ENG-6246][ENG-6269][ENG-6275] Add new property fields to mirage (#2…
futa-ikeda 91c1fc9
add basic fancy pagination
54de8fc
Merge branch 'feature/insti-dash-improv' of https://github.com/Center…
325f2e5
[ENG-6192] Summary tab styling (#2355)
futa-ikeda 0349d7f
add better styling
16db640
sync translations and fix linting issues
7a98abe
fix number from squishing on mobile
fd6a1e4
make paginator configurable
1c5a7a8
make sure preprint tab isn't hidden and apply button is always visibl…
628e460
[ENG-6270][ENG-6273][ENG-6274] Add registration table (#2362)
futa-ikeda 3be1637
Merge pull request #2364 from Johnetordoff/fix-mobile-users-count-das…
Johnetordoff 764a97c
fix css name
f384399
fix css vars to use names
af37f8d
Merge branch 'feature/insti-dash-improv' of https://github.com/Center…
5439883
Merge pull request #2363 from Johnetordoff/add-fancy-pagination-buttons
Johnetordoff ce77e65
improve responsive design for Apply button
0f763ff
Merge pull request #2366 from Johnetordoff/insti-dashboard-mobile-fixes
Johnetordoff defd028
[ENG-6276][ENG-6277][ENG-6278] Add Preprints table (#2370)
futa-ikeda 500d9c7
make null dates appear as N/A
5b6af65
remove table wrapper and fix pagination
05147b1
Merge pull request #2371 from Johnetordoff/dashboard-demo-feedback
Johnetordoff b785d5c
Fix reroute to not-found (#2375)
futa-ikeda a39b12c
[ENG-6419] Share integration (#2377)
futa-ikeda 0a3b593
Fix how index-value-search qps are passed (#2379)
futa-ikeda 4320073
[No ticket] Update language and counts on summary page (#2381)
futa-ikeda 10140b7
Prevent modifying args.defaultQueryOptions when adding filters (#2382)
futa-ikeda 3931250
Hide right panel properly on desktop view (#2383)
futa-ikeda 0efac04
[ENG-6419] Update SHARE getters (#2384)
futa-ikeda 4c26c7b
move archive link button to each tab and add a download button
c4f364d
Fix issue when applying multiple filters of a kind (#2387)
futa-ikeda bd40d53
move around tests to reflect new behavior
a3dd9ac
Merge pull request #2386 from Johnetordoff/add-download-dashboard-but…
Johnetordoff 1731732
Fix bug where value-searches did not contain all filters applied (#2388)
futa-ikeda 00fef7a
Merge branch 'develop' into feature/insti-dash-improv
futa-ikeda 4877062
Remove old components (#2389)
futa-ikeda 83c4a77
Update no data placeholder text (#2390)
futa-ikeda 54f13d2
Avoid fetching components for projects and registrations tab (#2392)
futa-ikeda 54ebbf1
Add ability to sort by storageByteCount (#2391)
futa-ikeda 3a51a9e
Pagination machination (#2393)
futa-ikeda f5ced50
Limit institution banner image size (#2394)
futa-ikeda 1cc765f
Bring back a local-class that got removed (#2396)
futa-ikeda 46ea031
[ENG-6401] Mobile styling (#2398)
futa-ikeda fe98821
Move boolean filters into group (#2399)
futa-ikeda fbc17d9
Allow users to sort by view and download count (#2400)
futa-ikeda 07a94db
Implement boolean filters correctly (#2402)
futa-ikeda 2405c48
Update projects/registrations/preprints table to have title link to p…
futa-ikeda 54b4eb9
Show orcid in user list table (#2403)
futa-ikeda 6c2996b
A11y (#2404)
futa-ikeda c71eb9f
Add placeholder if user has no ORCID (#2405)
futa-ikeda 30b2b8e
Remove tooltip from summary kpi (#2406)
futa-ikeda 684c877
[ENG-6567][ENG-6598] Fix dropdown placement for mobile (#2408)
futa-ikeda 7955075
Rewrite hasOsfmapValue based on earlier suggestion (#2407)
futa-ikeda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
app/institutions/dashboard/-components/chart-kpi-wrapper/chart-kpi/component-test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import { click, render } from '@ember/test-helpers'; | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
import { setupMirage } from 'ember-cli-mirage/test-support'; | ||
import { setupIntl } from 'ember-intl/test-support'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { TestContext } from 'ember-test-helpers'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('Integration | institutions | dashboard | -components | chart-kpi', hooks => { | ||
setupRenderingTest(hooks); | ||
setupMirage(hooks); | ||
setupIntl(hooks); | ||
|
||
hooks.beforeEach(function(this: TestContext) { | ||
const data = Object({ | ||
title: 'This is the title', | ||
chartData: [ | ||
Object({ | ||
label: 'a very long data set title that needs to be handled', | ||
total: 100000, | ||
}), | ||
], | ||
chartType: 'pie', | ||
}); | ||
|
||
this.set('data', data); | ||
}); | ||
|
||
test('it renders the data correctly', async assert => { | ||
|
||
// Given the component is rendered | ||
await render(hbs` | ||
<Institutions::Dashboard::-Components::ChartKpiWrapper::ChartKpi | ||
@data={{this.data}} | ||
/> | ||
`); | ||
// Then the chart is verified | ||
assert.dom('[data-test-chart]') | ||
.exists('The test chart exists'); | ||
|
||
// And the title is verified | ||
assert.dom('[data-test-chart-title]') | ||
.hasText('This is the title'); | ||
|
||
assert.dom('[data-test-toggle-icon]') | ||
.hasAttribute('data-icon', 'caret-down'); | ||
|
||
// Finally the expanded data is not visible | ||
assert.dom('[data-test-expansion-data]') | ||
.hasStyle({display: 'none'}); | ||
}); | ||
|
||
test('it renders the expanded data correctly', async assert => { | ||
|
||
// Given the component is rendered | ||
await render(hbs` | ||
<Institutions::Dashboard::-Components::ChartKpiWrapper::ChartKpi | ||
@data={{this.data}} | ||
/> | ||
`); | ||
// When I click the expanded icon | ||
await click('[data-test-expand-additional-data]'); | ||
|
||
// Then I verify the icon has changed | ||
assert.dom('[data-test-toggle-icon]') | ||
.hasAttribute('data-icon', 'caret-up'); | ||
|
||
// And the expanded data is visible | ||
assert.dom('[data-test-expansion-data]') | ||
.exists('The expansion data is visible'); | ||
|
||
// And the expanded data position 0 color is verified | ||
assert.dom('[data-test-expanded-color="0"]') | ||
.hasAttribute('style', 'background-color:#00D1FF'); | ||
|
||
// And the expanded data position 0 name is verified | ||
assert.dom('[data-test-expanded-name="0"]') | ||
.hasText('a very long data set title that needs to be handled'); | ||
|
||
// And the expanded data position 0 total is verified | ||
assert.dom('[data-test-expanded-total="0"]') | ||
.hasText('100000'); | ||
}); | ||
|
||
/** | ||
* I need to determine if this is going to be a feature or not | ||
test('it renders the without data correctly', async function(this: EnginesIntlTestContext, assert) { | ||
const data = Object({ | ||
total: 0, | ||
title: 'This is the title', | ||
icon: 'building', | ||
}); | ||
|
||
this.set('data', data); | ||
|
||
|
||
await render(hbs` | ||
<Institutions::Dashboard::-Components::ChartKpiWrapper::ChartKpi | ||
@data={{this.data}} | ||
/> | ||
`); | ||
|
||
assert.dom('[data-test-kpi-title]') | ||
.hasText('This is the title'); | ||
assert.dom('[data-test-kpi-data]') | ||
.hasText('No data for institution found.'); | ||
assert.dom('[data-test-kpi-icon]') | ||
.hasAttribute('data-icon', 'building'); | ||
}); | ||
*/ | ||
}); |
118 changes: 118 additions & 0 deletions
118
app/institutions/dashboard/-components/chart-kpi-wrapper/chart-kpi/component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import Component from '@glimmer/component'; | ||
import { action } from '@ember/object'; | ||
import { inject as service } from '@ember/service'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { ChartData, ChartOptions } from 'ember-cli-chart'; | ||
import Intl from 'ember-intl/services/intl'; | ||
// eslint-disable-next-line max-len | ||
import { ChartDataModel, KpiChartModel } from 'ember-osf-web/institutions/dashboard/-components/chart-kpi-wrapper/component'; | ||
|
||
interface KPIChartWrapperArgs { | ||
data: KpiChartModel; | ||
} | ||
|
||
interface DataModel { | ||
name: string; | ||
total: number; | ||
color: string; | ||
} | ||
|
||
export default class ChartKpi extends Component<KPIChartWrapperArgs> { | ||
@service intl!: Intl; | ||
|
||
@tracked collapsed = true; | ||
@tracked expandedData = [] as DataModel[]; | ||
|
||
/** | ||
* chartOptions | ||
* | ||
* @description A getter for the chartjs options | ||
* | ||
* @returns a ChartOptions model which is custom to COS | ||
*/ | ||
get chartOptions(): ChartOptions { | ||
const options = { | ||
aspectRatio: 1, | ||
legend: { | ||
display: false, | ||
}, | ||
scales: { | ||
xAxes: [{ | ||
display: false, | ||
}], | ||
yAxes: [{ | ||
display: false, | ||
ticks: { min: 0 }, | ||
}], | ||
}, | ||
}; | ||
if (this.args.data.chartType === 'bar') { | ||
options.scales.yAxes[0].display = true; | ||
} | ||
return options; | ||
} | ||
|
||
/** | ||
* getColor | ||
* | ||
* @description Gets a specific color using a modulus | ||
* | ||
* @param index The index to retrieve | ||
* | ||
* @returns the color | ||
*/ | ||
private getColor(index: number): string { | ||
const backgroundColors = [ | ||
'#00D1FF', | ||
'#009CEF', | ||
'#0063EF', | ||
'#00568D', | ||
'#004673', | ||
'#00375A', | ||
'#263947', | ||
]; | ||
|
||
return backgroundColors[index % backgroundColors.length]; | ||
} | ||
|
||
/** | ||
* chartData | ||
* | ||
* @description Transforms the standard chart data into data the charts can display | ||
* | ||
* @returns void | ||
*/ | ||
get chartData(): ChartData { | ||
const backgroundColors = [] as string[]; | ||
const data = [] as number[]; | ||
const labels = [] as string[]; | ||
const { taskInstance, chartData } = this.args.data; | ||
|
||
const rawData = taskInstance?.value || chartData || []; | ||
|
||
rawData.forEach((rawChartData: ChartDataModel, $index: number) => { | ||
backgroundColors.push(this.getColor($index)); | ||
|
||
data.push(rawChartData.total); | ||
labels.push(rawChartData.label); | ||
this.expandedData.push({ | ||
name: rawChartData.label, | ||
total: rawChartData.total, | ||
color: this.getColor($index), | ||
}); | ||
}); | ||
return { | ||
labels, | ||
datasets: [{ | ||
data, | ||
fill: false, | ||
backgroundColor: backgroundColors, | ||
}], | ||
}; | ||
} | ||
|
||
@action | ||
public toggleExpandedData() { | ||
this.collapsed = !this.collapsed; | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we determined if this is a feature or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this won't be needed, so will address this in a follow-up PR as well