Skip to content

Commit cfd71b0

Browse files
committed
fixed reference error not finding viewchild table in table all component.
added hot reloading functionality for state change events. fixed parse error in frontend
1 parent e53055f commit cfd71b0

File tree

5 files changed

+17
-20
lines changed

5 files changed

+17
-20
lines changed

app/controllers/InstanceRegistryController.scala

+1-6
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,7 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma
117117
.addQueryStringParameters("Id" -> instanceID)
118118
.post("")
119119
.map { response =>
120-
response.status match {
121-
case 202 =>
122-
Ok(response.body)
123-
case x =>
124-
new Status(x)
125-
}
120+
new Status(response.status)
126121
}(myExecutionContext)
127122
}
128123

client/src/app/api/api/api.service.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class ApiService {
109109
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
110110
* @param reportProgress flag to report request and response progress.
111111
*/
112-
public startInstance(instanceId: string, observe: any = 'body', reportProgress: boolean = false): Observable<HttpEvent<number>> {
112+
public startInstance(instanceId: string, observe: any = 'body', reportProgress: boolean = false) {
113113
return this.postAction(START_INSTANCE, instanceId);
114114
}
115115

@@ -119,7 +119,7 @@ export class ApiService {
119119
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
120120
* @param reportProgress flag to report request and response progress.
121121
*/
122-
public stopInstance(instanceId: string, observe: any = 'body', reportProgress: boolean = false): Observable<HttpEvent<number>> {
122+
public stopInstance(instanceId: string, observe: any = 'body', reportProgress: boolean = false) {
123123
return this.postAction(STOP_INSTANCE, instanceId);
124124
}
125125

@@ -129,7 +129,7 @@ export class ApiService {
129129
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
130130
* @param reportProgress flag to report request and response progress.
131131
*/
132-
public pauseInstance(instanceId: string, observe: any = 'body', reportProgress: boolean = false): Observable<HttpEvent<number>> {
132+
public pauseInstance(instanceId: string, observe: any = 'body', reportProgress: boolean = false) {
133133
return this.postAction(PAUSE_INSTANCE, instanceId);
134134
}
135135

@@ -139,7 +139,7 @@ export class ApiService {
139139
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
140140
* @param reportProgress flag to report request and response progress.
141141
*/
142-
public resumeInstance(instanceId: string, observe: any = 'body', reportProgress: boolean = false): Observable<HttpEvent<number>> {
142+
public resumeInstance(instanceId: string, observe: any = 'body', reportProgress: boolean = false) {
143143
return this.postAction(RESUME_INSTANCE, instanceId);
144144
}
145145

@@ -149,7 +149,7 @@ export class ApiService {
149149
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
150150
* @param reportProgress flag to report request and response progress.
151151
*/
152-
public deleteInstance(instanceId: string): Observable<HttpEvent<number>> {
152+
public deleteInstance(instanceId: string) {
153153
return this.postAction(DELETE_INSTANCE, instanceId);
154154
}
155155

@@ -214,8 +214,7 @@ export class ApiService {
214214
}
215215

216216

217-
private postAction(endpoint: string, idInstance: string, observe: any = 'body', reportProgress: boolean = false):
218-
Observable<HttpEvent<number>> {
217+
private postAction(endpoint: string, idInstance: string, observe: any = 'body', reportProgress: boolean = false) {
219218
let queryParam = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
220219

221220
if (idInstance === null || idInstance === undefined) {
@@ -228,8 +227,7 @@ export class ApiService {
228227
}
229228

230229

231-
private commonConf(endpoint: string, queryParameters: HttpParams, observe: any = 'body', reportProgress: boolean = false):
232-
Observable<HttpEvent<number>> {
230+
private commonConf(endpoint: string, queryParameters: HttpParams, observe: any = 'body', reportProgress: boolean = false) {
233231
let headers = this.defaultHeaders;
234232

235233
// to determine the Accept header

client/src/app/dashboard/table-all/table-all.component.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<mat-form-field>
2424
<input id="filterData" matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
2525
</mat-form-field>
26-
<table class="mat-elevation-z8 mat-table" mat-table [dataSource]="dataSource">
26+
<mat-table class="mat-elevation-z8 mat-table" [dataSource]="dataSource">
2727
<ng-container matColumnDef="ID">
2828
<mat-header-cell *matHeaderCellDef> ID </mat-header-cell>
2929
<mat-cell *matCellDef="let element"> {{element.id}} </mat-cell>
@@ -78,7 +78,7 @@
7878

7979
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
8080
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
81-
</table>
81+
</mat-table>
8282
</div>
8383
</ng-template>
8484

client/src/app/dashboard/table-all/table-all.component.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export class TableAllComponent implements OnInit {
141141
public stopInstance(id: string): void {
142142

143143
this.apiService.stopInstance(id).subscribe((result: HttpEvent<number>) => {
144-
console.log('result', result);
144+
145145
}, err => {
146146
console.log('error stop Instance', err);
147147
});
@@ -154,7 +154,6 @@ export class TableAllComponent implements OnInit {
154154
public pauseInstance(id: string): void {
155155

156156
this.apiService.pauseInstance(id).subscribe((result: HttpEvent<number>) => {
157-
console.log('result', result);
158157
}, err => {
159158
console.log('error pause instance', err);
160159
});
@@ -167,7 +166,7 @@ export class TableAllComponent implements OnInit {
167166
public resumeInstance(id: string): void {
168167

169168
this.apiService.resumeInstance(id).subscribe((result: HttpEvent<number>) => {
170-
console.log('result', result);
169+
171170
}, err => {
172171
console.log('error pause instance', err);
173172
});

client/src/app/model/model.service.ts

+5
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ export class ModelService {
8585
this.storeService.changeInstancesState([data.instanceFrom, data.instanceTo]);
8686
});
8787

88+
89+
this.socketService.subscribeForEvent<Instance>(EventTypeEnum.StateChangedEvent).subscribe((data: Instance) => {
90+
this.storeService.changeInstancesState([data]);
91+
});
92+
8893
this.socketService.subscribeForEvent<InstanceLinkPayload>(EventTypeEnum.LinkStateChangedEvent).
8994
subscribe((data: InstanceLinkPayload) => {
9095
console.log('received link state changed', data);

0 commit comments

Comments
 (0)