Skip to content

Commit 530545d

Browse files
committed
feat(user): user manage
1 parent 07884b2 commit 530545d

File tree

13 files changed

+435
-105
lines changed

13 files changed

+435
-105
lines changed

frontend/src/api/user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ export const userApi = {
2424
delete: (key: string) => request.delete(`/user/${key}`),
2525
deleteBatch: (data: any) => request.delete(`/user`, { data }),
2626
get: (key: string) => request.get(`/user/${key}`),
27-
pwd: (data: any) => request.put('/user/pwd', data),
27+
pwd: (id: any) => request.patch(`/user/pwd/${id}`),
2828
}

frontend/src/i18n/en.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
"simplified_chinese": "Simplified Chinese",
2525
"traditional_chinese": "Traditional Chinese",
2626
"help": "Help",
27-
"language": "Language"
27+
"language": "Language",
28+
"re_upload": "Re-upload",
29+
"not_exceed_50mb": "Supports XLS, XLSX, CSV formats, file size does not exceed 50MB",
30+
"reset_password": "Reset password",
31+
"password_reset_successful": "Password reset successful"
2832
},
2933
"dashboard": {
3034
"select_dashboard": "Please Select Dashboard",
@@ -186,7 +190,9 @@
186190
"operate_with_caution": "After being deleted, the data source cannot be intelligently counted. Please operate with caution.",
187191
"data_source_de": "Unable to delete data source: {msg}",
188192
"cannot_be_deleted": "The chart of the dashboard uses this data source and cannot be deleted.",
189-
"got_it": "Got it"
193+
"got_it": "Got it",
194+
"field_original_notes": "Field original notes",
195+
"field_notes_1": "Field notes"
190196
},
191197
"model": {
192198
"default_model": "Default model",
@@ -330,4 +336,4 @@
330336
"back_community": "Restore to Community Edition",
331337
"confirm_tips": "Are you sure to restore to Community Edition?"
332338
}
333-
}
339+
}

frontend/src/i18n/zh-CN.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
"simplified_chinese": "简体中文",
2727
"traditional_chinese": "繁體中文",
2828
"help": "帮助",
29-
"language": "语言"
29+
"language": "语言",
30+
"re_upload": "重新上传",
31+
"not_exceed_50mb": "支持 XLS、XLSX、CSV 格式,文件大小不超过 50MB",
32+
"reset_password": "重置密码",
33+
"password_reset_successful": "重置密码成功"
3034
},
3135
"dashboard": {
3236
"select_dashboard": "请选择仪表板",
@@ -124,14 +128,14 @@
124128
"choose_tables": "选择数据表",
125129
"name": "名称",
126130
"description": "描述",
127-
"host": "主机/IP",
131+
"host": "主机名/IP地址",
128132
"port": "端口",
129133
"username": "用户名",
130134
"password": "密码",
131135
"database": "数据库",
132136
"connect_mode": "连接方式",
133137
"service_name": "服务名",
134-
"extra_jdbc": "额外 JDBC 参数",
138+
"extra_jdbc": "额外的 JDBC 连接字符串",
135139
"schema": "模式",
136140
"get_schema": "获取模式",
137141
"file": "文件",
@@ -194,7 +198,9 @@
194198
"operate_with_caution": "被删除后,将无法对该数据源进行智能问数,请谨慎操作。",
195199
"data_source_de": "无法删除数据源:{msg}",
196200
"cannot_be_deleted": "仪表板的图表使用了该数据源,不可删除。",
197-
"got_it": "知道了"
201+
"got_it": "知道了",
202+
"field_original_notes": "字段原始备注",
203+
"field_notes_1": "字段备注"
198204
},
199205
"model": {
200206
"default_model": "默认模型",

frontend/src/style.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
--ed-color-primary: #1cba90 !important;
2929
--ed-border-radius-base: 6px !important;
30+
--ed-color-primary-light-3: #3ec4a1 !important;
31+
--ed-color-primary-dark-2: #189e7a !important;
32+
--ed-color-primary-1a: #1cba901a;
3033
}
3134

3235
a {

frontend/src/utils/utils.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,29 @@ export const getBrowserLocale = () => {
5454
export const getLocale = () => {
5555
return wsCache.get('user.language') || getBrowserLocale() || 'zh-CN'
5656
}
57+
58+
export const setSize = (size: any) => {
59+
let data = ''
60+
const _size = Number.parseFloat(size)
61+
if (_size < 1 * 1024) {
62+
//如果小于0.1KB转化成B
63+
data = _size.toFixed(2) + 'B'
64+
} else if (_size < 1 * 1024 * 1024) {
65+
//如果小于0.1MB转化成KB
66+
data = (_size / 1024).toFixed(2) + 'KB'
67+
} else if (_size < 1 * 1024 * 1024 * 1024) {
68+
//如果小于0.1GB转化成MB
69+
data = (_size / (1024 * 1024)).toFixed(2) + 'MB'
70+
} else {
71+
//其他转化成GB
72+
data = (_size / (1024 * 1024 * 1024)).toFixed(2) + 'GB'
73+
}
74+
const size_str = data + ''
75+
const len = size_str.indexOf('.')
76+
const dec = size_str.substr(len + 1, 2)
77+
if (dec == '00') {
78+
//当小数点后为00时 去掉小数部分
79+
return size_str.substring(0, len) + size_str.substr(len + 3, 2)
80+
}
81+
return size_str
82+
}

frontend/src/views/ds/DataTable.vue

Lines changed: 72 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const props = withDefaults(
5252
const { t } = useI18n()
5353
const paramsFormRef = ref()
5454
const tableList = ref([] as any[])
55+
const loading = ref(false)
5556
const keywords = ref('')
5657
const tableListWithSearch = computed(() => {
5758
if (!keywords.value) return tableList.value
@@ -63,7 +64,7 @@ const total = ref(1000)
6364
const showNum = ref(100)
6465
const currentTable = ref<any>({})
6566
const ds = ref<any>({})
66-
const btnSelect = ref('q')
67+
const btnSelect = ref('d')
6768
6869
const init = () => {
6970
datasourceApi.getDs(props.info.id).then((res) => {
@@ -94,13 +95,19 @@ const handleSelectTableList = () => {
9495
}
9596
9697
const clickTable = (table: any) => {
98+
loading.value = true
9799
currentTable.value = table
98-
datasourceApi.fieldList(table.id).then((res) => {
99-
fieldList.value = res
100-
datasourceApi.previewData(props.info.id, buildData()).then((res) => {
101-
previewData.value = res
100+
datasourceApi
101+
.fieldList(table.id)
102+
.then((res) => {
103+
fieldList.value = res
104+
datasourceApi.previewData(props.info.id, buildData()).then((res) => {
105+
previewData.value = res
106+
})
107+
})
108+
.finally(() => {
109+
loading.value = false
102110
})
103-
})
104111
}
105112
106113
const closeTable = () => {
@@ -228,12 +235,14 @@ const back = () => {
228235
</div>
229236
</div>
230237

231-
<div v-if="currentTable.table_name" class="info-table">
238+
<div v-if="currentTable.table_name" v-loading="loading" class="info-table">
232239
<div class="table-name">
233240
<div class="name">{{ currentTable.table_name }}</div>
234241
<div class="notes">
235242
{{ $t('about.remark') }}:
236-
{{ currentTable.custom_comment || '-' }}
243+
<span :title="currentTable.custom_comment" class="field-notes">{{
244+
currentTable.custom_comment || '-'
245+
}}</span>
237246
<el-icon style="margin-left: 8px; cursor: pointer" size="16" @click="editTable">
238247
<edit></edit>
239248
</el-icon>
@@ -253,11 +262,13 @@ const back = () => {
253262
<el-table v-if="btnSelect === 'd'" :data="fieldList" style="width: 100%">
254263
<el-table-column prop="field_name" :label="t('datasource.field_name')" width="180" />
255264
<el-table-column prop="field_type" :label="t('datasource.field_type')" width="180" />
256-
<el-table-column prop="field_comment" :label="t('about.remark')" />
257-
<el-table-column :label="t('datasource.custom_notes')">
265+
<el-table-column prop="field_comment" :label="t('datasource.field_original_notes')" />
266+
<el-table-column :label="t('datasource.field_notes_1')">
258267
<template #default="scope">
259268
<div class="field-comment">
260-
<span>{{ scope.row.custom_comment }}</span>
269+
<span :title="scope.row.custom_comment" class="notes-in_table">{{
270+
scope.row.custom_comment
271+
}}</span>
261272
<el-tooltip
262273
:offset="14"
263274
effect="dark"
@@ -441,6 +452,7 @@ const back = () => {
441452
right: 0;
442453
top: 0;
443454
width: calc(100% - 280px);
455+
height: 100%;
444456
.table-name {
445457
height: 80px;
446458
padding: 16px 0 0 24px;
@@ -459,11 +471,20 @@ const back = () => {
459471
color: #646a73;
460472
display: flex;
461473
align-items: center;
474+
475+
.field-notes {
476+
display: inline-block;
477+
max-width: calc(100% - 75px);
478+
text-overflow: ellipsis;
479+
white-space: nowrap;
480+
overflow: hidden;
481+
}
462482
}
463483
}
464484
465485
.table-content {
466486
padding: 16px 24px;
487+
height: calc(100% - 80px);
467488
468489
.btn-select {
469490
height: 32px;
@@ -495,33 +516,53 @@ const back = () => {
495516
496517
.preview-or-schema {
497518
margin-top: 16px;
519+
height: calc(100% - 50px);
520+
overflow-y: auto;
498521
499522
.field-comment {
500-
height: 24px;
501-
}
502-
.ed-icon {
503-
position: relative;
504-
cursor: pointer;
505-
margin-top: 4px;
506-
507-
&::after {
508-
content: '';
509-
background-color: #1f23291a;
510-
position: absolute;
511-
border-radius: 6px;
512-
width: 24px;
513-
height: 24px;
514-
transform: translate(-50%, -50%);
515-
top: 50%;
516-
left: 50%;
517-
display: none;
523+
display: flex;
524+
align-items: center;
525+
min-height: 24px;
526+
.notes-in_table {
527+
max-width: 192px;
528+
display: -webkit-box;
529+
max-height: 66px;
530+
-webkit-box-orient: vertical;
531+
-webkit-line-clamp: 3; /* 限制行数为3 */
532+
overflow: hidden;
533+
text-overflow: ellipsis;
518534
}
519-
520535
&:hover {
521-
&::after {
536+
.ed-icon {
522537
display: block;
523538
}
524539
}
540+
.ed-icon {
541+
position: relative;
542+
cursor: pointer;
543+
margin-top: 4px;
544+
margin-left: 8px;
545+
display: none;
546+
547+
&::after {
548+
content: '';
549+
background-color: #1f23291a;
550+
position: absolute;
551+
border-radius: 6px;
552+
width: 24px;
553+
height: 24px;
554+
transform: translate(-50%, -50%);
555+
top: 50%;
556+
left: 50%;
557+
display: none;
558+
}
559+
560+
&:hover {
561+
&::after {
562+
display: block;
563+
}
564+
}
565+
}
525566
}
526567
527568
.preview-num {

frontend/src/views/ds/Datasource.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ const back = () => {
324324
<DatasourceForm
325325
v-if="[1, 2].includes(activeStep)"
326326
ref="datasourceFormRef"
327+
:isDataTable="false"
327328
:active-step="activeStep"
328329
:active-name="activeName"
329330
:active-type="activeType"

0 commit comments

Comments
 (0)