Skip to content

Commit 2a74568

Browse files
authored
Merge pull request #255 from qianmoQ/1.22.0-SNAPSHOT
1.22.0 snapshot
2 parents 3d58789 + fc08f3d commit 2a74568

16 files changed

Lines changed: 190 additions & 27 deletions

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
"cfonts": "^3.1.0",
110110
"chalk": "^4.1.1",
111111
"cross-env": "^7.0.3",
112-
"electron": "16.2.0",
112+
"electron": "20.0.1",
113113
"electron-builder": "23.0.3",
114114
"electron-reload": "1.5.0",
115115
"eslint": "7.29.0",
@@ -124,7 +124,7 @@
124124
"karma-jasmine-html-reporter": "^2.0.0",
125125
"ts-loader": "^9.2.3",
126126
"typescript": "^4.2.4",
127-
"wait-on": "^5.3.0",
127+
"wait-on": "6.0.1",
128128
"webpack": "5.73.0",
129129
"webpack-cli": "4.7.2"
130130
},

src/renderer/app/layout/layout.module.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ import { MysqlPlugin } from "@renderer/plugin/mysql.plugin";
2525
import { ConfigFactory } from "@renderer/factory/config.factory";
2626
import { ConfigToken } from "@renderer/token/config.token";
2727
import { MysqlConfig } from "@renderer/config/mysql.config";
28+
import { ClickHouseConfig } from "@renderer/config/clickhouse.config";
29+
import { PostgreSQLConfig } from "@renderer/config/postgresql.config";
30+
import { PostgreSQLPlugin } from "@renderer/plugin/postgresql.plugin";
2831

