Skip to content

Commit

Permalink
PullRequest: 213 feat: online schema change support locking only spec…
Browse files Browse the repository at this point in the history
…ified users (api change sync)

Merge branch 'feat/dev-4.2.3-task-alterddl-1027 of [email protected]:oceanbase/oceanbase-developer-center.git into dev-4.2.3

https://code.alipay.com/oceanbase/oceanbase-developer-center/pull_requests/213


Signed-off-by: 晓康 <[email protected]>


* feat: online schema change support locking only specified users (api change sync)

* feat: online schema change support locking only specified users (api change sync)

* feat: online schema change support locking only specified users (clear invalid api change)
  • Loading branch information
bluesky-xyh committed Nov 7, 2023
1 parent 77ba8e4 commit 7bcc66e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
13 changes: 13 additions & 0 deletions src/common/network/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,3 +463,16 @@ export async function getProjectList(archived: boolean): Promise<IResponseData<I
});
return res?.data;
}

/**
* 查询当前数据库是否需要锁表
*/
export async function getLockDatabaseUserRequired(
databaseId: number,
): Promise<{
lockDatabaseUserRequired: boolean;
databaseId: number;
}> {
const res = await request.get(`/api/v2/osc/lockDatabaseUserRequired/${databaseId}`);
return res?.data;
}
18 changes: 14 additions & 4 deletions src/component/Task/AlterDdlTask/CreateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
* limitations under the License.
*/

import { createTask, getDatasourceUsers } from '@/common/network/task';
import { createTask, getDatasourceUsers, getLockDatabaseUserRequired } from '@/common/network/task';
import CommonIDE from '@/component/CommonIDE';
import FormItemPanel from '@/component/FormItemPanel';
import HelpDoc from '@/component/helpDoc';
import DescriptionInput from '@/component/Task/component/DescriptionInput';
import TaskTimer from '@/component/Task/component/TimerSelect';
import { TaskExecStrategy, TaskPageScope, TaskPageType, TaskType, IDatasourceUser } from '@/d.ts';
import { IDatabase } from '@/d.ts/database';
import { openTasksPage } from '@/store/helper/page';
import type { ModalStore } from '@/store/modal';
import { useDBSession } from '@/store/sessionManager/hooks';
Expand Down Expand Up @@ -74,6 +73,7 @@ const CreateDDLTaskModal: React.FC<IProps> = (props) => {
label: name,
value: name,
}));

const hadleReset = () => {
form.resetFields(null);
};
Expand Down Expand Up @@ -157,8 +157,7 @@ const CreateDDLTaskModal: React.FC<IProps> = (props) => {
setHasEdit(true);
};

const handleDatabaseChange = (v: number, database: IDatabase) => {
setLockDatabaseUserRequired(database?.lockDatabaseUserRequired);
const handleDatabaseChange = () => {
form.setFieldValue('lockUsers', []);
};

Expand All @@ -167,12 +166,23 @@ const CreateDDLTaskModal: React.FC<IProps> = (props) => {
setDatasourceUser(res?.contents);
};

const checkLockDatabaseUserRequired = async (databaseId: number) => {
const res = await getLockDatabaseUserRequired(databaseId);
setLockDatabaseUserRequired(res?.lockDatabaseUserRequired);
};

useEffect(() => {
if (connection?.id && lockDatabaseUserRequired) {
loadDatasourceUsers(connection.id);
}
}, [connection?.id]);

useEffect(() => {
if (databaseId) {
checkLockDatabaseUserRequired(databaseId);
}
}, [databaseId]);

return (
<Drawer
destroyOnClose
Expand Down

0 comments on commit 7bcc66e

Please sign in to comment.