Skip to content

Commit 98008b3

Browse files
committed
improve the setting
1 parent 7cd4276 commit 98008b3

File tree

7 files changed

+297
-267
lines changed

7 files changed

+297
-267
lines changed

console/atest-ui/src/App.vue

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ watch(settingDialogVisible, (v: boolean) => {
9595
}
9696
})
9797
const theme = ref(getTheme())
98-
watch(theme, (e: string) => {
98+
watch(theme, (e) => {
9999
setTheme(e)
100100
})
101101
</script>
@@ -148,18 +148,7 @@ watch(theme, (e: string) => {
148148
<el-main style="padding-top: 0px;">
149149
<div class="top-menu">
150150
<el-col style="display: flex; align-items: center;">
151-
<el-tag style="font-size: 18px;">{{ t('language') }}</el-tag>
152-
<el-dropdown trigger="click" @command="(command: string) => handleChangeLan(command)">
153-
<el-icon><arrow-down /></el-icon>
154-
<template #dropdown>
155-
<el-dropdown-menu>
156-
<el-dropdown-item command="chinese">中文</el-dropdown-item>
157-
<el-dropdown-item command="english">English</el-dropdown-item>
158-
</el-dropdown-menu>
159-
</template>
160-
</el-dropdown>
161-
<el-icon @click="settingDialogVisible=true"><Setting /></el-icon>
162-
<el-switch type="primary" data-intro="Switch light and dark modes" v-model="asDarkMode"/>
151+
<el-icon @click="settingDialogVisible=true" size="20"><Setting /></el-icon>
163152
</el-col>
164153
</div>
165154
<TestingPanel v-if="panelName === 'testing'" @toHistoryPanel="toHistoryPanel"/>
@@ -177,19 +166,52 @@ watch(theme, (e: string) => {
177166
</el-container>
178167

179168
<el-dialog v-model="settingDialogVisible" :title="t('title.setting' )" width="50%" draggable destroy-on-close>
180-
<el-select v-model="theme" placeholder="Select a theme">
181-
<el-option
182-
v-for="item in allThemes"
183-
:key="item"
184-
:label="item"
185-
:value="item"
186-
/>
187-
</el-select>
188-
<el-icon>
189-
<el-link href="https://github.com/LinuxSuRen/atest-ext-data-swagger/tree/master/data/theme" target="_blank">
190-
<Help />
191-
</el-link>
192-
</el-icon>
169+
<el-row>
170+
<el-col :span="4">
171+
Theme:
172+
</el-col>
173+
<el-col :span="18">
174+
<el-select v-model="theme" placeholder="Select a theme">
175+
<el-option
176+
v-for="item in allThemes"
177+
:key="item"
178+
:label="item"
179+
:value="item"
180+
/>
181+
</el-select>
182+
<el-icon>
183+
<el-link href="https://github.com/LinuxSuRen/atest-ext-data-swagger/tree/master/data/theme" target="_blank">
184+
<Help />
185+
</el-link>
186+
</el-icon>
187+
</el-col>
188+
</el-row>
189+
190+
<el-row>
191+
<el-col :span="4">
192+
Language:
193+
</el-col>
194+
<el-col :span="18">
195+
<el-tag style="font-size: 18px;">{{ t('language') }}</el-tag>
196+
<el-dropdown trigger="click" @command="(command: string) => handleChangeLan(command)">
197+
<el-icon><arrow-down /></el-icon>
198+
<template #dropdown>
199+
<el-dropdown-menu>
200+
<el-dropdown-item command="chinese">中文</el-dropdown-item>
201+
<el-dropdown-item command="english">English</el-dropdown-item>
202+
</el-dropdown-menu>
203+
</template>
204+
</el-dropdown>
205+
</el-col>
206+
</el-row>
207+
<el-row>
208+
<el-col :span="4">
209+
Dark Mode:
210+
</el-col>
211+
<el-col :span="18">
212+
<el-switch type="primary" data-intro="Switch light and dark modes" v-model="asDarkMode"/>
213+
</el-col>
214+
</el-row>
193215
</el-dialog>
194216
</template>
195217

console/atest-ui/src/theme.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ export function getThemes() {
66
return Object.keys(themes)
77
}
88

9-
API.GetThemes().then(data => {
10-
data.data.forEach((theme) => {
9+
interface Theme {
10+
key: string
11+
}
12+
13+
API.GetThemes(data => {
14+
data.data.forEach((theme: Theme) => {
1115
const key = theme.key
12-
API.GetTheme(key).then((data: any) => {
16+
API.GetTheme(key, (data: any) => {
1317
themes[key] = JSON.parse(data.message)
1418

1519
const theme = getTheme()
@@ -20,7 +24,11 @@ API.GetThemes().then(data => {
2024
})
2125
})
2226

23-
export function setTheme(theme: string) {
27+
export function setTheme(theme: string | null) {
28+
if (!theme) {
29+
return
30+
}
31+
2432
const themeObj = themes[theme]
2533
if (themeObj) {
2634
applyTheme(themeObj)

console/atest-ui/src/views/TestCase.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ const renameTestCase = (name: string) => {
975975
</el-option>
976976
</el-select>
977977
</el-col>
978-
<el-col :span="19">
978+
<el-col :span="18">
979979
<el-autocomplete
980980
v-model="testCaseWithSuite.data.request.api"
981981
style="width: 100%"
@@ -990,7 +990,7 @@ const renameTestCase = (name: string) => {
990990
</template>
991991
</el-autocomplete>
992992
</el-col>
993-
<el-col :span="2" style="text-align-last: right;">
993+
<el-col :span="3" style="text-align-last: right;">
994994
<el-dropdown split-button type="primary"
995995
@click="sendRequest"
996996
v-loading="requestLoading"

console/atest-ui/src/views/net.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,12 +898,12 @@ var DataQuery = (store: string, kind: string, currentDatabase: string, query: st
898898
.catch(errHandler)
899899
}
900900

901-
const GetThemes = (callback: (d: any) => void) => {
901+
const GetThemes = (callback: (d: any) => void | null) => {
902902
return fetch(`/api/v1/themes`, {})
903903
.then(DefaultResponseProcess).then(callback)
904904
}
905905

906-
const GetTheme = (name: string, callback: (d: any) => void) => {
906+
const GetTheme = (name: string, callback: (d: any) => void | null) => {
907907
return fetch(`/api/v1/themes/${name}`, {})
908908
.then(DefaultResponseProcess).then(callback)
909909
}

pkg/server/server.pb.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/server/server.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,8 +670,8 @@ message DataQuery {
670670
string type = 1;
671671
string key = 2;
672672
string sql = 3;
673-
int32 offset = 4;
674-
int32 limit = 5;
673+
int64 offset = 4;
674+
int64 limit = 5;
675675
}
676676

677677
message DataQueryResult {

0 commit comments

Comments
 (0)