Commit fea5dc32 authored by Lukas Burgey's avatar Lukas Burgey

Fix some types

parent 2fe82cdc
......@@ -66,66 +66,50 @@ interface JSONObject {
}
export interface CredentialState {
state: string;
state_target: string;
credential: SSHKeyRef;
is_pending: boolean;
state: string;
state_target: string;
}
export interface DeploymentState {
credential_states: CredentialState[];
credentials: JSONObject;
id: number;
service: Service | undefined;
vo: VO | undefined;
services: Service[];
is_credential_pending: boolean;
is_pending: boolean;
message: string;
questionnaire: JSONObject;
service: Service;
site: Site;
state: string;
questionnaire: JSONObject;
credentials: JSONObject;
credential_states: CredentialState[];
message: string;
is_pending: boolean;
is_credential_pending: boolean;
state_target: string;
}
export interface Deployment {
id: number;
states: DeploymentState[];
service?: Service; // only for ServiceDeployment
services?: Service[]; // only for VODeployment
state: string
state_target: string
// only for ServiceDeployment
service?: Service;
// only for VODeployment
vo?: VO; // the vo id
services?: Service[];
}
export interface UserInfo {
vos: string[];
states: DeploymentState[];
vo?: VO; // only for VODeployment
}
export interface User {
deployments: Deployment[];
id: number;
profile_name: string;
userinfo: UserInfo;
services: Service[];
ssh_keys: SSHKey[];
states: DeploymentState[];
userinfo: JSONObject;
vos: VO[];
// these are additions here
services: Service[];
deployments: Deployment[];
error?: string;
}
export interface UserState {
deployments: Deployment[];
//deployment_states: DeploymentState[];
}
export interface State {
user: User;
error?: string;
user: User;
}
export interface Update {
......
......@@ -10,7 +10,9 @@ import { Message } from '@stomp/stompjs';
import { SnackBarService } from './snackbar.service';
import { IdpService } from './idp.service';
import { VO, User, Update, State, Deployment, SSHKey, NewSSHKey, IdP, Service } from './types/types.module';
import {
VO, User, Update, State, Deployment, DeploymentState, SSHKey, NewSSHKey, IdP, Service
} from './types/types.module';
@Injectable()
......@@ -341,4 +343,9 @@ export class UserService {
),
);
}
public subscribeDeploymentStates(): Observable<DeploymentState[]> {
let statesSelector = (user: User) => user ? user.states : [];
return this.subscribeSpecific<DeploymentState[]>(statesSelector);
}
}
......@@ -88,15 +88,10 @@ export class VoDataComponent implements OnInit {
}
public subscribeStateItem(site: Site, service: Service): Observable<DeploymentState> {
return this.deployment$$.pipe(
map((dep: Deployment) => {
if (dep != undefined) {
return dep.states.find(
(dsi: DeploymentState) => dsi.site.id == site.id && dsi.service.id == service.id,
)
}
},
),
return this.userService.subscribeDeploymentStates().pipe(
map((states: DeploymentState[]) => states.find(
(dsi: DeploymentState) => dsi.site.id == site.id && dsi.service.id == service.id,
)),
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment