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

feature: add console transaction control #7024

Open
wants to merge 43 commits into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
afeb363
feature: add console transaction control
xjlgod Nov 16, 2024
d94180b
fix: add ts locales
xjlgod Nov 22, 2024
d5c41d7
feat: add file license
xjlgod Nov 27, 2024
7a06864
fix: fix session unit test
xjlgod Nov 27, 2024
d44cfb2
fix: fix session unit test
xjlgod Nov 28, 2024
6dedb60
Merge remote-tracking branch 'origin/2.x' into feature/console-trx
xjlgod Dec 1, 2024
a33e24e
Merge remote-tracking branch 'origin/2.x' into feature/console-trx
xjlgod Dec 1, 2024
3d076f6
feat: fix sessionConvert test
xjlgod Dec 1, 2024
89aa1dd
Merge branch '2.x' into feature/console-trx
xjlgod Dec 6, 2024
ce4b0d0
Merge branch '2.x' into feature/console-trx
xjlgod Dec 10, 2024
9af570e
fix: fix RMHandlerSagaAnnotation compile
xjlgod Dec 10, 2024
ff7216e
fix: fix GlobalStatus comment
xjlgod Dec 11, 2024
573419a
fix: fix status in ts control
xjlgod Dec 16, 2024
9b64c07
fix: fix unused import
xjlgod Dec 18, 2024
7f48246
Merge branch '2.x' into feature/console-trx
funky-eyes Dec 24, 2024
e74ca2a
fix: add relate comment
xjlgod Dec 27, 2024
59ab61f
Merge remote-tracking branch 'origin/feature/console-trx' into featur…
xjlgod Dec 27, 2024
ee1cd74
Merge remote-tracking branch 'upstream/2.x' into feature/console-trx
xjlgod Dec 28, 2024
77a7075
fix: FileSessionManagerTest conflict solve
xjlgod Dec 28, 2024
ac3d722
feat: del stop retry task
xjlgod Dec 30, 2024
ec68aa6
fix: del unused import
xjlgod Dec 30, 2024
8c88802
Merge branch '2.x' into feature/console-trx
xjlgod Dec 30, 2024
2b905ef
fix: del gmt modify time in session
xjlgod Dec 30, 2024
e651120
Merge remote-tracking branch 'origin/feature/console-trx' into featur…
xjlgod Dec 30, 2024
b193065
fix: del gmt modify time in session
xjlgod Dec 30, 2024
74d1f67
fix: del gmt modify time in session
xjlgod Dec 30, 2024
ceed9ba
fix: fix global lock file service and redis service
xjlgod Jan 1, 2025
3a47a2b
fix: fix button display
xjlgod Jan 3, 2025
786dcd4
fix: del branchdel request and resp
xjlgod Jan 5, 2025
254c958
fix: fix test build
xjlgod Jan 5, 2025
3170302
fix: fix pmd check
xjlgod Jan 6, 2025
534d4bb
fix: fix pmd check
xjlgod Jan 6, 2025
819fdb9
fix: fix ci error
xjlgod Jan 6, 2025
3b52699
Merge branch '2.x' into feature/console-trx
xjlgod Jan 6, 2025
2a2068a
fix: fix ci error
xjlgod Jan 6, 2025
be53323
fix: fix ci error
xjlgod Jan 6, 2025
dfe856e
feat: add force delete session
xjlgod Jan 8, 2025
21231c5
fix: ci error fix
xjlgod Jan 8, 2025
92669aa
Merge branch '2.x' into feature/console-trx
xjlgod Jan 11, 2025
0a5caf1
fix: fix front display
xjlgod Jan 11, 2025
ec3a0cf
Merge remote-tracking branch 'origin/feature/console-trx' into featur…
xjlgod Jan 11, 2025
ac81603
Merge branch '2.x' into feature/console-trx
xjlgod Jan 12, 2025
8c7a505
fix: fix display
xjlgod Jan 12, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class Result<T> implements Serializable {

public static final String SUCCESS_CODE = "200";
public static final String SUCCESS_MSG = "success";
public static final String FAIL_CODE = "500";


private String code = SUCCESS_CODE;
private String message = SUCCESS_MSG;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,18 @@ public static <T> SingleResult<T> failure(Code errorCode) {
return new SingleResult(errorCode.getCode(), errorCode.getMsg());
}

public static <T> SingleResult<T> failure(String msg) {
return new SingleResult<>(FAIL_CODE, msg);
}

public static <T> SingleResult<T> success(T data) {
return new SingleResult<>(SUCCESS_CODE, SUCCESS_MSG,data);
}

public static <T> SingleResult<T> success() {
return new SingleResult<>(SUCCESS_CODE, SUCCESS_MSG, null);
}

public T getData() {
return data;
}
Expand Down
12 changes: 12 additions & 0 deletions console/src/main/resources/static/console-fe/src/locales/en-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ const enUs: ILocale = {
showBranchSessionTitle: 'View branch session',
showGlobalLockTitle: 'View global lock',
branchSessionDialogTitle: 'Branch session info',
deleteGlobalSessionTitle: 'Delete global session',
forceDeleteGlobalSessionTitle: 'Force delete global session',
stopGlobalSessionTitle: 'Stop global session retry',
startGlobalSessionTitle: 'Start global session retry',
sendGlobalSessionTitle: 'Commit or rollback global session',
changeGlobalSessionTitle: 'Change global session status',
deleteBranchSessionTitle: 'Delete branch session',
forceDeleteBranchSessionTitle: 'force delete branch session',
stopBranchSessionTitle: 'Stop branch session retry',
startBranchSessionTitle: 'Start branch session retry',
},
GlobalLockInfo: {
title: 'GlobalLockInfo',
Expand All @@ -69,6 +79,8 @@ const enUs: ILocale = {
inputFilterPlaceholder: 'Please enter filter criteria',
resetButtonLabel: 'Reset',
searchButtonLabel: 'Search',
operateTitle: 'operate',
deleteGlobalLockTitle: 'Delete global lock',
},
};

Expand Down
12 changes: 12 additions & 0 deletions console/src/main/resources/static/console-fe/src/locales/zh-cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ const zhCn: ILocale = {
showBranchSessionTitle: '查看分支信息',
showGlobalLockTitle: '查看全局锁',
branchSessionDialogTitle: '分支事务信息',
deleteGlobalSessionTitle: '删除全局事务',
forceDeleteGlobalSessionTitle: '强制删除全局事务',
stopGlobalSessionTitle: '停止全局事务重试',
startGlobalSessionTitle: '开启全局事务重试',
sendGlobalSessionTitle: '提交或回滚全局事务',
changeGlobalSessionTitle: '更新全局事务状态',
deleteBranchSessionTitle: '删除分支事务',
forceDeleteBranchSessionTitle: '强制删除分支事务',
stopBranchSessionTitle: '停止分支事务重启',
startBranchSessionTitle: '开启分支事务重试',
},
GlobalLockInfo: {
title: '全局锁信息',
Expand All @@ -69,6 +79,8 @@ const zhCn: ILocale = {
inputFilterPlaceholder: '请输入筛选条件',
resetButtonLabel: '重置',
searchButtonLabel: '搜索',
operateTitle: '操作',
deleteGlobalLockTitle: '删除全局锁',
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@
* limitations under the License.
*/
import React from 'react';
import { ConfigProvider, Table, Button, DatePicker, Form, Icon, Pagination, Input } from '@alicloud/console-components';
import { ConfigProvider, Table, Button, DatePicker, Form, Icon, Pagination, Input, Dialog, Message } from '@alicloud/console-components';
import Actions, { LinkButton } from '@alicloud/console-components-actions';
import { withRouter } from 'react-router-dom';
import Page from '@/components/Page';
import { GlobalProps } from '@/module';
import styled, { css } from 'styled-components';
import getData, { GlobalLockParam } from '@/service/globalLockInfo';
import getData, {checkData, deleteData, GlobalLockParam } from '@/service/globalLockInfo';
import PropTypes from 'prop-types';
import moment from 'moment';

import './index.scss';
import {get} from "lodash";
import {enUsKey, getCurrentLanguage} from "@/reducers/locale";

const { RangePicker } = DatePicker;
const FormItem = Form.Item;
Expand All @@ -37,7 +39,7 @@ type GlobalLockInfoState = {
globalLockParam: GlobalLockParam;
}

class GlobalLockInfo extends React.Component<GlobalProps, GlobalLockInfoState> {
class GlobalLockInfo extends React.Component<GlobalProps, GlobalLockInfoState> {
static displayName = 'GlobalLockInfo';

static propTypes = {
Expand Down Expand Up @@ -148,12 +150,53 @@ type GlobalLockInfoState = {
this.search();
}

deleteCell = (val: string, index: number, record: any) => {
const {locale = {}} = this.props;
const {
deleteGlobalLockTitle
} = locale;
let width = getCurrentLanguage() === enUsKey ? '120px' : '80px'
return (
<Actions style={{width: width}}>
<Button onClick={() => {
let addWarnning = ''
Dialog.confirm({
title: 'Confirm',
content: 'Are you sure you want to delete the global lock',
onOk: () => {
checkData(record).then((rsp) => {
addWarnning = rsp.data ? 'The branch transactions may be affected' : ''
Dialog.confirm({
title: 'Warnning',
content: <div dangerouslySetInnerHTML={{ __html: 'Dirty write problem exists' + '<br>' + addWarnning }}/>,
onOk: () => {
deleteData(record).then(() => {
Message.success("Delete success")
this.search()
}).catch((rsp) => {
Message.error(get(rsp, 'data.message'))
})
}
})
}).catch((rsp) => {
Message.error(get(rsp, 'data.message'))
})
}
});
}}>
{deleteGlobalLockTitle}
</Button>
</Actions>)
}


render() {
const { locale = {} } = this.props;
const { title, subTitle, createTimeLabel,
inputFilterPlaceholder,
searchButtonLabel,
resetButtonLabel,
operateTitle,
} = locale;
return (
<Page
Expand Down Expand Up @@ -221,27 +264,28 @@ type GlobalLockInfoState = {
</Form>
{/* global lock table */}
<div>
<Table dataSource={this.state.list} loading={this.state.loading}>
<Table.Column title="xid" dataIndex="xid" />
<Table.Column title="transactionId" dataIndex="transactionId" />
<Table.Column title="branchId" dataIndex="branchId" />
<Table.Column title="resourceId" dataIndex="resourceId" />
<Table.Column title="tableName" dataIndex="tableName" />
<Table.Column title="pk" dataIndex="pk" />
<Table.Column title="rowKey" dataIndex="rowKey" />
<Table.Column title="gmtCreate" dataIndex="gmtCreate" />
<Table.Column title="gmtModified" dataIndex="gmtModified" />
</Table>
<Pagination
total={this.state.total}
defaultCurrent={1}
current={this.state.globalLockParam.pageNum}
onChange={this.paginationOnChange}
pageSize={this.state.globalLockParam.pageSize}
pageSizeSelector="dropdown"
pageSizeList={[10, 20, 30, 40, 50]}
onPageSizeChange={this.paginationOnPageSizeChange}
/>
<Table dataSource={this.state.list} loading={this.state.loading}>
<Table.Column title="xid" dataIndex="xid" />
<Table.Column title="transactionId" dataIndex="transactionId" />
<Table.Column title="branchId" dataIndex="branchId" />
<Table.Column title="resourceId" dataIndex="resourceId" />
<Table.Column title="tableName" dataIndex="tableName" />
<Table.Column title="pk" dataIndex="pk" />
<Table.Column title="rowKey" dataIndex="rowKey" />
<Table.Column title="gmtCreate" dataIndex="gmtCreate" />
<Table.Column title="gmtModified" dataIndex="gmtModified" />
<Table.Column title={operateTitle} cell={this.deleteCell}/>
</Table>
<Pagination
total={this.state.total}
defaultCurrent={1}
current={this.state.globalLockParam.pageNum}
onChange={this.paginationOnChange}
pageSize={this.state.globalLockParam.pageSize}
pageSizeSelector="dropdown"
pageSizeList={[10, 20, 30, 40, 50]}
onPageSizeChange={this.paginationOnPageSizeChange}
/>
</div>
</Page>
);
Expand Down
Loading
Loading