2932
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader =>
3033
new TranslateHttpLoader(http, './renderer/assets/i18n/', '.json');
@@ -57,13 +60,17 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader =>
5760
FactoryService,
5861
MySQLService,
5962
PostgresqlService,
63+
/* Plugin */
6064
PluginFactory,
6165
{provide: PluginToken, useClass: ClickHousePlugin, multi: true},
6266
{provide: PluginToken, useClass: ElasticsearchPlugin, multi: true},
6367
{provide: PluginToken, useClass: MysqlPlugin, multi: true},
68+
{provide: PluginToken, useClass: PostgreSQLPlugin, multi: true},
6469
/* Config */
6570
ConfigFactory,
66-
{provide: ConfigToken, useClass: MysqlConfig, multi: true}
71+
{provide: ConfigToken, useClass: MysqlConfig, multi: true},
72+
{provide: ConfigToken, useClass: ClickHouseConfig, multi: true},
73+
{provide: ConfigToken, useClass: PostgreSQLConfig, multi: true},
6774
]
6875
})
6976
export class LayoutModule {

src/renderer/components/database/rename/database.rename.component.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { DatasourceService } from '@renderer/services/management/datasource.serv
66
import { StringUtils } from '@renderer/utils/string.utils';
77
import { NzMessageService } from 'ng-zorro-antd/message';
88
import { DatabaseService } from '@renderer/services/management/database.service';
9+
import { DatabaseEnum } from "@renderer/enum/database.enum";
910

1011
@Component({
1112
selector: 'app-component-rename-database',
@@ -37,14 +38,16 @@ export class DatabaseRenameComponent extends BaseComponent implements AfterViewI
3738
this.checkStatus = true;
3839
const request = new RequestModel();
3940
request.config = await this.dataSourceService.getByAliasAsync(this.config.value);
40-
this.databaseService.getDatabase(request, this.value)
41-
.then(response => {
42-
if (response.status) {
43-
this.checkStatus = response.data?.columns[0]?.isSupport;
44-
} else {
45-
this.messageService.error(response.message);
46-
}
47-
});
41+
if (request.config.type === DatabaseEnum.clickhosue) {
42+
this.databaseService.getDatabase(request, this.value)
43+
.then(response => {
44+
if (response.status) {
45+
this.checkStatus = response.data?.columns[0]?.isSupport;
46+
} else {
47+
this.messageService.error(response.message);
48+
}
49+
});
50+
}
4851
}
4952

5053
handlerValidate() {
@@ -60,15 +63,15 @@ export class DatabaseRenameComponent extends BaseComponent implements AfterViewI
6063
const request = new RequestModel();
6164
request.config = await this.dataSourceService.getByAliasAsync(this.config.value);
6265
this.databaseService.rename(request, this.value, this.inputValue)
63-
.then(response => {
64-
if (response.status) {
65-
this.messageService.success(response.message);
66-
this.config.status = true;
67-
this.emitter.emit(this.config);
68-
} else {
69-
this.messageService.error(response.message);
70-
}
71-
this.loading.button = false;
72-
});
66+
.then(response => {
67+
if (response.status) {
68+
this.messageService.success(response.message);
69+
this.config.status = true;
70+
this.emitter.emit(this.config);
71+
} else {
72+
this.messageService.error(response.message);
73+
}
74+
this.loading.button = false;
75+
});
7376
}
7477
}

src/renderer/config/base.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ export interface BaseConfig {
2626
showCreateDatabase: string;
2727
showTableWithSize: string;
2828
getCharacterAndCollation: string;
29+
// database
30+
databaseRename: string;
2931
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { ConfigInterface } from "@renderer/interfaces/config.interface";
2+
import { Injectable } from "@angular/core";
3+
import { Factory } from "@renderer/factory";
4+
import { DatabaseEnum } from "@renderer/enum/database.enum";
5+
import { ClickhouseConfig } from "@renderer/config/plugin/clickhouse.config";
6+
7+
@Injectable()
8+
export class ClickHouseConfig implements ConfigInterface {
9+
private readonly config: ClickhouseConfig;
10+
11+
constructor() {
12+
this.config = Factory.create(ClickhouseConfig);
13+
}
14+
15+
getName(): DatabaseEnum {
16+
return DatabaseEnum.clickhosue;
17+
}
18+
19+
getStatement(key: string): string {
20+
return this.config[key];
21+
}
22+
}

src/renderer/config/operation.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ export class OperationConfig {
5151
actions: [OperationEnum.structure],
5252
supportedSource: [DatabaseEnum.clickhosue, DatabaseEnum.mysql]
5353
},
54-
{type: TypeEnum.database, actions: [OperationEnum.rename], supportedSource: [DatabaseEnum.clickhosue]}
54+
{
55+
type: TypeEnum.database,
56+
actions: [OperationEnum.rename],
57+
supportedSource: [DatabaseEnum.clickhosue, DatabaseEnum.postgresql]
58+
}
5559
];
5660
opertions.push(database);
5761
const table = new OperationModel();

src/renderer/config/plugin/clickhouse.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,5 @@ ALTER TABLE {0} RENAME COLUMN {1} TO {2}
172172
ALTER TABLE {0} COMMENT COLUMN {1} '{2}'
173173
`;
174174
getCharacterAndCollation: string;
175+
databaseRename = 'RENAME DATABASE `{0}` TO `{1}`';
175176
}

src/renderer/config/plugin/druid.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ export class DruidConfig implements BaseConfig {
3535
tableSchemaFetchAll: string;
3636
version = `SELECT '-' AS version`;
3737
getCharacterAndCollation: string;
38+
databaseRename: string;
3839
}

src/renderer/config/plugin/elasticsearch.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ export class ElasticsearchConfig implements BaseConfig {
2828
tableSchemaFetchAll: string;
2929
version = `SELECT 1 AS version`;
3030
getCharacterAndCollation: string;
31+
databaseRename: string;
3132
}

src/renderer/config/plugin/mysql.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,5 @@ ALTER TABLE {0} CHANGE COLUMN {1} {2} {3} COMMENT '{4}'
130130
GROUP BY CHARACTER_SET_NAME
131131
ORDER BY CHARACTER_SET_NAME ASC
132132
`;
133+
databaseRename: string;
133134
}

0 commit comments

Comments
 (0)