Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 数据库获取时,忽略重名数据库 #1906

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/app/dto/image_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ type ImageRepoCreate struct {
Name string `json:"name" validate:"required"`
DownloadUrl string `json:"downloadUrl"`
Protocol string `json:"protocol"`
Username string `json:"username"`
Password string `json:"password"`
Username string `json:"username" validate:"max=256"`
Password string `json:"password" validate:"max=256"`
Auth bool `json:"auth"`
}

Expand Down
2 changes: 1 addition & 1 deletion backend/app/dto/remote_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type RemoteDBOption struct {
}

type RemoteDBCreate struct {
Name string `json:"name" validate:"required"`
Name string `json:"name" validate:"required,max=256"`
Type string `json:"type" validate:"required,oneof=mysql"`
From string `json:"from" validate:"required,oneof=local remote"`
Version string `json:"version" validate:"required"`
Expand Down
2 changes: 1 addition & 1 deletion backend/app/service/database_mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func (u *MysqlService) LoadFromRemote(from string) error {
for _, data := range datas {
hasOld := false
for _, oldData := range databases {
if oldData.Name == data.Name {
if strings.EqualFold(oldData.Name, data.Name) {
hasOld = true
break
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/global/form-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const checkDBName = (rule: any, value: any, callback: any) => {
if (value === '' || typeof value === 'undefined' || value == null) {
callback(new Error(i18n.global.t('commons.rule.dbName')));
} else {
const reg = /^[a-z0-9\u4e00-\u9fa5]{1}[a-z0-9_.\u4e00-\u9fa5-]{0,64}$/;
const reg = /^[a-zA-Z0-9\u4e00-\u9fa5]{1}[a-zA-Z0-9_.\u4e00-\u9fa5-]{0,64}$/;
if (!reg.test(value) && value !== '') {
callback(new Error(i18n.global.t('commons.rule.dbName')));
} else {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const message = {
commonName: 'Support English, Chinese, numbers, .-, and _ length 1-30',
userName: 'Support English, Chinese, numbers and _ length 3-30',
simpleName: 'Support English, numbers and _ length 1-30',
dbName: 'Support lowercase letters, Chinese, numbers, .-, and _ length 1-64',
dbName: 'Support English, Chinese, numbers, .-, and _ length 1-64',
imageName: 'Support English, numbers, :/.-_, length 1-150',
volumeName: 'Support English, numbers, .-_, length 2-30',
complexityPassword:
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/tw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const message = {
commonName: '支持英文、中文、數字、.-和_,長度1-30',
userName: '支持英文、中文、數字和_,長度3-30',
simpleName: '支持英文、數字、_,長度1-30',
dbName: '支持小寫字母、中文、數字、.-_,長度1-64',
dbName: '支持英文、中文、數字、.-_,長度1-64',
imageName: '支持英文、數字、:/.-_,長度1-150',
volumeName: '支持英文、數字、.-和_,長度2-30',
complexityPassword: '請輸入長度大於 8 位且包含字母、數字、特殊字符至少兩項的密碼組合',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const message = {
commonName: '支持英文、中文、数字、.-和_,长度1-30',
userName: '支持英文、中文、数字和_,长度3-30',
simpleName: '支持英文、数字、_,长度1-30',
dbName: '支持小写字母、中文、数字、.-_,长度1-64',
dbName: '支持英文、中文、数字、.-_,长度1-64',
imageName: '支持英文、数字、:/.-_,长度1-150',
volumeName: '支持英文、数字、.-和_,长度2-30',
complexityPassword: '请输入长度大于 8 位且包含字母、数字、特殊字符至少两项的密码组合',
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/views/container/repo/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ const buttons = [
{
label: i18n.global.t('commons.button.sync'),
disabled: (row: Container.RepoInfo) => {
return row.downloadUrl === 'docker.io';
return row.id === 1;
},
click: (row: Container.RepoInfo) => {
onCheckConn(row);
Expand All @@ -182,7 +182,7 @@ const buttons = [
{
label: i18n.global.t('commons.button.edit'),
disabled: (row: Container.RepoInfo) => {
return row.downloadUrl === 'docker.io';
return row.id === 1;
},
click: (row: Container.RepoInfo) => {
onOpenDialog('edit', row);
Expand All @@ -191,7 +191,7 @@ const buttons = [
{
label: i18n.global.t('commons.button.delete'),
disabled: (row: Container.RepoInfo) => {
return row.downloadUrl === 'docker.io';
return row.id === 1;
},
click: (row: Container.RepoInfo) => {
onDelete(row);
Expand Down
Loading