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-6368] Share summary graphs #2361

Conversation

futa-ikeda
Copy link
Contributor

@futa-ikeda futa-ikeda commented Oct 22, 2024

Purpose

  • Hook up graphs for licenses, addon usage and storage locations to actual data

Summary of Changes

  • Add loading/error state to chart component
  • Add task to fetch data from SHARE to chart-wrapper component

Screenshot(s)

  • Finished graphs:
    image

  • Loading/error states:
    image

Side Effects

QA Notes

Copy link
Contributor

@aaxelb aaxelb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mainly a suggestion to simplify some confusing logic, but that confusing logic does seem like it'll probably work (tho may be brittle to updates) -- your call

cardSearchFilter: {
affiliation: this.args.model.institution.iris.join(','),
},
sort: '-relevance',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as implemented, index-value-search ignores the sort param (always sorts by most-used to least-used) so you can leave this out (looks like the api docs are wrong about this, oops)

return storageRegionsData;
}
};
this.kpiCharts[index] = kpiChartObject;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is getting a bit convoluted and brittle, overwriting an object in an array by constant index (especially when title and chartType are unchanged but computed two ways) and then re-rendering everything that depends on that array (multiple times, it seems?)

i gather you don't want to make the whole set of charts block on these value-search requests, which makes sense... might simplify things if the ChartKpiWrapper::ChartKpi component understood the task instance you're passing it and automatically used this.args.data.taskInstance.value (when this.args.data.chartData is missing) -- then this task could have just one argument (propertyPath), return its chartData, and not have to do anything with this.kpiCharts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, this is a much more sensible way to implement this. Will rework these components now

Copy link
Contributor

@aaxelb aaxelb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple nits for clarity and a type annotation correction

rawData = taskInstance.value;
}
}
rawData.map((rawChartData: ChartDataModel, $index: number) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (from prior code): .forEach is more appropriate than .map if you're not returning values (this creates an array that's immediately discarded)

Comment on lines 91 to 96
let rawData = chartData ? chartData : [];
if (taskInstance) {
if (taskInstance.value) {
rawData = taskInstance.value;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this is harder to read than it needs to be; would be clearer condensed

const rawData = taskInstance?.value || chartData || [];

chartType: string;
// Either chartData or taskInstance should be defined
chartData?: ChartDataModel[];
taskInstance?: TaskInstance<void>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
taskInstance?: TaskInstance<void>;
taskInstance?: TaskInstance<ChartDataModel[]>;

Copy link
Contributor

@aaxelb aaxelb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎐

@futa-ikeda futa-ikeda merged commit faa9268 into CenterForOpenScience:feature/insti-dash-improv Oct 23, 2024
9 checks passed
@futa-ikeda futa-ikeda deleted the share-summary-graphs branch October 23, 2024 17:49
Johnetordoff pushed a commit that referenced this pull request Oct 24, 2024
…ForOpenScience/ember-osf-web into add-fancy-pagination-buttons

* 'feature/insti-dash-improv' of https://github.com/CenterForOpenScience/ember-osf-web:
  [ENG-6246][ENG-6269][ENG-6275]  Add new property fields to mirage (#2353)
  [ENG-6368] Share summary graphs (#2361)
  Update month data fields to be strings (#2358)
  make total user count dynamic for the user tab

# Conflicts:
#	translations/en-us.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants