From b45fb70006066f363a883df496a590cf255b3cc0 Mon Sep 17 00:00:00 2001 From: Ivan Vazhenin Date: Sun, 24 Dec 2023 18:44:01 +0300 Subject: [PATCH] fix --- src/App.js | 96 ++++++++++++++++++++++++++++++++++++++++++++++++---- src/index.js | 2 +- 2 files changed, 91 insertions(+), 7 deletions(-) diff --git a/src/App.js b/src/App.js index 4331b9c..2ea96ce 100644 --- a/src/App.js +++ b/src/App.js @@ -42,6 +42,7 @@ function DisplayBnds() { активный – вышестоящий –  X E +  профили

; } @@ -53,6 +54,7 @@ function DisplayBnds() { Новый банк данных
Очередь
Отправить коммит
+ Отправить корректирующую репликацию
; } @@ -255,12 +257,72 @@ function BndProfiles() { ; } -function SendCommit() { - let commit_id, bndname - return
{ +function ProfileNew() { + const navigate = useNavigate(); + const {id} = useParams(); + + return + {(createProfile, { loading, error, data }) => { + if (loading) return

Loading...

; + if (error) return

Error :(

; + let schema, branch; + + return ( + { + e.preventDefault(); + createProfile({ variables: { + user_id: parseInt(id), + schema: schema.value, + branch: branch.value, + json: '' + }}).then(() => { + navigate("/bnd/" + id + "/profiles"); + }); + }}> + schema schema = node } + />
+ branch branch = node } + />
+ + + ); + }} +
; +} + +function SendCommit() { + let commit_id, bndname, schema; + const SEND_COMMIT = gql` + mutation sendCommit($bndname: String!, $schema: String!, $commitId: String!) { + sendCommit(bndname: $bndname, schema: $schema, commitId: $commitId) + } + `; + const [sendCommit, { data, loading, error }] = useMutation(SEND_COMMIT); + const navigate = useNavigate(); + + return
{ e.preventDefault(); - console.log(commit_id.value) + sendCommit({ + variables: { + bndname: bndname.value, + schema: schema.value, + commitId: commit_id.value, + } + } + ).then(() => { + navigate('/queue'); + }); }}> commit id bndname = node} />
- + schema schema = node} + />
+
; } function StartCorrectingReplication() { - return
; + let schema, bndname; + const navigate = useNavigate(); + + return
{ + e.preventDefault(); + await fetch('http://10.10.8.60:8000/cr?bnd_name=' + bndname.value + '&schema=' + bndname.value); + navigate('/queue'); + }}> + bndname bndname = node} + />
+ schema schema = node} + />
+ +
; } @@ -288,6 +371,7 @@ export default function App() { }/> }/> }/> + }/> }/> }/> }/> diff --git a/src/index.js b/src/index.js index 201ed96..1a5d3f1 100644 --- a/src/index.js +++ b/src/index.js @@ -7,7 +7,7 @@ import {ApolloClient, ApolloProvider, InMemoryCache} from "@apollo/client"; import {BrowserRouter} from "react-router-dom"; const client = new ApolloClient({ - uri: 'http://127.0.0.1:9000/graphql', + uri: 'http://10.10.8.24:9000/graphql', cache: new InMemoryCache(), });