Skip to content

Commit

Permalink
chore: conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
HSunboy committed Jul 29, 2024
2 parents c36061f + 4ea3890 commit 528fb84
Show file tree
Hide file tree
Showing 59 changed files with 757 additions and 452 deletions.
1 change: 0 additions & 1 deletion src/common/network/sql/executeSQL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ export default async function executeSQL(
return pre;
}, []);
const unauthorizedResource = taskInfo?.unauthorizedDBResources;
const violatedRules = rootViolatedRules?.concat(taskInfo?.sqls);
if (unauthorizedResource?.length) {
// 无权限库
return {
Expand Down
7 changes: 3 additions & 4 deletions src/component/CommonTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ interface IProps<RecordType> {
operationContent?: IOperationContent;
// 是否展示 操作连 筛选区&自定义操作区 分割标记
isSplit?: boolean;
// 行选择 相关配置
// 行选择 相关配置 (初使用时容易与antd的rowSelection混淆重复导致bug)
rowSelecter?: IRowSelecter<RecordType>;
// 行选择状态回调
rowSelectedCallback?: (selectedRowKeys: any[]) => void;
Expand Down Expand Up @@ -276,12 +276,11 @@ const CommonTable: <RecordType extends object = any>(
}

function handleRowKeyChange(selected: boolean, changeKeys: number[]) {
const keys = [...selectedRowKeys];
let keys = [...selectedRowKeys];
if (selected) {
keys.push(...changeKeys);
} else {
const firstKeyIndex = keys.indexOf(changeKeys[0]);
keys.splice(firstKeyIndex, changeKeys.length);
keys = keys.filter((item) => !changeKeys.includes(item));
}
setSelectedRowKeys(keys);
}
Expand Down
2 changes: 1 addition & 1 deletion src/component/ExecuteSqlDetailModal/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
white-space: nowrap;
text-overflow: ellipsis;
flex-shrink: 0;
max-width: 300px;
max-width: 640px;
}
.flexBetween {
display: flex;
Expand Down
11 changes: 8 additions & 3 deletions src/component/ExecuteSqlDetailModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { handleShowOutputFilter } from '@/page/Workspace/components/SQLExplain';
import { formatMessage } from '@/util/intl';
import { getFullLinkTraceDownloadUrl } from '@/common/network/sql';
import { downloadFile } from '@/util/utils';
import TraceComp from '@/page/Workspace/components/Trace/TraceComp';
import TraceComp from '@/page/Workspace/components/Trace/TraceComponent';
import { TraceTabsType } from '@/page/Workspace/components/Trace';
import {
ProfileType,
Expand Down Expand Up @@ -49,6 +49,8 @@ const ExecuteSQLDetailModal: React.FC<IProps> = ({ modalStore }: IProps) => {
const [pageLoading, setPageLoading] = useState<boolean>(false);
const [searchValue, setSearchValue] = useState<string>(null);
const finished = !!data?.graph?.status && data?.graph?.status === IProfileStatus.FINISHED;
const enableTrace =
finished && modalStore?.executeSqlDetailData?.session?.params?.fullLinkTraceEnabled;
const getExecuteRadioOption = () => {
return [
{
Expand All @@ -71,7 +73,7 @@ const ExecuteSQLDetailModal: React.FC<IProps> = ({ modalStore }: IProps) => {
id: 'src.component.ExecuteSqlDetailModal.0B221F0A',
defaultMessage: '全链路诊断',
}),
disabled: !finished,
disabled: !enableTrace,
},
];
};
Expand All @@ -87,6 +89,9 @@ const ExecuteSQLDetailModal: React.FC<IProps> = ({ modalStore }: IProps) => {
];

const getDisabledTooltip = (val) => {
if (modalStore?.executeSqlDetailData?.traceEmptyReason) {
return modalStore?.executeSqlDetailData?.traceEmptyReason;
}
if (finished || !data?.graph?.status) {
return val;
}
Expand Down Expand Up @@ -334,7 +339,7 @@ const ExecuteSQLDetailModal: React.FC<IProps> = ({ modalStore }: IProps) => {
id: 'src.component.ExecuteSqlDetailModal.A944EAD1',
defaultMessage: '执行计划详情',
}),
sql: modalStore?.executeSqlDetailData?.sql,
sql: modalStore?.executeSqlDetailData?.selectedSQL,
session: modalStore?.executeSqlDetailData?.session,
traceId: modalStore?.executeSqlDetailData?.traceId,
getDetail: getPlanDetail,
Expand Down
20 changes: 11 additions & 9 deletions src/component/ProfileFlow/customComponents/DetailBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default ({ dataSource, topNodes, initialNodes, globalInfo }: Iprops) => {

function getProfileNodeDetail(data) {
return (
<div style={{ width: '332px' }} className={styles.customDetailBox}>
<div style={{ width: '336px' }} className={styles.customDetailBox}>
<div>
{top5Render()}
{topNodesList.length ? <Divider /> : null}
Expand Down Expand Up @@ -152,7 +152,7 @@ export default ({ dataSource, topNodes, initialNodes, globalInfo }: Iprops) => {
></span>
{key}
</span>
<span>
<span className={styles.value}>
{formatTimeTemplate(
BigNumber(value as any)
.div(1000000)
Expand All @@ -163,7 +163,7 @@ export default ({ dataSource, topNodes, initialNodes, globalInfo }: Iprops) => {
) : (
<>
<span>{key}</span>
<span>{value}</span>
<span className={styles.value}>{value}</span>
</>
)}
</div>
Expand All @@ -182,7 +182,7 @@ export default ({ dataSource, topNodes, initialNodes, globalInfo }: Iprops) => {
return (
<div className={styles.keyValueBox}>
<span>{key}</span>
<span>{value}</span>
<span className={styles.value}>{value}</span>
</div>
);
})}
Expand Down Expand Up @@ -287,7 +287,7 @@ export default ({ dataSource, topNodes, initialNodes, globalInfo }: Iprops) => {
<Radio.Group
value={sortType}
onChange={handleSortChange}
style={{ width: '100%', padding: '0 6px 8px 6px' }}
style={{ width: '100%', padding: '4px 6px 8px 6px', textAlign: 'center' }}
>
<Radio.Button value={subNodeSortType.BY_DURATION}>
{subNodesSortMap[subNodeSortType.BY_DURATION].label}
Expand Down Expand Up @@ -328,7 +328,7 @@ export default ({ dataSource, topNodes, initialNodes, globalInfo }: Iprops) => {
</div>
<div style={{ color: 'var(--profile-text-color)' }}>[{i?.id}]</div>
</div>
<span>
<span className={styles.value}>
{' '}
{formatTimeTemplate(BigNumber(i?.data?.duration).div(1000000).toNumber())}{' '}
</span>
Expand Down Expand Up @@ -371,12 +371,14 @@ export default ({ dataSource, topNodes, initialNodes, globalInfo }: Iprops) => {
></span>
{key}
</span>
<span>{formatTimeTemplate(BigNumber(value).div(1000000).toNumber())} </span>
<span className={styles.value}>
{formatTimeTemplate(BigNumber(value).div(1000000).toNumber())}{' '}
</span>
</>
) : (
<>
<span>{key}</span>
<span>{value}</span>
<span className={styles.value}>{value}</span>
</>
)}
</div>
Expand All @@ -395,7 +397,7 @@ export default ({ dataSource, topNodes, initialNodes, globalInfo }: Iprops) => {
return (
<div className={styles.keyValueBox}>
<span>{key}</span>
<span>{value}</span>
<span className={styles.value}>{value}</span>
</div>
);
})}
Expand Down
8 changes: 4 additions & 4 deletions src/component/ProfileFlow/customComponents/Edge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const CustomEdge = ({ id, sourceX, sourceY, targetX, targetY, style = {}, data }

const edgeEndPointY = targetY - TURNNG_LINE_GAP;

// 根据tartget与source的x位置计算xOffset, 1.左边 2.右边 和 3.中间的区别
const xOffset = sourceX - targetX > 4 ? -16 : sourceX - targetX < -4 ? 16 : 0;
// 根据tartget与source的x位置计算yOffset, 1.左边/右边 2.中间的区别
let yOffset = Math.abs(sourceX - targetX) < 4 ? 25 : 10;
// 根据是否有一个以上子节点tartget与source的x位置计算xOffset
const xOffset = data?.isSingleChild ? 0 : sourceX - targetX > 4 ? -16 : 16;
// 根据tartget与source的x位置计算yOffset
let yOffset = data?.isSingleChild ? 25 : 10;
// 有子节点的再单独计算
yOffset = data.isOverlap ? yOffset + 8 : yOffset;

Expand Down
2 changes: 1 addition & 1 deletion src/component/ProfileFlow/customComponents/Node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function TextUpdaterNode({ data, id, isConnectable }) {
{data?.hasChild ? (
<div
className={styles.icon}
style={{ bottom: data?.subNodes ? '-33px' : '-25px' }}
style={{ top: data?.subNodes ? 'calc(100% + 8px)' : '100%' }}
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
Expand Down
9 changes: 7 additions & 2 deletions src/component/ProfileFlow/customComponents/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
.customDetailBox {
position: absolute;
right: 16px;
width: 332px;
width: 336px;
background-color: var(--profile-secondry-background-color);
border: 1px solid var(--profile-border-color);
border-left: none;
height: calc(100% - 151px);
overflow-y: auto;
padding: 12px 8px;
.value {
color: var(--profile-text-color);
}
.customDetailBoxItem {
display: flex;
justify-content: space-between;
Expand Down Expand Up @@ -133,7 +136,9 @@
}
.icon {
position: absolute;
left: 129px;
left: 50%;
top: 100%;
transform: translateX(-50%);
padding: 4px;
color: var(--profile-icon-color);
}
Expand Down
2 changes: 1 addition & 1 deletion src/component/ProfileFlow/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
overflow-x: auto;
background-color: var(--profile-primary-background-color);
border: 1px solid var(--profile-border-color);
width: calc(100% - 332px);
width: calc(100% - 336px);
:global {
.react-flow__attribution {
display: none;
Expand Down
1 change: 1 addition & 0 deletions src/component/ProfileFlow/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ export function transformDataForReactFlow(
data: {
weight: node?.data.inEdges?.[0]?.weight,
isOverlap: isParantOverlap,
isSingleChild: node?.parent?.data?.outEdges?.length === 1,
},
};
edges.push(reactFlowEdge);
Expand Down
9 changes: 7 additions & 2 deletions src/component/SelectTransfer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,13 @@ export default function SelectTransfer(props: IProps) {
checkable
selectable={false}
checkedKeys={checkedKeys}
onCheck={(v) => {
setCheckedKeys([...(checkedKeys || []), ...(v as string[])]);
onCheck={(v, e) => {
const { checked, checkedNodes, node, event, halfCheckedKeys } = e;
if (checked === false) {
setCheckedKeys([...checkedKeys.filter((i) => i !== node?.key)]);
} else {
setCheckedKeys([...(checkedKeys || []), ...(v as string[])]);
}
}}
height={274}
treeData={sourceDisplayTreeData}
Expand Down
2 changes: 1 addition & 1 deletion src/component/Task/AlterDdlTask/DetailContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export function getItems(
defaultMessage: '所属数据源',
}),
//'所属数据源'
task?.database.dataSource?.name || '-',
task?.database?.dataSource?.name || '-',
],

hasFlow ? riskItem : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const CreateModal: React.FC<IProps> = (props) => {
const projectId = Form.useWatch('projectId', form);

const disabledDate = (current) => {
return current && current < moment().endOf('day');
return current && current < moment().subtract(1, 'days').endOf('day');
};

useEffect(() => {
Expand Down
10 changes: 5 additions & 5 deletions src/component/Task/DataArchiveTask/CreateModal/ArchiveRange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ import type { FormInstance } from 'antd/lib/form';
interface IProps {
tables: ITable[];
enabledTargetTable?: boolean;
form?: FormInstance<any>;
checkPartition?: boolean;
}
const ArchiveRange: React.FC<IProps> = (props) => {
const { tables, enabledTargetTable = false, form } = props;
const [enablePartition, setEnablePartition] = useState<boolean>(false);
const { tables, enabledTargetTable = false, checkPartition } = props;
const [enablePartition, setEnablePartition] = useState<boolean>(checkPartition);
const tablesOptions = tables?.map((item) => ({
label: item.tableName,
value: item.tableName,
}));

useEffect(() => {
setEnablePartition(!!form?.getFieldsValue()?.tables?.find((i) => i?.partitions));
}, [form?.getFieldsValue()?.tables]);
setEnablePartition(checkPartition);
}, [checkPartition]);

return (
<>
Expand Down
5 changes: 3 additions & 2 deletions src/component/Task/DataArchiveTask/CreateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ const CreateModal: React.FC<IProps> = (props) => {
const [confirmLoading, setConfirmLoading] = useState(false);
const [crontab, setCrontab] = useState<ICrontab>(null);
const [tables, setTables] = useState<ITable[]>();
const [enablePartition, setEnablePartition] = useState<boolean>(false);
const [form] = Form.useForm();
const databaseId = Form.useWatch('databaseId', form);
const { session: sourceDBSession, database: sourceDB } = useDBSession(databaseId);
Expand Down Expand Up @@ -198,7 +199,7 @@ const CreateModal: React.FC<IProps> = (props) => {
timeoutMillis,
syncTableStructure,
} = jobParameters;

setEnablePartition(isEdit && !!tables?.find((i) => i?.partitions));
const formData = {
databaseId: sourceDatabaseId,
targetDataBaseId: targetDataBaseId,
Expand Down Expand Up @@ -572,7 +573,7 @@ const CreateModal: React.FC<IProps> = (props) => {
/>
</Space>
<Space direction="vertical" size={24} style={{ width: '100%' }}>
<ArchiveRange enabledTargetTable tables={tables} form={form} />
<ArchiveRange enabledTargetTable tables={tables} checkPartition={enablePartition} />
<VariableConfig form={form} />
</Space>
<Form.Item name="deleteAfterMigration" valuePropName="checked">
Expand Down
10 changes: 5 additions & 5 deletions src/component/Task/DataClearTask/CreateModal/ArchiveRange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const { Text, Link } = Typography;
interface IProps {
tables: ITable[];
needCheckBeforeDelete?: boolean;
form?: FormInstance<any>;
checkPartition?: boolean;
}
const ArchiveRange: React.FC<IProps> = (props) => {
const { tables, needCheckBeforeDelete = false, form } = props;
const [enablePartition, setEnablePartition] = useState<boolean>(false);
const { tables, needCheckBeforeDelete = false, checkPartition } = props;
const [enablePartition, setEnablePartition] = useState<boolean>(checkPartition);
const tablesOptions = tables?.map((item) => ({
label: item.tableName,
value: item.tableName,
Expand All @@ -45,8 +45,8 @@ const ArchiveRange: React.FC<IProps> = (props) => {
const hasAdvancedOptionCol = enablePartition || needCheckBeforeDelete;

useEffect(() => {
setEnablePartition(!!form?.getFieldsValue()?.tables?.find((i) => i?.partitions));
}, [form?.getFieldsValue()?.tables]);
setEnablePartition(checkPartition);
}, [checkPartition]);

return (
<>
Expand Down
4 changes: 3 additions & 1 deletion src/component/Task/DataClearTask/CreateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const CreateModal: React.FC<IProps> = (props) => {
const [confirmLoading, setConfirmLoading] = useState(false);
const [crontab, setCrontab] = useState<ICrontab>(null);
const [tables, setTables] = useState<ITable[]>();
const [enablePartition, setEnablePartition] = useState<boolean>(false);
const [form] = Form.useForm();
const databaseId = Form.useWatch('databaseId', form);
const { session, database } = useDBSession(databaseId);
Expand Down Expand Up @@ -159,6 +160,7 @@ const CreateModal: React.FC<IProps> = (props) => {
targetDatabaseId,
timeoutMillis,
} = jobParameters;
setEnablePartition(isEdit && !!tables?.find((i) => i?.partitions));
const formData = {
databaseId,
rowLimit: rateLimit?.rowLimit,
Expand Down Expand Up @@ -553,7 +555,7 @@ const CreateModal: React.FC<IProps> = (props) => {
<ArchiveRange
tables={tables}
needCheckBeforeDelete={needCheckBeforeDelete}
form={form}
checkPartition={enablePartition}
/>
);
}}
Expand Down
Loading

0 comments on commit 528fb84

Please sign in to comment.