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


Lukas Burgey's avatar
Lukas Burgey committed
5
// auth stuff
6
7
export interface IdP {
  id: number;
8
9
10
11
12
13
14
15
  name: string;
}

export interface AuthInfo {
  idps: IdP[];
  default: number;
}

16
17
18
19
20
export interface AllAuthInfo {
  idps: IdP[];
  selected: IdP;
}

Lukas Burgey's avatar
Lukas Burgey committed
21
// user stuff
Lukas Burgey's avatar
Lukas Burgey committed
22
23
24
25
export interface GroupDescription {
  description: string;
}

Lukas Burgey's avatar
Lukas Burgey committed
26
export interface Group {
Lukas Burgey's avatar
wip    
Lukas Burgey committed
27
  id: number;
Lukas Burgey's avatar
Lukas Burgey committed
28
  name: string;
Lukas Burgey's avatar
Lukas Burgey committed
29
  description: GroupDescription;
Lukas Burgey's avatar
Lukas Burgey committed
30
31
}

32
33
export type GroupMap = Map<Group, Service[]>

Lukas Burgey's avatar
Lukas Burgey committed
34
35
export interface Site {
  id: number;
36
37
38
  name: string;
}

39
40
41
42
43
44
45
export interface NewSSHKey {
  name: string;
  key: string;
}

export interface SSHKey {
  id: number;
46
47
48
49
  name: string;
  key: string;
}

Lukas Burgey's avatar
Lukas Burgey committed
50
51
52
53
54
export interface SSHKeyRef {
  id: number;
  name: string;
}

55
export interface Service {
56
  id: number;
57
  name: string;
58
59
  site: Site[];
  description: string;
Lukas Burgey's avatar
wip    
Lukas Burgey committed
60
  groups: Group[];
61
62
}

63
64
65
66
interface JSONObject {
  [key: string]: string;
}

Lukas Burgey's avatar
Lukas Burgey committed
67
68
69
70
71
72
export interface CredentialState {
  state: string;
  state_target: string;
  credential: SSHKeyRef;
}

73
// corresponds to NewDeploymentStateItem in the backend
Lukas Burgey's avatar
Lukas Burgey committed
74
75
export interface DeploymentStateItem {
  id: number;
76
77
78
  service: Service | undefined;
  group: Group | undefined;
  services: Service[];
Lukas Burgey's avatar
Lukas Burgey committed
79
80
  site: Site;
  state: string;
81
82
  questionnaire: JSONObject;
  credentials: JSONObject;
Lukas Burgey's avatar
Lukas Burgey committed
83
  credential_states: CredentialState;
Lukas Burgey's avatar
Lukas Burgey committed
84
  message: string;
Lukas Burgey's avatar
Lukas Burgey committed
85
}
86
87

// corresponds to NewDeployment in the backend
Lukas Burgey's avatar
Lukas Burgey committed
88
export interface Deployment {
Lukas Burgey's avatar
Lukas Burgey committed
89
  id: number;
90
91
  service: Service | undefined;
  group: number | undefined; // the group id
Lukas Burgey's avatar
Lukas Burgey committed
92
  services: Service[];
93
  sites: Site[];
94
95
96
  state_items: DeploymentStateItem[];
  state: string
  state_target: string
97
98
}

99
100
101
102
export interface UserInfo {
  groups: string[];
}

103
export interface User {
104
  id: number;
105
  profile_name: string;
106
  userinfo: UserInfo;
107
  ssh_keys: SSHKey[];
Lukas Burgey's avatar
Lukas Burgey committed
108
  services: Service[];
Lukas Burgey's avatar
wip    
Lukas Burgey committed
109
  groups: Group[];
110
111
}

Lukas Burgey's avatar
Lukas Burgey committed
112
113
114
export interface UserState {
  deployments: Deployment[];
  deployment_state_items: DeploymentStateItem[];
115
116
}

Lukas Burgey's avatar
Lukas Burgey committed
117
export interface StateAPIResult {
118
  user: User;
Lukas Burgey's avatar
Lukas Burgey committed
119
120
  user_state: UserState;
  services: Service[];
Lukas Burgey's avatar
Lukas Burgey committed
121
  error?: string;
122
123
124
125
126
127
128
129
130
131
132
}


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