Skip to content

Commit da6da8b

Browse files
committed
added auto refresh button for vm metrics
1 parent d5ba23c commit da6da8b

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

ui/public/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,8 @@
414414
"label.auto.assign": "Automatically assign",
415415
"label.auto.assign.diskoffering.disk.size": "Automatically assign offering matching the disk size",
416416
"label.auto.assign.random.ip": "Automatically assign a random IP address",
417+
"label.auto.refresh.statistics": "Period between auto refreshes",
418+
"label.auto.refresh.statistics.none": "None",
417419
"label.automigrate.volume": "Auto migrate volume to another storage pool if required",
418420
"label.autoscale.vm.groups": "AutoScaling Groups",
419421
"label.autoscale.vm.profile": "AutoScale Instance Profile",

ui/public/locales/pt_BR.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@
288288
"label.author.name": "Nome do autor",
289289
"label.auto.assign.diskoffering.disk.size": "Atribuir automaticamente a oferta correspondente ao tamanho do disco",
290290
"label.auto.assign.random.ip": "Atribuir automaticamente um enderec\u0327o de IP aleat\u00f3rio",
291+
"label.auto.refresh.statistics": "Tempo entre atualiza\u00e7\u00f5es autom\u00e1ticas",
292+
"label.auto.refresh.statistics.none": "Nenhum",
291293
"label.autoscalingenabled": "Escalonamento autom\u00e1tico",
292294
"label.availability": "Disponibilidade",
293295
"label.available": "Dispon\u00edvel",
@@ -609,6 +611,12 @@
609611
"label.download.state": "Estado do download",
610612
"label.dpd": "Detec\u00e7\u00e3o de correspondente morto",
611613
"label.driver": "Driver",
614+
"label.duration.custom": "Personalizado",
615+
"label.duration.1hour": "1 hora",
616+
"label.duration.6hours": "6 horas",
617+
"label.duration.12hours": "12 horas",
618+
"label.duration.24hours": "24 horas",
619+
"label.duration.7days": "7 dias",
612620
"label.dynamicscalingenabled": "Escalonamento din\u00e2mico habilitado",
613621
"label.dynamicscalingenabled.tooltip": "VM s\u00f3 pode ser dinamicamente escalonada quando o escalonamento din\u00e2mico estiver habilitado no template, oferta de computa\u00e7\u00e3o e nas configura\u00e7\u00e3oes globais",
614622
"label.edit": "Editar",

ui/src/components/view/StatsTab.vue

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
buttonStyle="solid"
4444
@change="handleDurationChange">
4545
<a-radio-button value="">
46-
{{ $t('1 hour') }}
46+
{{ $t('label.duration.1hour') }}
4747
</a-radio-button>
4848
<a-radio-button value="6hours" v-if="statsRetentionTime >= 60">
4949
{{ $t('label.duration.6hours') }}
@@ -62,6 +62,16 @@
6262
</a-radio-button>
6363
</a-radio-group>
6464
<InfoCircleOutlined class="info-icon" :title="$t('label.see.more.info.shown.charts')" @click="onClickShowResourceInfoModal('CHART')"/>
65+
<span>{{$t('label.auto.refresh.statistics')}}</span>
66+
<a-select
67+
v-model:value="refreshTime"
68+
style="width: 100px">
69+
<a-select-option value="0">{{$t('label.auto.refresh.statistics.none')}}</a-select-option>
70+
<a-select-option value="5000">5s</a-select-option>
71+
<a-select-option value="30000">30s</a-select-option>
72+
<a-select-option value="60000">1min</a-select-option>
73+
<a-select-option value="300000">5min</a-select-option>
74+
</a-select>
6575
</div>
6676
<div class="ant-tag" v-if="durationSelectorValue==='custom'">
6777
<a-button @click="openFilter()">
@@ -297,6 +307,8 @@ export default {
297307
selectedDiskUnitOfMeasurement: 'KiB',
298308
diskUnitsOfMeasurement: ['KiB', 'MiB', 'GiB'],
299309
chartLabels: [],
310+
refreshTime: '0',
311+
refreshIntervalId: null,
300312
resourceUsageHistory: {
301313
cpu: [],
302314
memory: {
@@ -334,6 +346,9 @@ export default {
334346
mounted () {
335347
this.fetchData()
336348
},
349+
unmounted () {
350+
window.clearInterval(this.refreshIntervalId)
351+
},
337352
computed: {
338353
statsRetentionTime () {
339354
if (this.resourceType === 'Volume') {
@@ -371,6 +386,15 @@ export default {
371386
return
372387
}
373388
this.fetchData()
389+
},
390+
refreshTime: function () {
391+
this.fetchData()
392+
if (this.refreshTime === '0') return window.clearInterval(this.refreshIntervalId)
393+
394+
window.clearInterval(this.refreshIntervalId)
395+
this.refreshIntervalId = window.setInterval(() => {
396+
this.fetchData()
397+
}, parseInt(this.refreshTime))
374398
}
375399
},
376400
methods: {

0 commit comments

Comments
 (0)