Skip to content

Commit 4797ba2

Browse files
committed
add monaco editor for repoConfig
1 parent 23a271a commit 4797ba2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

ui/src/components/repo/sidebar.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,10 +968,13 @@ function ConfigButton() {
968968
`,
969969
{ refetchQueries: ["RepoConfig"] }
970970
);
971+
const [str, setStr] = useState("");
972+
971973
useEffect(() => {
972974
// console.log(data);
973975
if (data) {
974976
dispatch(repoSlice.actions.setRepoConfig(JSON.parse(data.repoConfig)));
977+
setStr(data.repoConfig);
975978
}
976979
}, [data]);
977980
const repoConfig = useSelector((state) => state.repo.repoConfig);
@@ -1032,6 +1035,25 @@ function ConfigButton() {
10321035
<Typography id="modal-modal-description" sx={{ mt: 2 }}>
10331036
Duis mollis, est non commodo luctus, nisi erat porttitor ligula.
10341037
</Typography>
1038+
<MyMonaco
1039+
onChange={(value) => {
1040+
// dispatch(repoSlice.actions.setRepoConfig(value));
1041+
setStr(value);
1042+
}}
1043+
value={str}
1044+
></MyMonaco>
1045+
<Button
1046+
onClick={() => {
1047+
updateRepoConfig({
1048+
variables: {
1049+
reponame,
1050+
config: JSON.stringify(JSON.parse(str)),
1051+
},
1052+
});
1053+
}}
1054+
>
1055+
Save
1056+
</Button>
10351057
</Box>
10361058
</Modal>
10371059
</div>

0 commit comments

Comments
 (0)