fix: list

This commit is contained in:
Qiuxia Fan 2022-03-31 13:51:33 +08:00
parent 13b508e896
commit d5cdbd94d9
3 changed files with 11 additions and 6 deletions

View File

@ -43,7 +43,7 @@ limitations under the License. -->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-for="(metric, index) in config.metrics" v-for="(metric, index) in colMetrics"
:label="`${metric} ${getUnit(index)}`" :label="`${metric} ${getUnit(index)}`"
:key="metric + index" :key="metric + index"
> >
@ -73,7 +73,7 @@ limitations under the License. -->
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from "vue"; import { ref, watch, computed } from "vue";
import { useSelectorStore } from "@/store/modules/selectors"; import { useSelectorStore } from "@/store/modules/selectors";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import type { PropType } from "vue"; import type { PropType } from "vue";
@ -118,6 +118,7 @@ const dashboardStore = useDashboardStore();
const chartLoading = ref<boolean>(false); const chartLoading = ref<boolean>(false);
const endpoints = ref<Endpoint[]>([]); const endpoints = ref<Endpoint[]>([]);
const searchText = ref<string>(""); const searchText = ref<string>("");
const colMetrics = computed(() => props.config.metrics.map((d: string) => d));
queryEndpoints(); queryEndpoints();

View File

@ -43,7 +43,7 @@ limitations under the License. -->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-for="(metric, index) in config.metrics" v-for="(metric, index) in colMetrics"
:label="`${metric} ${getUnit(index)}`" :label="`${metric} ${getUnit(index)}`"
:key="metric + index" :key="metric + index"
> >
@ -103,7 +103,7 @@ limitations under the License. -->
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from "vue"; import { ref, watch, computed } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import type { PropType } from "vue"; import type { PropType } from "vue";
@ -149,6 +149,7 @@ const chartLoading = ref<boolean>(false);
const instances = ref<Instance[]>([]); // current instances const instances = ref<Instance[]>([]); // current instances
const pageSize = 10; const pageSize = 10;
const searchText = ref<string>(""); const searchText = ref<string>("");
const colMetrics = computed(() => props.config.metrics.map((d: string) => d));
queryInstance(); queryInstance();
async function queryInstance() { async function queryInstance() {

View File

@ -55,7 +55,7 @@ limitations under the License. -->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-for="(metric, index) in config.metrics" v-for="(metric, index) in colMetrics"
:label="`${metric} ${getUnit(index)}`" :label="`${metric} ${getUnit(index)}`"
:key="metric + index" :key="metric + index"
> >
@ -96,7 +96,7 @@ limitations under the License. -->
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { watch, ref } from "vue"; import { watch, ref, computed } from "vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import type { PropType } from "vue"; import type { PropType } from "vue";
import { ServiceListConfig } from "@/types/dashboard"; import { ServiceListConfig } from "@/types/dashboard";
@ -138,6 +138,9 @@ const services = ref<Service[]>([]);
const searchText = ref<string>(""); const searchText = ref<string>("");
const groups = ref<any>({}); const groups = ref<any>({});
const sortServices = ref<(Service & { merge: boolean })[]>([]); const sortServices = ref<(Service & { merge: boolean })[]>([]);
const colMetrics = computed(() =>
props.config.metrics.filter((d: string) => d)
);
queryServices(); queryServices();