Commit 572e1933 authored by Lukas Burgey's avatar Lukas Burgey
Browse files

Rename model types

parent 4730181e
...@@ -2,7 +2,7 @@ import { Component, OnInit, Inject } from '@angular/core'; ...@@ -2,7 +2,7 @@ import { Component, OnInit, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatTableDataSource } from '@angular/material'; import { MAT_DIALOG_DATA, MatTableDataSource } from '@angular/material';
import { UserService } from '../../user.service'; import { UserService } from '../../user.service';
import { DeploymentStateItem, Service, CredentialState } from '../../types/types.module'; import { DeploymentState, Service, CredentialState } from '../../types/types.module';
@Component({ @Component({
selector: 'app-credentials', selector: 'app-credentials',
...@@ -12,7 +12,7 @@ import { DeploymentStateItem, Service, CredentialState } from '../../types/types ...@@ -12,7 +12,7 @@ import { DeploymentStateItem, Service, CredentialState } from '../../types/types
export class CredentialsComponent implements OnInit { export class CredentialsComponent implements OnInit {
public columns = ["name", "value"]; public columns = ["name", "value"];
public stateItem: DeploymentStateItem; public stateItem: DeploymentState;
public service: Service; public service: Service;
public credentialCount: number = 0; public credentialCount: number = 0;
public table: MatTableDataSource<any>; public table: MatTableDataSource<any>;
......
...@@ -54,7 +54,7 @@ export class DialogService { ...@@ -54,7 +54,7 @@ export class DialogService {
); );
} }
public openQuestionnaire(stateItem: t.DeploymentStateItem) { public openQuestionnaire(stateItem: t.DeploymentState) {
this.questionnaireDialog = this.dialog.open( this.questionnaireDialog = this.dialog.open(
QuestionnaireComponent, QuestionnaireComponent,
this.settingsData({ this.settingsData({
...@@ -63,7 +63,7 @@ export class DialogService { ...@@ -63,7 +63,7 @@ export class DialogService {
); );
} }
public openCredentials(stateItem: t.DeploymentStateItem) { public openCredentials(stateItem: t.DeploymentState) {
this.credentialsDialog = this.dialog.open( this.credentialsDialog = this.dialog.open(
CredentialsComponent, CredentialsComponent,
this.settingsData({ this.settingsData({
...@@ -72,7 +72,7 @@ export class DialogService { ...@@ -72,7 +72,7 @@ export class DialogService {
); );
} }
public openMessage(stateItem: t.DeploymentStateItem) { public openMessage(stateItem: t.DeploymentState) {
this.messageDialog = this.dialog.open( this.messageDialog = this.dialog.open(
MessageComponent, MessageComponent,
this.settingsData({ this.settingsData({
......
...@@ -10,7 +10,7 @@ import * as t from '../../types/types.module'; ...@@ -10,7 +10,7 @@ import * as t from '../../types/types.module';
styleUrls: ['./message.component.css'] styleUrls: ['./message.component.css']
}) })
export class MessageComponent implements OnInit { export class MessageComponent implements OnInit {
public stateItem: t.DeploymentStateItem; public stateItem: t.DeploymentState;
constructor( constructor(
public userService: UserService, public userService: UserService,
......
...@@ -11,7 +11,7 @@ import * as t from '../../types/types.module'; ...@@ -11,7 +11,7 @@ import * as t from '../../types/types.module';
}) })
export class QuestionnaireComponent implements OnInit { export class QuestionnaireComponent implements OnInit {
public answers: Object = {}; public answers: Object = {};
public stateItem: t.DeploymentStateItem; public stateItem: t.DeploymentState;
constructor( constructor(
public userService: UserService, public userService: UserService,
......
...@@ -27,7 +27,7 @@ export class ServiceComponent implements OnInit { ...@@ -27,7 +27,7 @@ export class ServiceComponent implements OnInit {
ngOnInit() { ngOnInit() {
} }
public stateItem(site: t.Site): t.DeploymentStateItem | undefined { public stateItem(site: t.Site): t.DeploymentState | undefined {
if (this.deployment) { if (this.deployment) {
return this.deployment.state_items.find( return this.deployment.state_items.find(
item => { item => {
......
...@@ -71,8 +71,7 @@ export interface CredentialState { ...@@ -71,8 +71,7 @@ export interface CredentialState {
credential: SSHKeyRef; credential: SSHKeyRef;
} }
// corresponds to NewDeploymentStateItem in the backend export interface DeploymentState {
export interface DeploymentStateItem {
id: number; id: number;
service: Service | undefined; service: Service | undefined;
vo: VO | undefined; vo: VO | undefined;
...@@ -85,13 +84,12 @@ export interface DeploymentStateItem { ...@@ -85,13 +84,12 @@ export interface DeploymentStateItem {
message: string; message: string;
} }
// corresponds to NewDeployment in the backend
export interface Deployment { export interface Deployment {
id: number; id: number;
service: Service | undefined; service: Service | undefined;
vo: number | undefined; // the vo id vo: number | undefined; // the vo id
services: Service[]; services: Service[];
state_items: DeploymentStateItem[]; state_items: DeploymentState[];
state: string state: string
state_target: string state_target: string
} }
...@@ -115,7 +113,7 @@ export interface User { ...@@ -115,7 +113,7 @@ export interface User {
export interface UserState { export interface UserState {
deployments: Deployment[]; deployments: Deployment[];
//deployment_state_items: DeploymentStateItem[]; //deployment_state_items: DeploymentState[];
} }
export interface State { export interface State {
......
...@@ -5,7 +5,7 @@ import { map } from 'rxjs/operators'; ...@@ -5,7 +5,7 @@ import { map } from 'rxjs/operators';
import { UserService } from '../user.service'; import { UserService } from '../user.service';
import { DialogService } from '../dialogues/dialog.service'; import { DialogService } from '../dialogues/dialog.service';
import { VO, Site, Service, Deployment, DeploymentStateItem } from '../types/types.module'; import { VO, Site, Service, Deployment, DeploymentState } from '../types/types.module';
@Component({ @Component({
selector: 'app-vo-data', selector: 'app-vo-data',
...@@ -85,13 +85,13 @@ export class VoDataComponent implements OnInit { ...@@ -85,13 +85,13 @@ export class VoDataComponent implements OnInit {
); );
} }
public subscribeStateItem(site: Site, service: Service): Observable<DeploymentStateItem> { public subscribeStateItem(site: Site, service: Service): Observable<DeploymentState> {
return this.deployment$$.pipe( return this.deployment$$.pipe(
map( map(
(dep: Deployment) => { (dep: Deployment) => {
if (dep.state_items) { if (dep.state_items) {
return dep.state_items.find( return dep.state_items.find(
(dsi: DeploymentStateItem) => dsi.site.id == site.id && dsi.service.id == service.id, (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