Skip to content

Commit

Permalink
Merge branch 'dev-4.2.1' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
HSunboy committed Sep 14, 2023
2 parents da79706 + 0b8685d commit 6e784a7
Show file tree
Hide file tree
Showing 37 changed files with 901 additions and 618 deletions.
8 changes: 7 additions & 1 deletion scripts/client/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,13 @@ async function run() {
return;
}
case 'win': {
execSync('npm run prepack jar obclient', { stdio: 'inherit' });
execSync('npm run prepack jar obclient', {
stdio: 'inherit',
env: {
...process.env,
platform: 'win64',
}
});
await buildWeb();
await buildClient('win');
execSync('npm run prepack jre', {
Expand Down
38 changes: 29 additions & 9 deletions src/common/network/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,17 @@ export async function testConnection(
return res;
}

export async function testExsitConnection(formData: Partial<IConnection>, testSys?: boolean) {
export async function testExsitConnection(
formData: Partial<IConnection>,
testSys?: boolean,
): Promise<{
data: {
active: boolean;
errorCode: string;
errorMessage: string;
type: string;
};
}> {
const cloneFormData = { ...formData };
cloneFormData.password = encrypt(cloneFormData.password);
const ret = await request.post(`/api/v2/connect/test`, {
Expand All @@ -187,12 +197,18 @@ export async function testExsitConnection(formData: Partial<IConnection>, testSy
return ret;
}

export async function batchTest(cids: number[]): Promise<
{
active: boolean;
sid: number;
sidString?: string;
}[]
export async function batchTest(
cids: number[],
): Promise<
Record<
number,
{
errorCode: string;
errorMessage: string;
status: any;
type: any;
}
>
> {
const res = await request.get('/api/v2/datasource/datasources/status', {
params: {
Expand Down Expand Up @@ -282,7 +298,9 @@ export async function newSessionByDataSource(
return data;
}

export async function getSessionStatus(sessionId?: string): Promise<{
export async function getSessionStatus(
sessionId?: string,
): Promise<{
settings: {
autocommit: boolean;
delimiter: string;
Expand Down Expand Up @@ -328,7 +346,9 @@ export async function getConnectionExists(params: { name: string }): Promise<boo
/**
* 获取集群 & 租户列表
*/
export async function getClusterAndTenantList(visibleScope: IConnectionType): Promise<{
export async function getClusterAndTenantList(
visibleScope: IConnectionType,
): Promise<{
tenantName: Record<string, string[]>;
clusterName: Record<string, string[]>;
}> {
Expand Down
4 changes: 2 additions & 2 deletions src/component/SysFormItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ const SysFormItem: React.FC<IProps> = function (props) {
if (!res?.data?.active) {
setStatus('error');
notification.error({
track: res?.errMsg || res?.data?.errorMessage,
requestId: res?.requestId,
track: res?.data?.errorMessage,
requestId: null,
});
} else {
setStatus('success');
Expand Down
111 changes: 86 additions & 25 deletions src/component/Task/AlterDdlTask/CreateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,24 @@ const CreateDDLTaskModal: React.FC<IProps> = (props) => {
const { database } = useDBSession(databaseId);
const connection = database?.dataSource;
const isMySQL = connection?.dialectType === ConnectionMode.OB_MYSQL;

const hadleReset = () => {
form.resetFields(null);
};
const handleCancel = (hasEdit: boolean) => {
if (hasEdit) {
Modal.confirm({
title: formatMessage({ id: 'odc.AlterDdlTask.CreateModal.AreYouSureYouWant' }), //确认取消无锁结构变更吗?
title: formatMessage({
id: 'odc.AlterDdlTask.CreateModal.AreYouSureYouWant',
}),
//确认取消无锁结构变更吗?
centered: true,
onOk: () => {
hadleReset();
props.modalStore.changeCreateDDLAlterTaskModal(false);
},
});
} else {
hadleReset();
props.modalStore.changeCreateDDLAlterTaskModal(false);
}
};
Expand Down Expand Up @@ -135,18 +142,26 @@ const CreateDDLTaskModal: React.FC<IProps> = (props) => {
width={720}
title={formatMessage({
id: 'odc.AlterDdlTask.CreateModal.NewLockFreeStructureChange',
})} /*新建无锁结构变更*/
footer={
})}
/*新建无锁结构变更*/ footer={
<Space>
<Button
onClick={() => {
handleCancel(hasEdit);
}}
>
{formatMessage({ id: 'odc.AlterDdlTask.CreateModal.Cancel' }) /*取消*/}
{
formatMessage({
id: 'odc.AlterDdlTask.CreateModal.Cancel',
}) /*取消*/
}
</Button>
<Button type="primary" loading={confirmLoading} onClick={handleSubmit}>
{formatMessage({ id: 'odc.AlterDdlTask.CreateModal.Create' }) /*新建*/}
{
formatMessage({
id: 'odc.AlterDdlTask.CreateModal.Create',
}) /*新建*/
}
</Button>
</Space>
}
Expand All @@ -161,16 +176,36 @@ const CreateDDLTaskModal: React.FC<IProps> = (props) => {
}}
type="warning"
showIcon
message="注意"
message={
formatMessage({ id: 'odc.src.component.Task.AlterDdlTask.CreateModal.Notice' }) /* 注意 */
}
description={
<div>
{
formatMessage({
id: 'odc.src.component.Task.AlterDdlTask.CreateModal.1TheMySQLMode',
}) /*
1. MySQL 模式 OB 版本小于 4.3 及 Oracle 模式 OB 版本小于
4.0,表名切换之前会锁定数据库账号,并 kill 该账号对应的
session。表名切换期间,锁定账号涉及应用将无法访问数据库,请勿在业务高峰期执行;
*/
}
<br />
{
formatMessage({
id: 'odc.src.component.Task.AlterDdlTask.CreateModal.2BeforePerformingThe',
}) /*
2. 执行无锁结构变更前请确保数据库服务器磁盘空间充足;
*/
}
<br />
{
formatMessage({
id: 'odc.src.component.Task.AlterDdlTask.CreateModal.3ItIsRecommended',
}) /*
3. 创建工单时建议选择保留原表;
*/
}
</div>
}
/>
Expand All @@ -188,8 +223,8 @@ const CreateDDLTaskModal: React.FC<IProps> = (props) => {
<Form.Item
label={formatMessage({
id: 'odc.AlterDdlTask.CreateModal.ChangeDefinition',
})} /*变更定义*/
name="sqlType"
})}
/*变更定义*/ name="sqlType"
initialValue={SqlType.CREATE}
rules={[
{
Expand All @@ -207,15 +242,21 @@ const CreateDDLTaskModal: React.FC<IProps> = (props) => {
</Form.Item>
<Form.Item
name="sqlContent"
label={formatMessage({ id: 'odc.AlterDdlTask.CreateModal.SqlContent' })} /*SQL 内容*/
className={styles.sqlContent}
label={formatMessage({
id: 'odc.AlterDdlTask.CreateModal.SqlContent',
})}
/*SQL 内容*/ className={styles.sqlContent}
rules={[
{
required: true,
message: formatMessage({ id: 'odc.AlterDdlTask.CreateModal.EnterTheSqlContent' }), //请填写 SQL 内容
message: formatMessage({
id: 'odc.AlterDdlTask.CreateModal.EnterTheSqlContent',
}), //请填写 SQL 内容
},
]}
style={{ height: '280px' }}
style={{
height: '280px',
}}
>
<CommonIDE
language={`${isMySQL ? 'obmysql' : 'oboracle'}`}
Expand Down Expand Up @@ -249,8 +290,10 @@ const CreateDDLTaskModal: React.FC<IProps> = (props) => {
required
>
<Form.Item
label={formatMessage({ id: 'odc.AlterDdlTask.CreateModal.Seconds' })} /*秒*/
name="lockTableTimeOutSeconds"
label={formatMessage({
id: 'odc.AlterDdlTask.CreateModal.Seconds',
})}
/*秒*/ name="lockTableTimeOutSeconds"
rules={[
{
required: true,
Expand All @@ -261,7 +304,9 @@ const CreateDDLTaskModal: React.FC<IProps> = (props) => {
{
type: 'number',
max: 3600,
message: formatMessage({ id: 'odc.AlterDdlTask.CreateModal.UpToSeconds' }), //最大不超过 3600 秒
message: formatMessage({
id: 'odc.AlterDdlTask.CreateModal.UpToSeconds',
}), //最大不超过 3600 秒
},
]}
initialValue={5}
Expand All @@ -270,7 +315,11 @@ const CreateDDLTaskModal: React.FC<IProps> = (props) => {
<InputNumber min={0} max={3600} />
</Form.Item>
<span className={styles.hour}>
{formatMessage({ id: 'odc.AlterDdlTask.CreateModal.Seconds' }) /*秒*/}
{
formatMessage({
id: 'odc.AlterDdlTask.CreateModal.Seconds',
}) /*秒*/
}
</span>
</Form.Item>
</Col>
Expand Down Expand Up @@ -304,13 +353,15 @@ const CreateDDLTaskModal: React.FC<IProps> = (props) => {
<Form.Item
label={formatMessage({
id: 'odc.AlterDdlTask.CreateModal.SourceTableCleanupPolicyAfter',
})} /*完成后源表清理策略*/
name="originTableCleanStrategy"
})}
/*完成后源表清理策略*/ name="originTableCleanStrategy"
initialValue={ClearStrategy.ORIGIN_TABLE_RENAME_AND_RESERVED}
rules={[
{
required: true,
message: formatMessage({ id: 'odc.AlterDdlTask.CreateModal.SelectACleanupPolicy' }), //请选择清理策略
message: formatMessage({
id: 'odc.AlterDdlTask.CreateModal.SelectACleanupPolicy',
}), //请选择清理策略
},
]}
>
Expand All @@ -323,21 +374,27 @@ const CreateDDLTaskModal: React.FC<IProps> = (props) => {
}
</Radio>
<Radio value={ClearStrategy.ORIGIN_TABLE_DROP}>
{formatMessage({ id: 'odc.AlterDdlTask.CreateModal.DeleteNow' }) /*立即删除*/}
{
formatMessage({
id: 'odc.AlterDdlTask.CreateModal.DeleteNow',
}) /*立即删除*/
}
</Radio>
</Radio.Group>
</Form.Item>
</FormItemPanel>
<FormItemPanel
label={formatMessage({ id: 'odc.AlterDdlTask.CreateModal.TaskSettings' })}
label={formatMessage({
id: 'odc.AlterDdlTask.CreateModal.TaskSettings',
})}
/*任务设置*/ keepExpand
>
<TaskTimer isReadonlyPublicConn={false} />
<Form.Item
label={formatMessage({
id: 'odc.AlterDdlTask.CreateModal.TaskErrorHandling',
})} /*任务错误处理*/
name="errorStrategy"
})}
/*任务错误处理*/ name="errorStrategy"
initialValue={ErrorStrategy.ABORT}
rules={[
{
Expand All @@ -350,7 +407,11 @@ const CreateDDLTaskModal: React.FC<IProps> = (props) => {
>
<Radio.Group>
<Radio value={ErrorStrategy.ABORT}>
{formatMessage({ id: 'odc.AlterDdlTask.CreateModal.StopATask' }) /*停止任务*/}
{
formatMessage({
id: 'odc.AlterDdlTask.CreateModal.StopATask',
}) /*停止任务*/
}
</Radio>
<Radio value={ErrorStrategy.CONTINUE}>
{
Expand Down
26 changes: 1 addition & 25 deletions src/component/Task/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,9 @@ import { getPreTime } from '@/util/utils';
import { inject, observer } from 'mobx-react';
import type { Moment } from 'moment';
import React from 'react';
import AlterDDLTaskCreateModal from './AlterDdlTask';
import AsyncTaskCreateModal from './AsyncTask';
import TaskTable from './component/TaskTable';
import DataArchiveTaskCreateModal from './DataArchiveTask';
import DataClearTaskCreateModal from './DataClearTask';
import DataMockerTaskCreateModal from './DataMockerTask';
import DetailModal from './DetailModal';
import ExportTaskCreateModal from './ExportTask';
import { isCycleTaskPage } from './helper';
import ImportTaskCreateModal from './ImportTask';
import PartitionTaskCreateModal from './PartitionTask';
import ResultSetExportTask from './ResultSetExportTask';
import ShadowSyncTaskCreateModal from './ShadowSyncTask';
import SQLPlanTaskCreateModal from './SQLPlanTask';

import styles from './index.less';
import tracert from '@/util/tracert';

Expand All @@ -58,7 +46,6 @@ interface IProps {
tabHeight?: number;
projectId?: number;
isMultiPage?: boolean;
theme?: string;
}

interface IState {
Expand Down Expand Up @@ -275,7 +262,7 @@ class TaskManaerContent extends React.Component<IProps, IState> {
};

render() {
const { projectId, pageKey, taskStore, isMultiPage = false, theme = '' } = this.props;
const { pageKey, taskStore, isMultiPage = false } = this.props;
const { detailId, detailType, detailVisible, partitionPlan, cycleTasks, tasks } = this.state;
const taskTabType = pageKey || taskStore?.taskPageType;
const taskList = isCycleTaskPage(taskTabType) ? cycleTasks : tasks;
Expand All @@ -302,17 +289,6 @@ class TaskManaerContent extends React.Component<IProps, IState> {
onDetailVisible={this.handleDetailVisible}
onReloadList={this.reloadList}
/>
<AsyncTaskCreateModal projectId={projectId} theme={theme} />
<DataMockerTaskCreateModal projectId={projectId} />
<ExportTaskCreateModal projectId={projectId} />
<ImportTaskCreateModal projectId={projectId} />
<PartitionTaskCreateModal projectId={projectId} />
<SQLPlanTaskCreateModal projectId={projectId} theme={theme} />
<ShadowSyncTaskCreateModal projectId={projectId} />
<DataArchiveTaskCreateModal projectId={projectId} />
<DataClearTaskCreateModal projectId={projectId} />
<AlterDDLTaskCreateModal projectId={projectId} />
<ResultSetExportTask projectId={projectId} theme={theme} />
</>
);
}
Expand Down
Loading

0 comments on commit 6e784a7

Please sign in to comment.