Skip to content

Commit

Permalink
Fix Deprecation in Organization and Service Account Routes
Browse files Browse the repository at this point in the history
  • Loading branch information
SmitGala committed Nov 8, 2024
1 parent f6aac1d commit d7c5aab
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/components/organization-invitation-list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default class OrganizationInvitationListComponent extends Component<Organ
}

get inviteList() {
return this.inviteResponse?.toArray() || [];
return this.inviteResponse?.slice() || [];
}

get totalInviteCount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default class AddToTeamComponent extends Component<AddToTeamComponentSign
}

get teamList() {
return this.teamResponse?.toArray() || [];
return this.teamResponse?.slice() || [];
}

get totalTeamCount() {
Expand Down
2 changes: 1 addition & 1 deletion app/components/organization-member/list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default class OrganizationMemberListComponent extends Component<Organizat
}

get userList() {
return this.userResponse?.toArray() || [];
return this.userResponse?.slice() || [];
}

get totalUserCount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class MemberDetailsComponent extends Component<MemberDetailsCompo
}

get teamsList() {
return this.teamResponse?.toArray() || [];
return this.teamResponse?.slice() || [];
}

get totalTeamCount() {
Expand Down
2 changes: 1 addition & 1 deletion app/components/organization-namespace/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class OrganizationNamespaceComponent extends Component<Organizati
}

get namespaceList() {
return this.namespaceResponse?.toArray() || [];
return this.namespaceResponse?.slice() || [];
}

get totalNamespaceCount() {
Expand Down
2 changes: 1 addition & 1 deletion app/components/organization-team/add-team-member/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class OrganizationTeamAddTeamMemberComponent extends Component<Or
}

get userList() {
const list = this.userResponse?.toArray() || [];
const list = this.userResponse?.slice() || [];

return list.map((user) => ({
user,
Expand Down
2 changes: 1 addition & 1 deletion app/components/organization-team/add-team-project/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class OrganizationTeamAddTeamProjectComponent extends Component<O
}

get projectList() {
const list = this.projectResponse?.toArray() || [];
const list = this.projectResponse?.slice() || [];

return list.map((project: OrganizationProjectModel) => ({
project,
Expand Down
2 changes: 1 addition & 1 deletion app/components/organization-team/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class OrganizationTeamComponent extends Component<OrganizationTea
}

get teamList() {
return this.teamResponse?.toArray() || [];
return this.teamResponse?.slice() || [];
}

get totalTeamCount() {
Expand Down
2 changes: 1 addition & 1 deletion app/components/organization-team/member-list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default class OrganizationTeamMemberListComponent extends Component<Organ
}

get teamMemberList() {
return this.teamMemberResponse?.toArray() || [];
return this.teamMemberResponse?.slice() || [];
}

get totalTeamMemberCount() {
Expand Down
2 changes: 1 addition & 1 deletion app/components/organization-team/project-list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class OrganizationTeamProjectListComponent extends Component<Orga
}

get teamProjectList() {
return this.teamProjectResponse?.toArray() || [];
return this.teamProjectResponse?.slice() || [];
}

get totalTeamProjectCount() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import Store from '@ember-data/store';
import { tracked } from '@glimmer/tracking';
import { task } from 'ember-concurrency';

import OrganizationProjectModel from 'irene/models/organization-project';
import ProjectModel from 'irene/models/project';
import parseError from 'irene/utils/parse-error';

export interface OrganizationTeamProjectListProjectInfoComponentSignature {
Args: {
Expand All @@ -11,10 +16,31 @@ export interface OrganizationTeamProjectListProjectInfoComponentSignature {

export default class OrganizationTeamProjectListProjectInfo extends Component<OrganizationTeamProjectListProjectInfoComponentSignature> {
@service declare store: Store;
@service('notifications') declare notify: NotificationService;

@tracked teamProject: ProjectModel | null = null;

constructor(
owner: object,
args: OrganizationTeamProjectListProjectInfoComponentSignature['Args']
) {
super(owner, args);

get teamProject() {
return this.store.findRecord('project', this.args.project.id);
this.fetchProjectDetail.perform();
}

fetchProjectDetail = task(async () => {
try {
const project = await this.store.findRecord(
'project',
this.args.project.id
);

this.teamProject = project;
} catch (e) {
this.notify.error(parseError(e));
}
});
}

declare module '@glint/environment-ember-loose/registry' {
Expand Down
4 changes: 2 additions & 2 deletions app/models/organization-invitation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export default class OrganizationInvitationModel extends Model {
@attr('date')
declare updatedOn: Date;

@belongsTo('organization-team')
@belongsTo('organization-team', { async: true, inverse: null })
declare team: AsyncBelongsTo<OrganizationTeamModel>;

@belongsTo('organization')
@belongsTo('organization', { async: true, inverse: null })
declare organization: AsyncBelongsTo<OrganizationModel>;

resend() {
Expand Down
2 changes: 1 addition & 1 deletion app/models/organization-team-invitation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class OrganizationTeamInvitationModel extends Model {
@attr('date')
declare updatedOn: Date;

@belongsTo('organization')
@belongsTo('organization', { async: true, inverse: null })
declare organization: AsyncBelongsTo<OrganizationModel>;

async delete() {
Expand Down

0 comments on commit d7c5aab

Please sign in to comment.