update settings

This commit is contained in:
Fine 2025-05-29 17:56:27 +08:00
parent 4d75831419
commit f8d320a11f
4 changed files with 27 additions and 15 deletions

View File

@ -17,10 +17,10 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { store } from "@/store"; import { store } from "@/store";
import fetchQuery from "@/graphql/http"; import fetchQuery from "@/graphql/http";
import type { Cluster, ConfigTTL } from "@/types/settings"; import type { ClusterNode, ConfigTTL } from "@/types/settings";
interface SettingsState { interface SettingsState {
clusterNodes: Cluster[]; clusterNodes: ClusterNode[];
debuggingConfig: Indexable<string>; debuggingConfig: Indexable<string>;
configTTL: Recordable<ConfigTTL>; configTTL: Recordable<ConfigTTL>;
} }

View File

@ -17,7 +17,7 @@
import type { MetricsTTL, RecordsTTL } from "@/types/app"; import type { MetricsTTL, RecordsTTL } from "@/types/app";
export type Cluster = { export type ClusterNode = {
host: string; host: string;
port: number; port: number;
isSelf: boolean; isSelf: boolean;

View File

@ -95,17 +95,21 @@ limitations under the License. -->
</div> </div>
<div class="flex-h item"> <div class="flex-h item">
<span class="label">{{ t("clusterNodes") }}</span> <span class="label">{{ t("clusterNodes") }}</span>
<div style="width: 80%"> <div>
<el-table :data="settingsStore.clusterNodes" class="mb-5" style="width: 100%"> <el-table
<el-table-column prop="host" label="Host" /> :data="settingsStore.clusterNodes"
<el-table-column prop="port" label="Port" /> class="mb-5"
<el-table-column prop="isSelf" label="Self" /> :row-style="{ backgroundColor: 'var(--layout-background)' }"
>
<el-table-column prop="host" label="Host" width="280" />
<el-table-column prop="port" label="Port" width="180" />
<el-table-column prop="isSelf" label="Self" width="180" />
</el-table> </el-table>
<el-pagination <el-pagination
class="pagination" class="pagination"
layout="prev, pager, next" layout="prev, pager, next"
:page-size="pageSize" :page-size="pageSize"
:total="Object.keys(settingsStore.debuggingConfig).length" :total="settingsStore.clusterNodes.length"
v-model="currentPage" v-model="currentPage"
@current-change="changePage" @current-change="changePage"
@prev-click="changePage" @prev-click="changePage"
@ -115,15 +119,17 @@ limitations under the License. -->
</div> </div>
<div class="flex-h item"> <div class="flex-h item">
<span class="label">{{ t("debuggingConfigDump") }}</span> <span class="label">{{ t("debuggingConfigDump") }}</span>
<div class="dump" v-for="(item, index) of Object.keys(settingsStore.debuggingConfig)" :key="`${item}${index}`"> <div class="config-dump-content">
{{ `${item}: ${settingsStore.debuggingConfig[item]}` }} <div class="mb-10" v-for="(item, index) of Object.keys(settingsStore.debuggingConfig)" :key="`${item}${index}`">
{{ `${item}: ${settingsStore.debuggingConfig[item]}` }}
</div>
<div v-if="!Object.keys(settingsStore.debuggingConfig).length" class="tips">No Data</div>
</div> </div>
<div v-if="!Object.keys(settingsStore.debuggingConfig).length" class="dump tips">No Data</div>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, onMounted } from "vue"; import { ref, computed, onMounted } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
import { useSettingsStore } from "@/store/modules/settings"; import { useSettingsStore } from "@/store/modules/settings";
@ -217,13 +223,18 @@ limitations under the License. -->
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.dump { .config-dump-content {
line-height: 25px; border: 1px solid var(--el-color-info-light-8);
height: 400px;
overflow: auto;
padding: 5px;
border-radius: 5px 3px;
} }
.tips { .tips {
text-align: center; text-align: center;
width: 80%; width: 80%;
line-height: 25px;
color: var(--el-text-color-secondary); color: var(--el-text-color-secondary);
} }

View File

@ -77,6 +77,7 @@ export default ({ mode }: ConfigEnv): UserConfig => {
}, },
"/api": { "/api": {
target: `${VITE_SW_PROXY_TARGET || "http://127.0.0.1:12800"}`, target: `${VITE_SW_PROXY_TARGET || "http://127.0.0.1:12800"}`,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""), rewrite: (path) => path.replace(/^\/api/, ""),
}, },
}, },