From 00e20f197894071b3d6d3ce6898b8c88f2725a6a Mon Sep 17 00:00:00 2001 From: Michael Chadwick Date: Tue, 17 Dec 2024 16:18:48 -0800 Subject: [PATCH 1/4] removed render modifiers from course header --- .../addon/components/course/header.hbs | 106 +++++++++--------- .../addon/components/course/header.js | 25 +++-- 2 files changed, 70 insertions(+), 61 deletions(-) diff --git a/packages/ilios-common/addon/components/course/header.hbs b/packages/ilios-common/addon/components/course/header.hbs index 487a300263..5c22a42e2e 100644 --- a/packages/ilios-common/addon/components/course/header.hbs +++ b/packages/ilios-common/addon/components/course/header.hbs @@ -1,54 +1,52 @@ -
- {{#unless this.load.isRunning}} - - {{#if @editable}} - - - - - {{else}} -

- {{#if @course.locked}} - - {{/if}} - {{@course.title}} -

- {{/if}} - {{#unless this.isEditingTitle}} -

- {{#if this.academicYearCrossesCalendarYearBoundaries}} - {{@course.year}} - {{add @course.year 1}} - {{else}} - {{@course.year}} - {{/if}} -

- {{/unless}} -
-
- {{#if @editable}} - - {{else}} - - {{/if}} -
- {{/unless}} -
+
+ {{!-- {{#if this.academicYearCrossesCalendarYearBoundaries}} --}} + + {{#if @editable}} + + + + + {{else}} +

+ {{#if @course.locked}} + + {{/if}} + {{@course.title}} +

+ {{/if}} + {{#unless this.isEditingTitle}} +

+ {{#if this.academicYearCrossesCalendarYearBoundaries}} + {{@course.year}} + - + {{add @course.year 1}} + {{else}} + {{@course.year}} + {{/if}} +

+ {{/unless}} +
+
+ {{#if @editable}} + + {{else}} + + {{/if}} +
+ {{!-- {{/if}} --}} +
\ No newline at end of file diff --git a/packages/ilios-common/addon/components/course/header.js b/packages/ilios-common/addon/components/course/header.js index ec244309c0..ea9194aec1 100644 --- a/packages/ilios-common/addon/components/course/header.js +++ b/packages/ilios-common/addon/components/course/header.js @@ -1,9 +1,10 @@ import Component from '@glimmer/component'; -import { tracked } from '@glimmer/tracking'; +import { cached, tracked } from '@glimmer/tracking'; import { action } from '@ember/object'; import { restartableTask } from 'ember-concurrency'; import { validatable, Length, NotBlank } from 'ilios-common/decorators/validation'; import { service } from '@ember/service'; +import { TrackedAsyncData } from 'ember-async-data'; @validatable export default class CourseHeaderComponent extends Component { @@ -11,14 +12,24 @@ export default class CourseHeaderComponent extends Component { @Length(3, 200) @NotBlank() @tracked courseTitle; @tracked isEditingTitle = false; - @tracked academicYearCrossesCalendarYearBoundaries = false; - load = restartableTask(async () => { - this.academicYearCrossesCalendarYearBoundaries = await this.iliosConfig.itemFromConfig( - 'academicYearCrossesCalendarYearBoundaries', + constructor() { + super(...arguments); + this.courseTitle = this.args.course.title; + } + + @cached + get academicYearCrossesCalendarYearBoundariesData() { + return new TrackedAsyncData( + this.iliosConfig.itemFromConfig('academicYearCrossesCalendarYearBoundaries'), ); - this.revertTitleChanges(); - }); + } + + get academicYearCrossesCalendarYearBoundaries() { + return this.academicYearCrossesCalendarYearBoundariesData.isResolved + ? this.academicYearCrossesCalendarYearBoundariesData.value + : false; + } changeTitle = restartableTask(async () => { this.courseTitle = this.courseTitle.trim(); From a3ac2d6542e3b846e03c6fbe5f508cd11620080b Mon Sep 17 00:00:00 2001 From: Michael Chadwick Date: Tue, 17 Dec 2024 16:52:47 -0800 Subject: [PATCH 2/4] removed render modifiers from objective list --- .../components/course/objective-list.hbs | 78 +++++++++---------- .../addon/components/course/objective-list.js | 25 ++++-- 2 files changed, 54 insertions(+), 49 deletions(-) diff --git a/packages/ilios-common/addon/components/course/objective-list.hbs b/packages/ilios-common/addon/components/course/objective-list.hbs index 9ff701604a..a6a0bcca6c 100644 --- a/packages/ilios-common/addon/components/course/objective-list.hbs +++ b/packages/ilios-common/addon/components/course/objective-list.hbs @@ -1,45 +1,39 @@ -
- {{#if this.isSorting}} - - {{/if}} - - {{#if (and this.courseObjectiveCount (not this.isSorting))}} - {{#if (and @editable (gt this.courseObjectiveCount 1))}} - +
+ {{#if this.courseSessionsLoaded}} + {{#if this.isSorting}} + {{/if}} -
- {{t "general.description"}} - {{t "general.parentObjectives"}} - {{t "general.vocabularyTerms"}} - {{t "general.meshTerms"}} - {{t "general.actions"}} -
- {{#if (and (is-array this.courseObjectives) this.cohortObjectivesLoaded)}} - {{#each this.courseObjectives as |courseObjective|}} - - {{/each}} - {{else}} - + + {{#if (and this.courseObjectiveCount (not this.isSorting))}} + {{#if (and @editable (gt this.courseObjectiveCount 1))}} + + {{/if}} +
+ {{t "general.description"}} + {{t "general.parentObjectives"}} + {{t "general.vocabularyTerms"}} + {{t "general.meshTerms"}} + {{t "general.actions"}} +
+ {{#if (and (is-array this.courseObjectives) this.cohortObjectivesLoaded)}} + {{#each this.courseObjectives as |courseObjective|}} + + {{/each}} + {{else}} + + {{/if}} {{/if}} {{/if}} -
+
\ No newline at end of file diff --git a/packages/ilios-common/addon/components/course/objective-list.js b/packages/ilios-common/addon/components/course/objective-list.js index b575dda2fd..5b6d71c8c8 100644 --- a/packages/ilios-common/addon/components/course/objective-list.js +++ b/packages/ilios-common/addon/components/course/objective-list.js @@ -1,6 +1,5 @@ import Component from '@glimmer/component'; import { cached, tracked } from '@glimmer/tracking'; -import { restartableTask } from 'ember-concurrency'; import { map } from 'rsvp'; import { service } from '@ember/service'; import { TrackedAsyncData } from 'ember-async-data'; @@ -12,6 +11,19 @@ export default class CourseObjectiveListComponent extends Component { @service dataLoader; @tracked isSorting = false; + @cached + get courseSessionsData() { + return new TrackedAsyncData(this.getCourseSessions(this.args.course)); + } + + get courseSessions() { + return this.courseSessionsData.isResolved ? this.courseSessionsData.value : null; + } + + get courseSessionsLoaded() { + return this.courseSessionsData.isResolved; + } + @cached get courseObjectivesAsyncData() { return new TrackedAsyncData(this.args.course.courseObjectives); @@ -27,7 +39,7 @@ export default class CourseObjectiveListComponent extends Component { } get courseObjectives() { - if (this.load.lastSuccessful && this.courseObjectivesAsync) { + if (this.courseSessionsLoaded && this.courseObjectivesAsync) { return this.courseObjectivesAsync.slice().sort(sortableByPosition); } @@ -39,7 +51,7 @@ export default class CourseObjectiveListComponent extends Component { } get courseCohorts() { - if (this.load.lastSuccessful && this.courseCohortsAsync) { + if (this.courseSessionsLoaded && this.courseCohortsAsync) { return this.courseCohortsAsync; } @@ -67,10 +79,9 @@ export default class CourseObjectiveListComponent extends Component { return this.args.course.hasMany('courseObjectives').ids().length; } - load = restartableTask(async () => { - //pre-load all session data as well to get access to child objectives - await this.dataLoader.loadCourseSessions(this.args.course.id); - }); + async getCourseSessions(course) { + await this.dataLoader.loadCourseSessions(course.id); + } async getCohortObjectives(cohorts, intl) { return await map(cohorts, async (cohort) => { From eca47eac6882543a1974336a756e9c437e52ac06 Mon Sep 17 00:00:00 2001 From: Michael Chadwick Date: Tue, 17 Dec 2024 17:03:56 -0800 Subject: [PATCH 3/4] updated lint-todo --- packages/ilios-common/.lint-todo | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/ilios-common/.lint-todo b/packages/ilios-common/.lint-todo index f9395469b9..03b58c429f 100644 --- a/packages/ilios-common/.lint-todo +++ b/packages/ilios-common/.lint-todo @@ -29,10 +29,6 @@ add|ember-template-lint|no-at-ember-render-modifiers|3|2|3|2|7491f1d2f4e83f2c87f add|ember-template-lint|no-at-ember-render-modifiers|13|6|13|6|1a2522cd1202904fb09a6e811dec6b46d8189ab3|1731542400000|1762646400000|1793750400000|addon/components/user-name-info.hbs add|ember-template-lint|no-at-ember-render-modifiers|8|57|8|57|49de9e74a62c8d39ef6a37eaecf07bd389aa57c7|1731542400000|1762646400000|1793750400000|addon/components/wait-saving.hbs add|ember-template-lint|no-at-ember-render-modifiers|7|2|7|2|1a2522cd1202904fb09a6e811dec6b46d8189ab3|1731542400000|1762646400000|1793750400000|addon/components/weekly-calendar-event.hbs -add|ember-template-lint|no-at-ember-render-modifiers|4|2|4|2|23cd787c79c34a628dadb6e96dd4004d42eebb79|1731542400000|1762646400000|1793750400000|addon/components/course/header.hbs -add|ember-template-lint|no-at-ember-render-modifiers|5|2|5|2|32658810aa13672f5981281c562729112a89788f|1731542400000|1762646400000|1793750400000|addon/components/course/header.hbs -add|ember-template-lint|no-at-ember-render-modifiers|4|2|4|2|23cd787c79c34a628dadb6e96dd4004d42eebb79|1731542400000|1762646400000|1793750400000|addon/components/course/objective-list.hbs -add|ember-template-lint|no-at-ember-render-modifiers|5|2|5|2|84076f8cf85c554eaf0d9fdec26154bae5bceeb2|1731542400000|1762646400000|1793750400000|addon/components/course/objective-list.hbs add|ember-template-lint|no-at-ember-render-modifiers|4|2|4|2|2bbf15957242a9a3c1e26e14e5d022c858199fde|1731542400000|1762646400000|1793750400000|addon/components/course/rollover-date-picker.hbs add|ember-template-lint|no-at-ember-render-modifiers|5|2|5|2|167e8d9ede488c7f199cb748e81bc09b97617e71|1731542400000|1762646400000|1793750400000|addon/components/course/rollover-date-picker.hbs add|ember-template-lint|no-at-ember-render-modifiers|3|2|3|2|1009d3843f6aed52099f0e7fbd4eebb52bc176e5|1731542400000|1762646400000|1793750400000|addon/components/course/rollover.hbs From e91315ef45fe1de2bc210857678bf8f50b43402b Mon Sep 17 00:00:00 2001 From: Michael Chadwick Date: Wed, 18 Dec 2024 15:01:03 -0800 Subject: [PATCH 4/4] removed gunk --- packages/ilios-common/addon/components/course/header.hbs | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/ilios-common/addon/components/course/header.hbs b/packages/ilios-common/addon/components/course/header.hbs index 5c22a42e2e..6b0542d41a 100644 --- a/packages/ilios-common/addon/components/course/header.hbs +++ b/packages/ilios-common/addon/components/course/header.hbs @@ -1,5 +1,4 @@
- {{!-- {{#if this.academicYearCrossesCalendarYearBoundaries}} --}} {{#if @editable}} {{/if}}
- {{!-- {{/if}} --}} \ No newline at end of file