-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/flowerfine/scaleph into dev
- Loading branch information
Showing
36 changed files
with
1,436 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...i-react/src/models/project/workspace/kubernetes/template/flinkKubernetesTemplateDetail.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import {WsFlinkKubernetesTemplate} from "@/services/project/typings"; | ||
import { Reducer, Effect } from "umi"; | ||
import {WsFlinkKubernetesTemplateService} from "@/services/project/WsFlinkKubernetesTemplateService"; | ||
import YAML from "yaml"; | ||
|
||
export interface StateType { | ||
template: WsFlinkKubernetesTemplate, | ||
templateYaml: string | ||
templateYamlWithDefault: string | ||
} | ||
|
||
export interface ModelType { | ||
namespace: string; | ||
|
||
state: StateType; | ||
|
||
effects: { | ||
queryTemplate: Effect; | ||
}; | ||
|
||
reducers: { | ||
updateTemplate: Reducer<StateType>; | ||
}; | ||
} | ||
|
||
const model: ModelType = { | ||
namespace: "flinkKubernetesTemplateDetail", | ||
|
||
state: { | ||
template: null, | ||
templateYaml: null, | ||
templateYamlWithDefault: null | ||
}, | ||
|
||
effects: { | ||
*editTemplate({ payload }, { call, put }) { | ||
const { data } = yield call(WsFlinkKubernetesTemplateService.asYaml, payload); | ||
const response = yield call(WsFlinkKubernetesTemplateService.asYamlWithDefault, payload); | ||
yield put({ type: 'updateTemplate', payload: {template: payload, templateYaml: YAML.stringify(data), templateYamlWithDefault: YAML.stringify(response.data)} }); | ||
}, | ||
}, | ||
|
||
reducers: { | ||
updateTemplate(state, { payload }) { | ||
return { | ||
...state, | ||
template: payload.template, | ||
templateYaml: payload.templateYaml, | ||
templateYamlWithDefault: payload.templateYamlWithDefault, | ||
}; | ||
}, | ||
}, | ||
}; | ||
|
||
export default model; |
55 changes: 55 additions & 0 deletions
55
...ui-react/src/models/project/workspace/kubernetes/template/flinkKubernetesTemplateSteps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import {WsFlinkKubernetesTemplate} from "@/services/project/typings"; | ||
import { Reducer, Effect } from "umi"; | ||
import {WsFlinkKubernetesTemplateService} from "@/services/project/WsFlinkKubernetesTemplateService"; | ||
import YAML from "yaml"; | ||
|
||
export interface StateType { | ||
template: WsFlinkKubernetesTemplate, | ||
templateYaml: string | ||
templateYamlWithDefault: string | ||
} | ||
|
||
export interface ModelType { | ||
namespace: string; | ||
|
||
state: StateType; | ||
|
||
effects: { | ||
queryTemplate: Effect; | ||
}; | ||
|
||
reducers: { | ||
updateTemplate: Reducer<StateType>; | ||
}; | ||
} | ||
|
||
const model: ModelType = { | ||
namespace: "flinkKubernetesTemplateSteps", | ||
|
||
state: { | ||
template: null, | ||
templateYaml: null, | ||
templateYamlWithDefault: null | ||
}, | ||
|
||
effects: { | ||
*editTemplate({ payload }, { call, put }) { | ||
const { data } = yield call(WsFlinkKubernetesTemplateService.asYaml, payload); | ||
const response = yield call(WsFlinkKubernetesTemplateService.asYamlWithDefault, payload); | ||
yield put({ type: 'updateTemplate', payload: {template: payload, templateYaml: YAML.stringify(data), templateYamlWithDefault: YAML.stringify(response.data)} }); | ||
}, | ||
}, | ||
|
||
reducers: { | ||
updateTemplate(state, { payload }) { | ||
return { | ||
...state, | ||
template: payload.template, | ||
templateYaml: payload.templateYaml, | ||
templateYamlWithDefault: payload.templateYamlWithDefault, | ||
}; | ||
}, | ||
}, | ||
}; | ||
|
||
export default model; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { useLayoutEffect, useState } from "react"; | ||
import { throttle } from "lodash"; | ||
|
||
export default (mainCl = ".ant-pro-basicLayout-content") => { | ||
const [container, setContainer] = useState<{ height: number; width: number }>({ | ||
width: 100, | ||
height: 100 | ||
}); | ||
// const mainCl = '.ant-pro-basicLayout-content'; | ||
useLayoutEffect(() => { | ||
const handler = throttle(() => { | ||
const rt = document.querySelector(mainCl)?.getBoundingClientRect(); | ||
setContainer({ | ||
height: rt?.height, | ||
width: rt?.width | ||
}); | ||
}, 100); | ||
handler(); | ||
window.addEventListener("resize", handler, false); | ||
return () => { | ||
window.removeEventListener("resize", handler, false); | ||
}; | ||
}, []); | ||
|
||
return container; | ||
}; |
56 changes: 56 additions & 0 deletions
56
scaleph-ui-react/src/pages/Admin/Resource/Web/components/TransferTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Table, Transfer } from 'antd'; | ||
import { difference } from 'lodash'; // 注意这里改为大写的Difference | ||
import React from 'react'; | ||
|
||
// 定义组件的Props类型 | ||
interface Props { | ||
leftColumns: any[]; // 左侧表格列配置数组 | ||
rightColumns: any[]; // 右侧表格列配置数组 | ||
containerHeight: number; // 容器高度 | ||
} | ||
|
||
// 使用React.FC声明函数组件,并传入Props类型 | ||
const TableTransfer: React.FC<Props> = ({ leftColumns, rightColumns, ...restProps }) => ( | ||
<Transfer {...restProps}> | ||
{({ | ||
direction, | ||
filteredItems, | ||
onItemSelectAll, | ||
onItemSelect, | ||
selectedKeys: listSelectedKeys, | ||
disabled: listDisabled, | ||
}) => { | ||
const columns = direction === 'left' ? leftColumns : rightColumns; | ||
// 表格行选择配置 | ||
const rowSelection = { | ||
onSelectAll(selected: boolean, selectedRows: any[]) { | ||
const treeSelectedKeys = selectedRows.map(({ key }) => key); | ||
const diffKeys = selected | ||
? difference(treeSelectedKeys, listSelectedKeys) | ||
: difference(listSelectedKeys, treeSelectedKeys); | ||
onItemSelectAll(diffKeys, selected); | ||
}, | ||
onSelect: ({ id }: { id: string }, selected: boolean) => { | ||
onItemSelect(id, selected); | ||
}, | ||
selectedRowKeys: listSelectedKeys, | ||
}; | ||
|
||
return ( | ||
<Table | ||
scroll={{ y: restProps.containerHeight - 380 }} | ||
rowSelection={rowSelection} | ||
columns={columns} | ||
dataSource={filteredItems} | ||
size="small" | ||
rowKey="id" | ||
pagination={{ | ||
defaultPageSize: 20, | ||
}} | ||
style={{ pointerEvents: listDisabled ? 'none' : null }} | ||
/> | ||
); | ||
}} | ||
</Transfer> | ||
); | ||
export default React.memo(TableTransfer); |
Oops, something went wrong.