Skip to content
This repository was archived by the owner on Mar 25, 2023. It is now read-only.

Commit 9983a79

Browse files
author
wowshakhov
authored
Merge pull request #250 from bwsw/230-vm-statistics-reload
(closes #230) Add "Refresh statistics" button to VM statistics
2 parents 8f6e465 + 9a0e713 commit 9983a79

File tree

6 files changed

+36
-3
lines changed

6 files changed

+36
-3
lines changed

src/app/shared/components/vm-statistics/vm-statistics.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,6 @@ <h2 mdl-card-title-text>{{ 'STORAGE' | translate }}</h2>
110110
</div>
111111
<mdl-card-actions class="stat-collapse"></mdl-card-actions>
112112
</mdl-card>
113+
<mdl-tooltip #refreshStatistics="mdlTooltip">
114+
{{ 'REFRESH' | translate }}
115+
</mdl-tooltip>

src/app/vm/shared/vm.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export class VmService extends BaseBackendService<VirtualMachine> {
107107
});
108108
}
109109

110-
public getList(params?: {}, lite = false): Observable<Array<VirtualMachine>> {
110+
public getList(params?: {}): Observable<Array<VirtualMachine>> {
111111
if (lite) {
112112
return super.getList(params);
113113
}

src/app/vm/vm-sidebar/vm-detail.component.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,5 +288,20 @@ <h2 mdl-card-title-text>{{ 'STATISTICS' | translate }}</h2>
288288
</div>
289289
</div>
290290
</mdl-card-supporting-text>
291+
<mdl-card-menu>
292+
<button
293+
mdl-button
294+
mdl-ripple
295+
mdl-button-type="icon"
296+
mdl-tooltip-position="left"
297+
[mdl-tooltip]="refreshStatisticsTooltip"
298+
(click)="updateStats()"
299+
>
300+
<mdl-icon>sync</mdl-icon>
301+
</button>
302+
</mdl-card-menu>
291303
</mdl-card>
292304
</div>
305+
<mdl-tooltip #refreshStatisticsTooltip="mdlTooltip">
306+
{{ 'REFRESH' | translate }}
307+
</mdl-tooltip>

src/app/vm/vm-sidebar/vm-detail.component.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,19 @@ export class VmDetailComponent implements OnChanges, OnInit, OnDestroy {
174174
);
175175
}
176176

177+
public updateStats(): void {
178+
this.vmService.get(this.vm.id, true)
179+
.subscribe(vm => {
180+
this.vm.cpuUsed = vm.cpuUsed;
181+
this.vm.networkKbsRead = vm.networkKbsRead;
182+
this.vm.networkKbsWrite = vm.networkKbsWrite;
183+
this.vm.diskKbsRead = vm.diskKbsRead;
184+
this.vm.diskKbsWrite = vm.diskKbsWrite;
185+
this.vm.diskIoRead = vm.diskIoRead;
186+
this.vm.diskIoWrite = vm.diskIoWrite;
187+
});
188+
}
189+
177190
private update(): void {
178191
this.updateColor();
179192
this.updateDescription();

src/i18n/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,5 +567,6 @@
567567
"ENTER_GROUP_NAME": "Enter group name",
568568
"REMOVE_FROM_GROUP": "Remove from the group",
569569
"REMOVE": "Remove",
570-
"CLICK_TO_ASSIGN": "Click to assign"
570+
"CLICK_TO_ASSIGN": "Click to assign",
571+
"REFRESH": "Refresh"
571572
}

src/i18n/ru.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,5 +567,6 @@
567567
"ENTER_GROUP_NAME": "Введите имя",
568568
"REMOVE_FROM_GROUP": "Удалить из группы",
569569
"REMOVE": "Удалить",
570-
"CLICK_TO_ASSIGN": "Нажмите, чтобы присвоить"
570+
"CLICK_TO_ASSIGN": "Нажмите, чтобы присвоить",
571+
"REFRESH": "Обновить"
571572
}

0 commit comments

Comments
 (0)