add config for event

This commit is contained in:
Qiuxia Fan 2022-07-18 10:35:18 +08:00
parent d0616d628f
commit def4a9a630
6 changed files with 64 additions and 0 deletions

View File

@ -147,6 +147,7 @@ const msg = {
nameTip: nameTip:
"The name only supports Chinese and English, horizontal lines and underscores", "The name only supports Chinese and English, horizontal lines and underscores",
duplicateName: "Duplicate name", duplicateName: "Duplicate name",
enableAssociate: "Enable association",
seconds: "Seconds", seconds: "Seconds",
hourTip: "Select Hour", hourTip: "Select Hour",
minuteTip: "Select Minute", minuteTip: "Select Minute",

View File

@ -147,6 +147,7 @@ const msg = {
duplicateName: "Nombre duplicado", duplicateName: "Nombre duplicado",
nameTip: nameTip:
"Este nombre sólo admite chino e inglés, líneas cruzadas y subrayado", "Este nombre sólo admite chino e inglés, líneas cruzadas y subrayado",
enableAssociate: "Activar asociación",
seconds: "Segundos", seconds: "Segundos",
hourTip: "Seleccione Hora", hourTip: "Seleccione Hora",
minuteTip: "Seleccione Minuto", minuteTip: "Seleccione Minuto",

View File

@ -143,6 +143,7 @@ const msg = {
associateOptions: "关联选项", associateOptions: "关联选项",
widget: "部件", widget: "部件",
nameTip: "该名称仅支持中文和英文、横线和下划线", nameTip: "该名称仅支持中文和英文、横线和下划线",
enableAssociate: "启用关联",
duplicateName: "重复的名称", duplicateName: "重复的名称",
seconds: "秒", seconds: "秒",
hourTip: "选择小时", hourTip: "选择小时",

View File

@ -0,0 +1,52 @@
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. -->
<template>
<div>
<span class="label">{{ t("enableAssociate") }}</span>
<el-switch
v-model="associate"
active-text="Yes"
inactive-text="No"
@change="updateConfig"
/>
</div>
</template>
<script lang="ts" setup>
import { useI18n } from "vue-i18n";
import { ref } from "vue";
import { useDashboardStore } from "@/store/modules/dashboard";
const { t } = useI18n();
const dashboardStore = useDashboardStore();
const associate = ref(dashboardStore.selectedGrid.associate || false);
function updateConfig() {
dashboardStore.selectedGrid = {
...dashboardStore.selectedGrid,
associate,
};
dashboardStore.selectWidget(dashboardStore.selectedGrid);
}
</script>
<style lang="scss" scoped>
.label {
font-size: 13px;
font-weight: 500;
display: block;
margin-bottom: 5px;
}
.item {
margin: 10px 0;
}
</style>

View File

@ -18,9 +18,11 @@
import Text from "./Text.vue"; import Text from "./Text.vue";
import Widget from "./Widget.vue"; import Widget from "./Widget.vue";
import Topology from "./Topology.vue"; import Topology from "./Topology.vue";
import Event from "./Event.vue";
export default { export default {
Text, Text,
Widget, Widget,
Topology, Topology,
Event,
}; };

View File

@ -25,6 +25,9 @@ limitations under the License. -->
<Icon iconName="ellipsis_v" size="middle" class="operation" /> <Icon iconName="ellipsis_v" size="middle" class="operation" />
</span> </span>
</template> </template>
<div class="tools" @click="editConfig">
<span>{{ t("edit") }}</span>
</div>
<div class="tools" @click="removeWidget"> <div class="tools" @click="removeWidget">
<span>{{ t("delete") }}</span> <span>{{ t("delete") }}</span>
</div> </div>
@ -58,6 +61,10 @@ const dashboardStore = useDashboardStore();
function removeWidget() { function removeWidget() {
dashboardStore.removeControls(props.data); dashboardStore.removeControls(props.data);
} }
function editConfig() {
dashboardStore.setConfigPanel(true);
dashboardStore.selectWidget(props.data);
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.event-wrapper { .event-wrapper {