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

Remove VisualizerProgramYearObjectives render modifiers #8267

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 0 additions & 2 deletions packages/frontend/.lint-todo
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ add|ember-template-lint|no-at-ember-render-modifiers|4|2|4|2|23cd787c79c34a628da
add|ember-template-lint|no-at-ember-render-modifiers|5|2|5|2|f53982efe02d2bef9e7f12b5b862288c594579c2|1731542400000|1762646400000|1793750400000|app/components/user-profile-bio.hbs
add|ember-template-lint|no-at-ember-render-modifiers|5|2|5|2|23cd787c79c34a628dadb6e96dd4004d42eebb79|1731542400000|1762646400000|1793750400000|app/components/user-profile-roles.hbs
add|ember-template-lint|no-at-ember-render-modifiers|6|2|6|2|e5120f87b74c5ae8e4c76b9089e0b4a4504c6e3c|1731542400000|1762646400000|1793750400000|app/components/user-profile-roles.hbs
add|ember-template-lint|no-at-ember-render-modifiers|3|2|3|2|1fb0566922ce4f066916e5e2931f650f69d7cfba|1731542400000|1762646400000|1793750400000|app/components/visualizer-program-year-objectives.hbs
add|ember-template-lint|no-at-ember-render-modifiers|4|2|4|2|38e65b45b56fdfd4160d3b0884114b6643e3a036|1731542400000|1762646400000|1793750400000|app/components/visualizer-program-year-objectives.hbs
add|ember-template-lint|no-at-ember-render-modifiers|3|2|3|2|cb6d7acb9879902b89ad1575846d290a564ffbae|1731542400000|1762646400000|1793750400000|app/components/learner-group/instructor-manager.hbs
add|ember-template-lint|no-at-ember-render-modifiers|4|2|4|2|2bdc98d02ac5ea2a4bd5bac6a0f9e880abafdcbe|1731542400000|1762646400000|1793750400000|app/components/learner-group/instructor-manager.hbs
add|ember-template-lint|no-at-ember-render-modifiers|4|4|4|4|170987df2d1e4c134a0ac459fc0bdd8dd91b9929|1731542400000|1762646400000|1793750400000|app/components/learner-group/root.hbs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<div
class="{{unless @isIcon 'not-icon'}} visualizer-program-year-objectives"
{{did-insert (perform this.load) @programYear}}
{{did-update (perform this.load) @programYear}}
...attributes
>
{{#if this.load.lastSuccessful}}
<div class="{{unless @isIcon 'not-icon'}} visualizer-program-year-objectives" ...attributes>
{{#if this.programYearData.isResolved}}
{{#if (or @isIcon this.data)}}
<SimpleChart
@name="tree"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import Component from '@glimmer/component';
import { htmlSafe } from '@ember/template';
import { filter, map } from 'rsvp';
import { restartableTask, timeout } from 'ember-concurrency';
import { tracked } from '@glimmer/tracking';
import { cached, tracked } from '@glimmer/tracking';
import { service } from '@ember/service';
import { filterBy, uniqueValues } from 'ilios-common/utils/array-helpers';
import { TrackedAsyncData } from 'ember-async-data';

export default class VisualizerProgramYearObjectivesComponent extends Component {
@service intl;
Expand All @@ -16,15 +17,29 @@ export default class VisualizerProgramYearObjectivesComponent extends Component
@tracked programYearName;
@tracked data;

load = restartableTask(async (element, [programYear]) => {
const cohort = await programYear.cohort;
const year = await programYear.getClassOfYear();
constructor() {
super(...arguments);
this.load.perform();
}

load = restartableTask(async () => {
const cohort = await this.programYear.cohort;
const year = await this.programYear.getClassOfYear();
const classOfYear = this.intl.t('general.classOf', { year });
this.programYearName = cohort.title ?? classOfYear;

this.data = await this.getData(programYear);
this.data = await this.getData(this.programYear);
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't time out correctly if the program year isn't already loaded. It could return null. This fix is a bit more complicated, but worth the time:

  1. Remove the load entirely
  2. Create a TrackedAsyncData that calls getData using the program year. Until program year exists it should return null.
  3. Probably lots of adjustment and cleanup to get that to work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this one's gonna need more work. Back to the mines...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jrjohnson Any idea why the links to these visualizations only exist on local, but not dev?

Copy link
Member

Choose a reason for hiding this comment

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

@michaelchadwick the visibility of these links is controlled via a feature flag.

for reference, see:
https://github.com/ilios/frontend/blob/master/packages/frontend/app/components/program-year/overview.hbs#L7

});

@cached
get programYearData() {
return new TrackedAsyncData(this.args.programYear);
}

get programYear() {
return this.programYearData.isResolved ? this.programYearData.value : null;
}

async getObjectiveObjects(programYear) {
const buildTreeLevel = async function (parent, childrenTree, sessionTitle, courseTitle) {
return {
Expand Down
Loading