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

Fix Deprecation in Organization and Service Account Routes #1486

Merged
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
Fix Deprecation in Organization and Service Account Routes
SmitGala committed Nov 14, 2024
commit 57a75c38c6dd6c8c581bfabf2bb01a226e796779
2 changes: 1 addition & 1 deletion app/components/organization-email-domain/index.js
Original file line number Diff line number Diff line change
@@ -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 () => {
2 changes: 1 addition & 1 deletion app/components/organization-invitation-list/index.ts
Original file line number Diff line number Diff line change
@@ -126,7 +126,7 @@ export default class OrganizationInvitationListComponent extends Component<Organ
}

get inviteList() {
return this.inviteResponse?.toArray() || [];
return this.inviteResponse?.slice() || [];
SmitGala marked this conversation as resolved.
Show resolved Hide resolved
}

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

get teamList() {
return this.teamResponse?.toArray() || [];
return this.teamResponse?.slice() || [];
SmitGala marked this conversation as resolved.
Show resolved Hide resolved
}

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

get userList() {
return this.userResponse?.toArray() || [];
return this.userResponse?.slice() || [];
SmitGala marked this conversation as resolved.
Show resolved Hide resolved
}

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

get teamsList() {
return this.teamResponse?.toArray() || [];
return this.teamResponse?.slice() || [];
SmitGala marked this conversation as resolved.
Show resolved Hide resolved
}

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

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

get totalNamespaceCount() {
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
@@ -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,
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
@@ -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,
2 changes: 1 addition & 1 deletion app/components/organization-team/index.ts
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ export default class OrganizationTeamComponent extends Component<OrganizationTea
}

get teamList() {
return this.teamResponse?.toArray() || [];
return this.teamResponse?.slice() || [];
SmitGala marked this conversation as resolved.
Show resolved Hide resolved
}

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

get teamMemberList() {
return this.teamMemberResponse?.toArray() || [];
return this.teamMemberResponse?.slice() || [];
SmitGala marked this conversation as resolved.
Show resolved Hide resolved
}

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

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

get totalTeamProjectCount() {
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: {
@@ -11,10 +16,29 @@ export interface OrganizationTeamProjectListProjectInfoComponentSignature {

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

@tracked teamProject: ProjectModel | null = null;
SmitGala marked this conversation as resolved.
Show resolved Hide resolved

get teamProject() {
return this.store.findRecord('project', this.args.project.id);
constructor(
owner: object,
args: OrganizationTeamProjectListProjectInfoComponentSignature['Args']
) {
super(owner, args);

this.fetchProjectDetail.perform();
}

fetchProjectDetail = task(async () => {
try {
this.teamProject = await this.store.findRecord(
'project',
this.args.project.id
);
} catch (e) {
this.notify.error(parseError(e));
}
});
}

declare module '@glint/environment-ember-loose/registry' {
14 changes: 10 additions & 4 deletions app/components/sso-settings/index.js
Original file line number Diff line number Diff line change
@@ -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' },
@@ -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
@@ -77,6 +75,14 @@ export default class SsoSettingsComponent extends Component {
}
});

getSSOData = task(async () => {
try {
this.sso = await this.store.queryRecord('organization-sso', {});
} catch (e) {
this.notify.error(parseError(e));
}
});

// Parse & upload IdP metadata
parseIdpMetadataXml = task(async (file) => {
let idpMetadataXml = await file.readAsText();
4 changes: 2 additions & 2 deletions app/models/organization-invitation.ts
Original file line number Diff line number Diff line change
@@ -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() {
2 changes: 1 addition & 1 deletion app/models/organization-team-invitation.ts
Original file line number Diff line number Diff line change
@@ -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() {
4 changes: 2 additions & 2 deletions app/models/service-account-project.ts
Original file line number Diff line number Diff line change
@@ -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')
6 changes: 3 additions & 3 deletions app/models/service-account.ts
Original file line number Diff line number Diff line change
@@ -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')
@@ -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) {