fix: update config

This commit is contained in:
Qiuxia Fan
2022-01-12 18:47:04 +08:00
parent 5b95557905
commit a5f8cc2900
10 changed files with 31 additions and 40 deletions

View File

@@ -17,7 +17,7 @@ limitations under the License. -->
<div class="graph">
<div class="header">
<span>{{ states.widget.title }}</span>
<div class="tips">
<div class="tips" v-show="states.widget.tips">
<el-tooltip :content="states.widget.tips">
<Icon iconName="info_outline" size="sm" />
</el-tooltip>

View File

@@ -13,16 +13,6 @@ 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">Bar Width</span>
<el-slider
class="bar-width"
v-model="barWidth"
show-input
input-size="small"
@change="changeConfig({ barWidth })"
/>
</div>
<div>
<span class="label">Show Background</span>
<el-switch
@@ -45,7 +35,6 @@ const props = defineProps({
},
});
const emits = defineEmits(["update"]);
const barWidth = ref(props.config.barWidth || 30);
const showBackground = ref(props.config.showBackground || false);
function changeConfig(param: { [key: string]: unknown }) {

View File

@@ -49,7 +49,7 @@ import { LineConfig } from "@/types/dashboard";
const props = defineProps({
config: {
type: Object as PropType<LineConfig>,
default: () => ({ showBackground: true, barWidth: 30 }),
default: () => ({}),
},
});
const emits = defineEmits(["update"]);

View File

@@ -15,10 +15,15 @@ limitations under the License. -->
<template>
<div class="widget">
<div class="header flex-h">
<div>{{ data.widget.title || "" }}</div>
<div>{{ data.widget?.title || "" }}</div>
<div>
<el-tooltip :content="data.widget.tips">
<Icon iconName="info_outline" size="sm" class="operation" />
<el-tooltip :content="data.widget?.tips">
<Icon
iconName="info_outline"
size="sm"
class="operation"
v-show="data.widget?.tips"
/>
</el-tooltip>
<el-popover
placement="bottom"
@@ -37,11 +42,12 @@ limitations under the License. -->
</el-popover>
</div>
</div>
<div class="body" v-if="data.graph.type" v-loading="loading">
<div class="body" v-if="data.graph?.type" v-loading="loading">
<component
:is="data.graph.type"
:intervalTime="appStoreWithOut.intervalTime"
:data="state.source"
:config="data.graph"
/>
</div>
<div v-else class="no-data">{{ t("noData") }}</div>
@@ -108,6 +114,12 @@ export default defineComponent({
dashboardStore.setConfigPanel(true);
dashboardStore.selectWidget(props.data);
}
// watch(
// () => data.value,
// (data) => {
// console.log(data);
// }
// );
return {
state,
appStoreWithOut,

View File

@@ -30,7 +30,6 @@ export const DefaultGraphConfig: { [key: string]: any } = {
Bar: {
type: "Bar",
showBackground: true,
barWidth: 30,
},
Line: {
type: "Line",

View File

@@ -75,7 +75,6 @@ function getOption() {
name: i,
type: "bar",
symbol: "none",
barWidth: props.config.barWidth,
stack: "sum",
lineStyle: {
width: 1.5,