types.module.ts 2.78 KB
Newer Older
1
2
3
4
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';


5
6
7
8
9
10
11
12
// STATE ENUMS
const states = [
  'deployment_pending',
  'removal_pending',
  'deployed',
  'not_deployed',
  'questionnaire',
  'failed',
lukas.burgey's avatar
lukas.burgey committed
13
  'failed_permanently',
14
15
16
17
18
19
20
21
22
23
24
25
  'rejected',
] as const;

export type StateID = typeof states[number];

const stateTargets = [
  'deployed',
  'not_deployed',
] as const;

export type StateTargetID = typeof stateTargets[number];

Lukas Burgey's avatar
Lukas Burgey committed
26
// auth stuff
27
28
export interface IdP {
  id: number;
29
  name: string;
Lukas Burgey's avatar
Lukas Burgey committed
30
  issuer_uri: string;
31
32
}

Lukas Burgey's avatar
Lukas Burgey committed
33
34
export interface IdPInfo {
  selectedIdP?: IdP;
35
36
37
38
  idps: IdP[];
  default: number;
}

Lukas Burgey's avatar
Lukas Burgey committed
39
// user stuff
40
41
export interface EntitlementNameSpace  {
  name: string;
Lukas Burgey's avatar
Lukas Burgey committed
42
43
}

44
export interface VO {
Lukas Burgey's avatar
wip    
Lukas Burgey committed
45
  id: number;
Lukas Burgey's avatar
Lukas Burgey committed
46
  name: string;
47
48
49
50
  pretty_name: string;
  description: string;
  resourceType: string;
  name_space?: EntitlementNameSpace;
Lukas Burgey's avatar
Lukas Burgey committed
51
52
53
54
}

export interface Site {
  id: number;
55
  name: string;
Lukas Burgey's avatar
Lukas Burgey committed
56
  description: string;
57
58
}

59
60
61
62
63
64
65
export interface NewSSHKey {
  name: string;
  key: string;
}

export interface SSHKey {
  id: number;
66
67
68
69
  name: string;
  key: string;
}

Lukas Burgey's avatar
Lukas Burgey committed
70
71
72
73
74
export interface SSHKeyRef {
  id: number;
  name: string;
}

75
export interface Service {
76
  id: number;
77
  name: string;
Lukas Burgey's avatar
Lukas Burgey committed
78
  site: Site;
79
  description: string;
80
  vos: VO[];
81
82
  contact_email: string;
  contact_description: string;
83
84
}

Lukas Burgey's avatar
Lukas Burgey committed
85
export interface JSONObject {
86
87
88
  [key: string]: string;
}

lukas.burgey's avatar
lukas.burgey committed
89
90
91
92
export interface JSONObjectAny {
  [key: string]: any;
}

lukas.burgey's avatar
lukas.burgey committed
93
94
export type Answers = JSONObjectAny;

Lukas Burgey's avatar
Lukas Burgey committed
95
96
export interface CredentialState {
  credential: SSHKeyRef;
Lukas Burgey's avatar
Lukas Burgey committed
97
  is_pending: boolean;
98
99
  state: StateID;
  state_target: StateTargetID;
Lukas Burgey's avatar
Lukas Burgey committed
100
101
}

Lukas Burgey's avatar
Lukas Burgey committed
102
export interface DeploymentState {
lukas.burgey's avatar
lukas.burgey committed
103
  answers: Answers | undefined;
Lukas Burgey's avatar
Lukas Burgey committed
104
105
  credential_states: CredentialState[];
  credentials: JSONObject;
Lukas Burgey's avatar
Lukas Burgey committed
106
  id: number;
Lukas Burgey's avatar
Lukas Burgey committed
107
108
109
  is_credential_pending: boolean;
  is_pending: boolean;
  message: string;
Lukas Burgey's avatar
Lukas Burgey committed
110
  questionnaire: JSONObject | undefined;
lukas.burgey's avatar
lukas.burgey committed
111
  questionnaire_answers: JSONObjectAny | undefined;
Lukas Burgey's avatar
Lukas Burgey committed
112
  service: Service;
Lukas Burgey's avatar
Lukas Burgey committed
113
  site: Site;
114
115
  state: StateID;
  state_target: StateTargetID;
Lukas Burgey's avatar
Lukas Burgey committed
116
}
117

Lukas Burgey's avatar
Lukas Burgey committed
118
export interface Deployment {
Lukas Burgey's avatar
Lukas Burgey committed
119
  id: number;
Lukas Burgey's avatar
Lukas Burgey committed
120
121
  service?: Service; // only for ServiceDeployment
  services?: Service[]; // only for VODeployment
122
123
  state: StateID;
  state_target: StateTargetID;
Lukas Burgey's avatar
Lukas Burgey committed
124
125
  states: DeploymentState[];
  vo?: VO; // only for VODeployment
126
127
}

128
export interface User {
Lukas Burgey's avatar
Lukas Burgey committed
129
  deployments: Deployment[];
130
  id: number;
131
  profile_name: string;
Lukas Burgey's avatar
Lukas Burgey committed
132
  services: Service[];
133
  ssh_keys: SSHKey[];
Lukas Burgey's avatar
Lukas Burgey committed
134
135
  states: DeploymentState[];
  userinfo: JSONObject;
136
  vos: VO[];
137
138
}

Lukas Burgey's avatar
Lukas Burgey committed
139
140
export interface Session {
  deactivated?: boolean;
Lukas Burgey's avatar
Lukas Burgey committed
141
  auth_error?: string;
Lukas Burgey's avatar
Lukas Burgey committed
142
143
}

144
export interface State {
Lukas Burgey's avatar
Lukas Burgey committed
145
146
  msg?: string;
  session?: Session;
Lukas Burgey's avatar
Lukas Burgey committed
147
  user: User;
148
149
150
151
}

export interface Update {
  deployment?: Deployment;
152
  deployment_state?: DeploymentState;
Lukas Burgey's avatar
Lukas Burgey committed
153
  error?: string;
154
155
156
157
158
159
160
161
162
163
164
}


@NgModule({
  imports: [
    CommonModule
  ],
  declarations: [
  ]
})
export class TypesModule { }