This is an automated email from the ASF dual-hosted git repository. guangning pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pulsar-manager.git
The following commit(s) were added to refs/heads/master by this push: new 6f67028 Add auto refresh in Topic Details page #341 (#352) 6f67028 is described below commit 6f67028548142059225f4929efd955a3cd888f49 Author: xuesongxs <54351417+xueson...@users.noreply.github.com> AuthorDate: Thu Nov 12 09:53:29 2020 +0800 Add auto refresh in Topic Details page #341 (#352) Fixes #341 ### Motivation Add auto refresh in Topic Details page --- front-end/src/lang/en.js | 3 +- front-end/src/lang/zh.js | 3 +- .../views/management/topics/partitionedTopic.vue | 40 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/front-end/src/lang/en.js b/front-end/src/lang/en.js index 5f5fd59..a87c5db 100644 --- a/front-end/src/lang/en.js +++ b/front-end/src/lang/en.js @@ -637,7 +637,8 @@ export default { deleteTopicMessage: 'Are you sure you want to delete this topic?', partitionedTopicName: 'Partitioned Topic Name', selectRoleMessage: 'Please Select Role', - backlogOpeartion: 'Backlog Operation' + backlogOpeartion: 'Backlog Operation', + autoRefresh: 'Auto Refresh' }, cluster: { label: 'Cluster', diff --git a/front-end/src/lang/zh.js b/front-end/src/lang/zh.js index 59afe53..574d7fd 100644 --- a/front-end/src/lang/zh.js +++ b/front-end/src/lang/zh.js @@ -635,7 +635,8 @@ export default { deleteTopicMessage: 'Are you sure you want to delete this topic?', partitionedTopicName: 'Partitioned Topic Name', selectRoleMessage: 'Please Select Role', - backlogOpeartion: 'Backlog Operation' + backlogOpeartion: 'Backlog Operation', + autoRefresh: 'Auto Refresh' }, cluster: { label: 'Cluster', diff --git a/front-end/src/views/management/topics/partitionedTopic.vue b/front-end/src/views/management/topics/partitionedTopic.vue index b0857a3..8277231 100644 --- a/front-end/src/views/management/topics/partitionedTopic.vue +++ b/front-end/src/views/management/topics/partitionedTopic.vue @@ -32,6 +32,17 @@ <el-option v-for="(item,index) in topicsListOptions" :key="item+index" :label="item" :value="item"/> </el-select> </el-form-item> + <div class="refresh-container"> + <el-form-item :label="$t('topic.autoRefresh')"> + <el-select ref="autoRefreshSelect" v-model="autoRefreshInterval" placeholder="select auto refresh" @change="onAutoRefreshChanged"> + <el-option :key="off" label="off" value="off"/> + <el-option :key="5" label="5s" value="5"/> + <el-option :key="10" label="10s" value="10"/> + <el-option :key="30" label="30s" value="30"/> + <el-option :key="60" label="60s" value="60"/> + </el-select> + </el-form-item> + </div> </el-form> <el-form v-if="replicatedClusters.length > 0" :inline="true" :model="clusterForm" class="form-container"> <el-form-item :label="$t('table.cluster')"> @@ -331,6 +342,7 @@ export default { }, data() { return { + autoRefreshInterval: 'off', postForm: Object.assign({}, defaultForm), clusterForm: Object.assign({}, defaultClusterForm), activeName: 'overview', @@ -410,6 +422,17 @@ export default { this.getReplicatedClusters() this.initTopicStats() this.initPermissions() + let refreshInterval = sessionStorage.getItem('refreshInterval') + this.autoRefreshInterval = refreshInterval + setTimeout(() => { + if (refreshInterval !== null && refreshInterval !== undefined && refreshInterval !== 'off') { + refreshInterval = parseInt(refreshInterval) + this.refreshIntervalId = setInterval(() => { + location.reload() + this.$refs.autoRefreshSelect.value = refreshInterval + }, refreshInterval * 1000) + } + }, 1000) }, methods: { getRemoteTenantsList() { @@ -762,6 +785,19 @@ export default { this.initTopicStats() this.dialogFormVisible = false }) + }, + onAutoRefreshChanged(val) { + if (this.refreshIntervalId !== undefined) { + clearInterval(this.refreshIntervalId) + } + if (val !== 'off') { + sessionStorage.setItem('refreshInterval', val) + this.refreshIntervalId = setInterval(() => { + location.reload() + }, val * 1000) + } else { + sessionStorage.removeItem('refreshInterval') + } } } } @@ -791,4 +827,8 @@ export default { -webkit-transform: rotate(90deg); /* Safari 和 Chrome */ -o-transform: rotate(90deg); /* Opera */ } + +.refresh-container { + float:right; +} </style>