Skip to content

Commit 377f28b

Browse files
committed
add: 样式兼容 mac
1 parent d431727 commit 377f28b

File tree

14 files changed

+89
-398
lines changed

14 files changed

+89
-398
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,12 @@
1313

1414
```bash
1515
wails dev
16-
```
16+
```
17+
18+
### 按照固定版本 Wails CLI v2.8.0
19+
go install github.com/wailsapp/wails/v2/cmd/[email protected]
20+
21+
22+
wails build -platform windows/amd64
23+
wails build -platform darwin/universal
24+
wails build -platform linux/amd64

apps/controllers/binlog.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ type DetailsList struct {
3636
}
3737

3838
func (b Binlog) GetDetailsList(id int64, search *SearchBinlog) (*DetailsList, error) {
39-
ctx.LogDebug("req", search)
40-
4139
data, ok := orm.NewOrmUploadLogs().WhereId(id).First()
4240
if !ok {
4341
return nil, errors.New("data not is exist")
@@ -46,7 +44,7 @@ func (b Binlog) GetDetailsList(id int64, search *SearchBinlog) (*DetailsList, er
4644
database, table := data.Database, data.Table
4745
model := orm.NewOrmBinlog(database, table).Order("id DESC").Order("id DESC")
4846
if search.Table != "" {
49-
model.Where("table = ?", search.Table)
47+
model.Where("tables = ?", search.Table)
5048
}
5149
if search.Event != "" {
5250
model.Where("event = ?", search.Event)

apps/controllers/files.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package controllers
22

33
import (
44
"changeme/apps/ctx"
5+
"changeme/apps/datas"
56
"changeme/apps/mysql"
67
"changeme/apps/orm"
78
"github.com/wailsapp/wails/v2/pkg/runtime"
@@ -45,6 +46,14 @@ func (f *Files) GetDecodeRowCount() uint64 {
4546
return mysql.DecodeRowCount
4647
}
4748

49+
func (f *Files) ClearAllData() {
50+
path, _ := datas.GetDataDir("mysql-binlog-ui/")
51+
path = datas.ToPath(path)
52+
53+
// 删除所有目录
54+
os.RemoveAll(path)
55+
}
56+
4857
type TitleData struct {
4958
List []*orm.UploadLogs
5059
Total int64

apps/controllers/help.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package controllers
22

33
import (
4+
"os"
45
"os/exec"
56
"runtime"
67
)
@@ -27,3 +28,7 @@ func (h *Help) OpenURL(url string) error {
2728

2829
return exec.Command(cmd, args...).Start()
2930
}
31+
32+
func (h *Help) Exit() {
33+
os.Exit(0)
34+
}
Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
<script lang="ts" setup></script>
1+
<script lang="ts" setup>
2+
3+
import { Exit } from "@wailsjs/go/controllers/Help";
4+
import {WindowFullscreen, WindowMinimise} from "@wailsjs/runtime";
5+
6+
</script>
27

38
<template>
49
<div>
510
<div class="header-logo">
6-
<div class="right-angle-triangle"></div>
11+
<div class="window-controls">
12+
<div class="button red" @click="Exit"></div>
13+
<div class="button yellow" @click="WindowMinimise"></div>
14+
<div class="button green" @click="WindowFullscreen"></div>
15+
</div>
716
</div>
817

918
<div>
@@ -15,7 +24,7 @@
1524
<style scoped>
1625
.header-logo {
1726
position: absolute;
18-
right: 20px;
27+
left: 13px;
1928
height: 100%;
2029
box-sizing: border-box;
2130
padding-top: 9px;
@@ -29,19 +38,29 @@
2938
padding-top: 10px;
3039
}
3140
32-
.right-angle-triangle {
33-
width: 20px;
34-
height: 20px;
35-
background: linear-gradient(
36-
45deg,
37-
rgb(231, 210, 210),
38-
orange,
39-
yellow,
40-
rgb(255, 255, 255),
41-
rgb(214, 214, 242),
42-
rgb(211, 195, 224),
43-
violet
44-
);
45-
transform: rotate(45deg);
41+
.window-controls {
42+
display: flex;
43+
gap: 8px;
44+
border-radius: 6px;
45+
width: fit-content;
46+
margin: 4px auto;
47+
}
48+
49+
.window-controls .button {
50+
width: 10px;
51+
height: 10px;
52+
border-radius: 50%;
53+
background-color: red;
54+
border: 1px solid rgba(0, 0, 0, 0.1);
55+
cursor: pointer;
56+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
57+
}
58+
59+
.window-controls .button.yellow {
60+
background-color: #fdbc40;
61+
}
62+
63+
.window-controls .button.green {
64+
background-color: #34c84a;
4665
}
4766
</style>

frontend/src/views/BinlogView.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import LogsList from "./binlog/LogsList.vue";
44
import {
55
GetSystemFile,
66
GetDecodeRowCount,
7-
SaveToSqlite,
7+
SaveToSqlite, ClearAllData,
88
} from "@wailsjs/go/controllers/Files";
99
import { ElMessageBox } from "element-plus";
1010
import { fa, tr } from "element-plus/es/locale/index.mjs";
@@ -28,6 +28,14 @@ const handleClose = (done: () => void) => {
2828
2929
const childRef = ref();
3030
31+
const submitClear = () => {
32+
ElMessageBox.confirm("清空所有数据?").then(() => {
33+
ClearAllData().then(()=>{
34+
childRef.value.doSomething();
35+
})
36+
});
37+
};
38+
3139
const submitUpload = () => {
3240
GetSystemFile().then((res) => {
3341
if (res != "") {
@@ -63,6 +71,10 @@ const submitUpload = () => {
6371
<el-button type="primary" @click="submitUpload">
6472
Import Binlog File
6573
</el-button>
74+
75+
<el-button type="primary" @click="submitClear">
76+
Clear ALL
77+
</el-button>
6678
</div>
6779

6880
<LogsList ref="childRef" />

frontend/src/views/binlog/LogsList.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ defineExpose({ doSomething });
7979
prop="Database"
8080
label="Database"
8181
:formatter="dateDatabase"
82+
min-width="100px"
8283
/>
83-
<el-table-column prop="Table" label="Table" width="100px" />
84-
<el-table-column prop="FileSize" label="FileSize/MB" width="120px" />
84+
<el-table-column prop="Table" label="Table" min-width="100px" />
85+
<el-table-column prop="FileSize" label="FileSize/MB" min-width="120px" />
8586
<el-table-column
8687
prop="Timestamp"
8788
label="Timestamp"

frontend/src/views/db/DbDetails.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ const handleCurrentChange = (val: number) => {
9999
<el-select v-model="formInline.Event" placeholder="event" clearable>
100100
<el-option label="insert" value="insert" />
101101
<el-option label="update" value="update" />
102+
<el-option label="delete" value="delete" />
102103
</el-select>
103104
</el-form-item>
104105
<el-form-item>

frontend/wailsjs/go/controllers/Files.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// This file is automatically generated. DO NOT EDIT
33
import {controllers} from '../models';
44

5+
export function ClearAllData():Promise<void>;
6+
57
export function DeleteFile(arg1:number):Promise<void>;
68

79
export function GetDecodeRowCount():Promise<number>;

frontend/wailsjs/go/controllers/Files.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
33
// This file is automatically generated. DO NOT EDIT
44

5+
export function ClearAllData() {
6+
return window['go']['controllers']['Files']['ClearAllData']();
7+
}
8+
59
export function DeleteFile(arg1) {
610
return window['go']['controllers']['Files']['DeleteFile'](arg1);
711
}

0 commit comments

Comments
 (0)