Skip to content

Commit

Permalink
Merge pull request #147 from appuio/default-organization
Browse files Browse the repository at this point in the history
Enable users to set their default organization
  • Loading branch information
mircowidmer authored Apr 11, 2022
2 parents e589e5c + 4a6474a commit bdb5ac9
Show file tree
Hide file tree
Showing 56 changed files with 1,218 additions and 458 deletions.
8 changes: 0 additions & 8 deletions cypress/fixtures/organization-list-empty.json

This file was deleted.

27 changes: 0 additions & 27 deletions cypress/fixtures/organization-list.json

This file was deleted.

This file was deleted.

25 changes: 0 additions & 25 deletions cypress/fixtures/organization-members-nxt.json

This file was deleted.

25 changes: 0 additions & 25 deletions cypress/fixtures/organization-members-vshn.json

This file was deleted.

25 changes: 0 additions & 25 deletions cypress/fixtures/organization-members.json

This file was deleted.

20 changes: 20 additions & 0 deletions cypress/fixtures/organization-members.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { UserRef } from '../../src/app/types/team';
import { OrganizationMembers } from '../../src/app/types/organization-members';

export interface OrganizationMembersConfig {
namespace: string;
userRefs: UserRef[];
}

export function createOrganizationMembers(organizationMembersConfig: OrganizationMembersConfig): OrganizationMembers {
return {
kind: 'OrganizationMembers',
apiVersion: 'appuio.io/v1',
metadata: {
namespace: organizationMembersConfig.namespace,
},
spec: {
userRefs: organizationMembersConfig.userRefs,
},
};
}
10 changes: 0 additions & 10 deletions cypress/fixtures/organization-update.json

This file was deleted.

70 changes: 70 additions & 0 deletions cypress/fixtures/organization.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { Organization, OrganizationList, OrganizationSpec } from '../../src/app/types/organization';

export interface OrganizationConfig {
name: string;
displayName?: string;
viewMembers?: boolean;
editOrganization?: boolean;
}

export interface OrganizationListConfig {
items: Organization[];
}

export const organizationVshn = createOrganization({
name: 'vshn',
displayName: 'VSHN - the DevOps Company',
});

export const organizationListNxtVshn = createOrganizationList({
items: [
createOrganization({
name: 'nxt',
displayName: 'nxt Engineering GmbH',
}),
createOrganization({
name: 'vshn',
}),
],
});

export const organizationListNxtVshnWithDisplayName = createOrganizationList({
items: [
createOrganization({
name: 'nxt',
displayName: 'nxt Engineering GmbH',
}),
createOrganization({
name: 'vshn',
displayName: 'VSHN AG',
}),
],
});

export function createOrganization(organizationConfig: OrganizationConfig): Organization {
let spec: OrganizationSpec = {};
if (organizationConfig.displayName) {
spec = {
displayName: organizationConfig.displayName,
};
}
return {
kind: 'Organization',
apiVersion: 'organization.appuio.io/v1',
metadata: {
name: organizationConfig.name,
},
spec,
viewMembers: organizationConfig.viewMembers,
editOrganization: organizationConfig.editOrganization,
};
}

export function createOrganizationList(organizationListConfig: OrganizationListConfig): OrganizationList {
return {
kind: 'OrganizationList',
apiVersion: 'organization.appuio.io/v1',
metadata: {},
items: organizationListConfig.items,
};
}
74 changes: 74 additions & 0 deletions cypress/fixtures/team.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { Team, UserRef } from '../../src/app/types/team';
import { List } from '../../src/app/types/list';

export interface TeamConfig {
name: string;
namespace: string;
displayName: string;
userRefs: UserRef[];
}

export interface TeamListConfig {
items: Team[];
}

export const team1 = createTeam({
name: 'team1',
namespace: 'nxt',
displayName: 'My Super Team 1',
userRefs: [{ name: 'mig' }, { name: 'miw' }],
});

export const teamListNxt = createTeamList({
items: [
createTeam({
name: 'team1',
namespace: 'nxt',
displayName: 'My Super Team 1',
userRefs: [{ name: 'mig' }, { name: 'miw' }],
}),
createTeam({
name: 'team2',
namespace: 'nxt',
displayName: 'My Super Team 2',
userRefs: [{ name: 'cma' }],
}),
],
});
export const teamListVshn = createTeamList({
items: [
createTeam({
name: 'tarazed',
namespace: 'vshn',
displayName: 'Tarazed',
userRefs: [{ name: 'corvus' }],
}),
],
});

export function createTeam(teamConfig: TeamConfig): Team {
return {
apiVersion: 'appuio.io/v1',
kind: 'Team',
metadata: {
name: teamConfig.name,
namespace: teamConfig.namespace,
},
spec: {
displayName: teamConfig.displayName,
userRefs: teamConfig.userRefs,
},
};
}

export function createTeamList(teamListConfig: TeamListConfig): List<Team> {
return {
apiVersion: 'v1',
kind: 'List',
items: teamListConfig.items,
metadata: {
resourceVersion: '',
selfLink: '',
},
};
}
19 changes: 0 additions & 19 deletions cypress/fixtures/team1-update.json

This file was deleted.

19 changes: 0 additions & 19 deletions cypress/fixtures/team1.json

This file was deleted.

9 changes: 0 additions & 9 deletions cypress/fixtures/teams-empty.json

This file was deleted.

Loading

0 comments on commit bdb5ac9

Please sign in to comment.