mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-14 09:00:50 +00:00
add timmer
This commit is contained in:
parent
d27f79b89f
commit
f17de328a6
@ -140,7 +140,9 @@ const msg = {
|
|||||||
limit: "Limit",
|
limit: "Limit",
|
||||||
page: "Page",
|
page: "Page",
|
||||||
interval: "Refresh Interval",
|
interval: "Refresh Interval",
|
||||||
namespace: "Namespace",
|
pause: "Pause",
|
||||||
|
begin: "Start",
|
||||||
|
seconds: "Seconds",
|
||||||
hourTip: "Select Hour",
|
hourTip: "Select Hour",
|
||||||
minuteTip: "Select Minute",
|
minuteTip: "Select Minute",
|
||||||
secondTip: "Select Second",
|
secondTip: "Select Second",
|
||||||
|
@ -140,7 +140,9 @@ const msg = {
|
|||||||
processSelect: "Click para seleccionar proceso",
|
processSelect: "Click para seleccionar proceso",
|
||||||
page: "Página",
|
page: "Página",
|
||||||
interval: "Intervalo de actualización",
|
interval: "Intervalo de actualización",
|
||||||
namespace: "Espacio de nombres",
|
pause: "Pausa",
|
||||||
|
begin: "Inicio",
|
||||||
|
seconds: "Segundos",
|
||||||
hourTip: "Seleccione Hora",
|
hourTip: "Seleccione Hora",
|
||||||
minuteTip: "Seleccione Minuto",
|
minuteTip: "Seleccione Minuto",
|
||||||
secondTip: "Seleccione Segundo",
|
secondTip: "Seleccione Segundo",
|
||||||
|
@ -138,7 +138,9 @@ const msg = {
|
|||||||
limit: "范围",
|
limit: "范围",
|
||||||
page: "页面",
|
page: "页面",
|
||||||
interval: "刷新间隔时间",
|
interval: "刷新间隔时间",
|
||||||
namespace: "命名空间",
|
pause: "暂停",
|
||||||
|
begin: "开始",
|
||||||
|
seconds: "秒",
|
||||||
hourTip: "选择小时",
|
hourTip: "选择小时",
|
||||||
minuteTip: "选择分钟",
|
minuteTip: "选择分钟",
|
||||||
secondTip: "选择秒数",
|
secondTip: "选择秒数",
|
||||||
|
@ -67,7 +67,7 @@ limitations under the License. -->
|
|||||||
controls-position="right"
|
controls-position="right"
|
||||||
@change="changeField('interval', $event)"
|
@change="changeField('interval', $event)"
|
||||||
/>
|
/>
|
||||||
Seconds
|
{{ t("seconds") }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-h row">
|
<div class="flex-h row">
|
||||||
@ -124,10 +124,10 @@ limitations under the License. -->
|
|||||||
class="search-btn mt-10"
|
class="search-btn mt-10"
|
||||||
size="small"
|
size="small"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="searchLogs"
|
@click="runInterval"
|
||||||
>
|
>
|
||||||
<Icon size="sm" iconName="retry" class="reload" />
|
<Icon size="sm" iconName="retry" :loading="!!intervalFn" class="reload" />
|
||||||
{{ t("search") }}
|
{{ intervalFn ? t("pause") : t("start") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -160,6 +160,8 @@ const state = reactive<any>({
|
|||||||
container: { value: "", label: "None" },
|
container: { value: "", label: "None" },
|
||||||
duration: { label: "Last 30 min", value: 1800 },
|
duration: { label: "Last 30 min", value: 1800 },
|
||||||
});
|
});
|
||||||
|
/*global Nullable */
|
||||||
|
const intervalFn = ref<Nullable<any>>(null);
|
||||||
const rangeTime = computed(() => {
|
const rangeTime = computed(() => {
|
||||||
const times = {
|
const times = {
|
||||||
start: getLocalTime(
|
start: getLocalTime(
|
||||||
@ -205,6 +207,16 @@ async function getInstances() {
|
|||||||
}
|
}
|
||||||
state.instance = demandLogStore.instances[0];
|
state.instance = demandLogStore.instances[0];
|
||||||
}
|
}
|
||||||
|
function runInterval() {
|
||||||
|
if (intervalFn.value) {
|
||||||
|
clearInterval(intervalFn.value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
intervalFn.value = setInterval(searchLogs, intervalTime.value * 1000);
|
||||||
|
setTimeout(() => {
|
||||||
|
clearInterval(intervalFn.value);
|
||||||
|
}, state.duration * 1000);
|
||||||
|
}
|
||||||
function searchLogs() {
|
function searchLogs() {
|
||||||
let instance = "";
|
let instance = "";
|
||||||
if (dashboardStore.entity === EntityType[3].value) {
|
if (dashboardStore.entity === EntityType[3].value) {
|
||||||
@ -226,6 +238,7 @@ async function queryLogs() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function changeField(type: string, opt: any) {
|
function changeField(type: string, opt: any) {
|
||||||
|
clearInterval(intervalFn.value);
|
||||||
if (["limit", "interval"].includes(type)) {
|
if (["limit", "interval"].includes(type)) {
|
||||||
state[type] = opt;
|
state[type] = opt;
|
||||||
return;
|
return;
|
||||||
@ -239,6 +252,7 @@ function removeContent(index: number) {
|
|||||||
keywordsOfContent: keywordsOfContentList,
|
keywordsOfContent: keywordsOfContentList,
|
||||||
});
|
});
|
||||||
contentStr.value = "";
|
contentStr.value = "";
|
||||||
|
clearInterval(intervalFn.value);
|
||||||
}
|
}
|
||||||
function addLabels(type: string) {
|
function addLabels(type: string) {
|
||||||
if (type === "keywordsOfContent" && !contentStr.value) {
|
if (type === "keywordsOfContent" && !contentStr.value) {
|
||||||
@ -260,6 +274,7 @@ function addLabels(type: string) {
|
|||||||
});
|
});
|
||||||
excludingContentStr.value = "";
|
excludingContentStr.value = "";
|
||||||
}
|
}
|
||||||
|
clearInterval(intervalFn.value);
|
||||||
}
|
}
|
||||||
function removeExcludeContent(index: number) {
|
function removeExcludeContent(index: number) {
|
||||||
excludingKeywordsOfContent.value.splice(index, 1);
|
excludingKeywordsOfContent.value.splice(index, 1);
|
||||||
@ -267,6 +282,7 @@ function removeExcludeContent(index: number) {
|
|||||||
excludingKeywordsOfContent: excludingKeywordsOfContent.value,
|
excludingKeywordsOfContent: excludingKeywordsOfContent.value,
|
||||||
});
|
});
|
||||||
excludingContentStr.value = "";
|
excludingContentStr.value = "";
|
||||||
|
clearInterval(intervalFn.value);
|
||||||
}
|
}
|
||||||
watch(
|
watch(
|
||||||
() => selectorStore.currentService,
|
() => selectorStore.currentService,
|
||||||
@ -354,4 +370,8 @@ watch(
|
|||||||
.btn-row {
|
.btn-row {
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.reload {
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user