Skip to content

Commit

Permalink
removed fetching of institutions on dashboard, fixed sparse-node mode…
Browse files Browse the repository at this point in the history
…l root relationship
  • Loading branch information
opaduchak committed Jan 21, 2025
1 parent 8621f29 commit 5f978a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions app/dashboard/controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Store from '@ember-data/store';
import { A } from '@ember/array';
import Controller from '@ember/controller';
import { action, computed } from '@ember/object';
import { alias, or } from '@ember/object/computed';
Expand All @@ -11,7 +10,6 @@ import config from 'ember-osf-web/config/environment';
import $ from 'jquery';
import Media from 'ember-responsive';

import Institution from 'ember-osf-web/models/institution';
import Node from 'ember-osf-web/models/node';
import { QueryHasManyResult } from 'ember-osf-web/models/osf-model';
import User from 'ember-osf-web/models/user';
Expand Down Expand Up @@ -46,7 +44,7 @@ export default class Dashboard extends Controller {
'failedLoading-noteworthy' = false;
'failedLoading-popular' = false;

institutions: Institution[] = A([]);
// institutions: Institution[] = A([]);
nodes?: QueryHasManyResult<Node>;
noteworthy!: QueryHasManyResult<Node>;
popular!: QueryHasManyResult<Node>;
Expand All @@ -65,16 +63,16 @@ export default class Dashboard extends Controller {
async setupTask() {
this.set('filter', null);

const institutions = this.store.findAll('institution');
// const institutions = this.store.findAll('institution');

await all([
institutions,
// institutions,
taskFor(this.findNodes).perform(),
taskFor(this.getPopularAndNoteworthy).perform(popularNode, 'popular'),
taskFor(this.getPopularAndNoteworthy).perform(noteworthyNode, 'noteworthy'),
]);

this.set('institutions', institutions.toArray());
// this.set('institutions', institutions.toArray());
}

@restartableTask
Expand Down
4 changes: 2 additions & 2 deletions app/models/sparse-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export default class SparseNodeModel extends OsfModel {
@belongsTo('node', { inverse: 'children' })
parent!: AsyncBelongsTo<NodeModel> & NodeModel;

@belongsTo('node', { inverse: null })
root!: AsyncBelongsTo<NodeModel> & NodeModel;
@belongsTo('sparse-node', { inverse: null })
root!: AsyncBelongsTo<SparseNodeModel> & SparseNodeModel;

@belongsTo('node', { inverse: null })
detail!: AsyncBelongsTo<NodeModel> & NodeModel;
Expand Down

0 comments on commit 5f978a8

Please sign in to comment.