-
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.
- Loading branch information
Showing
12 changed files
with
217 additions
and
97 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
57 changes: 57 additions & 0 deletions
57
scaleph-ui-react/src/models/project/workspace/dataintegration/flinkcdc/flinkCDCSteps.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,57 @@ | ||
import {WsArtifactFlinkCDC} from "@/services/project/typings"; | ||
import {Effect, Reducer} from "umi"; | ||
import YAML from "yaml"; | ||
import {WsArtifactFlinkCDCService} from "@/services/project/WsArtifactFlinkCDCService"; | ||
|
||
export interface StateType { | ||
instance: WsArtifactFlinkCDC | null, | ||
instanceYaml: string | null | ||
} | ||
|
||
export interface ModelType { | ||
namespace: string; | ||
|
||
state: StateType; | ||
|
||
effects: { | ||
editInstance: Effect; | ||
}; | ||
|
||
reducers: { | ||
updateInstance: Reducer<StateType>; | ||
}; | ||
} | ||
|
||
const model: ModelType = { | ||
namespace: "flinkCDCSteps", | ||
|
||
state: { | ||
instance: null, | ||
instanceYaml: null, | ||
}, | ||
|
||
effects: { | ||
*editInstance({payload}, {call, put}) { | ||
const {data} = yield call(WsArtifactFlinkCDCService.preview, payload); | ||
yield put({ | ||
type: 'updateInstance', | ||
payload: { | ||
instance: payload, | ||
instanceYaml: YAML.stringify(data), | ||
} | ||
}); | ||
}, | ||
}, | ||
|
||
reducers: { | ||
updateInstance(state, {payload}) { | ||
return { | ||
...state, | ||
instance: payload.instance, | ||
instanceYaml: payload.instanceYaml, | ||
}; | ||
}, | ||
}, | ||
}; | ||
|
||
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
42 changes: 42 additions & 0 deletions
42
...-ui-react/src/pages/Project/Workspace/DataIntegration/FlinkCDC/Steps/New/YamlStepForm.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,42 @@ | ||
import React, {useEffect, useRef} from "react"; | ||
import {ProCard} from "@ant-design/pro-components"; | ||
import {useIntl, connect} from "@umijs/max"; | ||
import Editor, {Monaco, useMonaco} from "@monaco-editor/react"; | ||
|
||
const DataIntegrationFlinkCDCStepYaml: React.FC = (props: any) => { | ||
const intl = useIntl(); | ||
const editorRef = useRef(null); | ||
const monaco = useMonaco(); | ||
|
||
useEffect(() => { | ||
// do conditional chaining | ||
monaco?.languages.typescript.javascriptDefaults.setEagerModelSync(true); | ||
}, [monaco]); | ||
|
||
const handleEditorDidMount = (editor, monaco: Monaco) => { | ||
editorRef.current = editor; | ||
} | ||
|
||
return ( | ||
<ProCard> | ||
<Editor | ||
width="730" | ||
height="600px" | ||
language="yaml" | ||
theme="vs-white" | ||
value={props.flinkCDCSteps.instanceYaml} | ||
options={{ | ||
selectOnLineNumbers: true, | ||
readOnly: true, | ||
minimap: { | ||
enabled: false | ||
} | ||
}} | ||
onMount={handleEditorDidMount} | ||
/> | ||
</ProCard> | ||
); | ||
} | ||
|
||
const mapModelToProps = ({flinkCDCSteps}: any) => ({flinkCDCSteps}) | ||
export default connect(mapModelToProps)(DataIntegrationFlinkCDCStepYaml); |
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
Oops, something went wrong.