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 14, 2024
1 parent a231549 commit 43e56ca
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 25 deletions.
2 changes: 1 addition & 1 deletion app/components/organization-email-domain/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class OrganizationEmailDomainComponent extends Component {
fetchDomains = task(async () => {
this.domains = (
await this.store.findAll('organization-email-domain')
).toArray();
).slice();
});

addDomain = task(async () => {
Expand Down
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
20 changes: 16 additions & 4 deletions app/components/sso-settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default class SsoSettingsComponent extends Component {
@tracked idpMetadata = null;
@tracked idpMetadataXml = null;
@tracked spConfig = 'manual';
@tracked sso = null;

spMetadataKeys = [
{ labelKey: 'entityID', valueKey: 'entity_id' },
Expand All @@ -38,10 +39,7 @@ export default class SsoSettingsComponent extends Component {

this.SPMetadata.perform();
this.getIdPMetadata.perform();
}

get sso() {
return this.store.queryRecord('organization-sso', {});
this.getSSOData.perform();
}

// Switch SP config format
Expand Down Expand Up @@ -77,6 +75,20 @@ export default class SsoSettingsComponent extends Component {
}
});

getSSOData = task(async () => {
try {
const ssoData = await this.store.queryRecord('organization-sso', {});

this.sso = ssoData;
} catch (e) {
this.notify.error(parseError(e));
}
});

get isIdPMetadataReady() {
return this.idpMetadata && !this.getIdPMetadata.isRunning;
}

// Parse & upload IdP metadata
parseIdpMetadataXml = task(async (file) => {
let idpMetadataXml = await file.readAsText();
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
4 changes: 2 additions & 2 deletions app/models/service-account-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import type ProjectModel from './project';
import type ServiceAccountModel from './service-account';

export default class ServiceAccountProjectModel extends Model {
@belongsTo('project')
@belongsTo('project', { async: true, inverse: null })
declare project: AsyncBelongsTo<ProjectModel>;

@belongsTo('service-account')
@belongsTo('service-account', { async: true, inverse: null })
declare serviceAccount: AsyncBelongsTo<ServiceAccountModel>;

@attr('date')
Expand Down
6 changes: 3 additions & 3 deletions app/models/service-account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class ServiceAccountModel extends Model {
@attr('boolean')
declare allProjects: boolean;

@hasMany('service-account-project')
@hasMany('service-account-project', { async: true, inverse: null })
declare projects: AsyncHasMany<ServiceAccountProjectModel>;

@attr('date')
Expand All @@ -60,10 +60,10 @@ export default class ServiceAccountModel extends Model {
@attr('date')
declare createdOn: Date;

@belongsTo('organization-user')
@belongsTo('organization-user', { async: true, inverse: null })
declare updatedByUser: AsyncBelongsTo<OrganizationUserModel> | null;

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

async resetKey(expiry: Date | null) {
Expand Down

0 comments on commit 43e56ca

Please sign in to comment.