fix
This commit is contained in:
96
src/App.js
96
src/App.js
@@ -42,6 +42,7 @@ function DisplayBnds() {
|
||||
<input type={"checkbox"} disabled={true} checked={user.active}/> активный –
|
||||
<input type={"checkbox"} disabled={true} checked={user.upstream}/> вышестоящий –
|
||||
<a href={"/delbnd/" + user.id}>X</a> <a href={"/bnd/" + user.id}>E</a>
|
||||
<a href={"/bnd/" + user.id + "/profiles"}>профили</a>
|
||||
</p>
|
||||
</div>;
|
||||
}
|
||||
@@ -53,6 +54,7 @@ function DisplayBnds() {
|
||||
<a href={"/newbnd"}>Новый банк данных</a><br/>
|
||||
<a href={"/queue"}>Очередь</a><br/>
|
||||
<a href={"/send"}>Отправить коммит</a><br/>
|
||||
<a href={"/scr"}>Отправить корректирующую репликацию</a><br/>
|
||||
</div>
|
||||
</div>;
|
||||
}
|
||||
@@ -255,12 +257,72 @@ function BndProfiles() {
|
||||
</div>;
|
||||
}
|
||||
|
||||
function SendCommit() {
|
||||
let commit_id, bndname
|
||||
|
||||
return <form onSubmit={async (e) => {
|
||||
function ProfileNew() {
|
||||
const navigate = useNavigate();
|
||||
const {id} = useParams();
|
||||
|
||||
return <Mutation
|
||||
mutation={gql`
|
||||
mutation createProfile($user_id: Int!, $schema: String!, $branch: String!, $json: String!){
|
||||
createProfile(userId: $user_id, schema: $schema, branch: $branch, json: $json)
|
||||
}
|
||||
`}
|
||||
>
|
||||
{(createProfile, { loading, error, data }) => {
|
||||
if (loading) return <p>Loading...</p>;
|
||||
if (error) return <p>Error :(</p>;
|
||||
let schema, branch;
|
||||
|
||||
return (
|
||||
<form onSubmit={e => {
|
||||
e.preventDefault();
|
||||
console.log(commit_id.value)
|
||||
createProfile({ variables: {
|
||||
user_id: parseInt(id),
|
||||
schema: schema.value,
|
||||
branch: branch.value,
|
||||
json: ''
|
||||
}}).then(() => {
|
||||
navigate("/bnd/" + id + "/profiles");
|
||||
});
|
||||
}}>
|
||||
schema <input
|
||||
type='text'
|
||||
ref={ node => schema = node }
|
||||
/><br/>
|
||||
branch <input
|
||||
type='text'
|
||||
ref={ node => branch = node }
|
||||
/><br/>
|
||||
<button type='submit'>Создать</button>
|
||||
</form>
|
||||
);
|
||||
}}
|
||||
</Mutation>;
|
||||
}
|
||||
|
||||
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 <form onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
sendCommit({
|
||||
variables: {
|
||||
bndname: bndname.value,
|
||||
schema: schema.value,
|
||||
commitId: commit_id.value,
|
||||
}
|
||||
}
|
||||
).then(() => {
|
||||
navigate('/queue');
|
||||
});
|
||||
}}>
|
||||
commit id <input
|
||||
type='text'
|
||||
@@ -270,12 +332,33 @@ function SendCommit() {
|
||||
type='text'
|
||||
ref={node => bndname = node}
|
||||
/><br/>
|
||||
<button type='submit'>Обновить</button>
|
||||
schema <input
|
||||
type='text'
|
||||
ref={node => schema = node}
|
||||
/><br/>
|
||||
<button type='submit'>Отправить коммит</button>
|
||||
</form>;
|
||||
}
|
||||
|
||||
function StartCorrectingReplication() {
|
||||
return <div></div>;
|
||||
let schema, bndname;
|
||||
const navigate = useNavigate();
|
||||
|
||||
return <form onSubmit={async (e) => {
|
||||
e.preventDefault();
|
||||
await fetch('http://10.10.8.60:8000/cr?bnd_name=' + bndname.value + '&schema=' + bndname.value);
|
||||
navigate('/queue');
|
||||
}}>
|
||||
bndname <input
|
||||
type='text'
|
||||
ref={node => bndname = node}
|
||||
/><br/>
|
||||
schema <input
|
||||
type='text'
|
||||
ref={node => schema = node}
|
||||
/><br/>
|
||||
<button type='submit'>Обновить</button>
|
||||
</form>;
|
||||
}
|
||||
|
||||
|
||||
@@ -288,6 +371,7 @@ export default function App() {
|
||||
<Route path={"/newbnd"} element={<BndForm/>}/>
|
||||
<Route path={"/delbnd/:id"} element={<DeleteBnd/>}/>
|
||||
<Route path={"/bnd/:id/profiles"} element={<BndProfiles/>}/>
|
||||
<Route path={"/bnd/:id/profiles/new"} element={<ProfileNew/>}/>
|
||||
<Route path={"/bnd/:id/schedule"} element={<BndProfiles/>}/>
|
||||
<Route path={"/bnd/:id/incoming"} element={<BndProfiles/>}/>
|
||||
<Route path={"/bnd/:id"} element={<BndEdit/>}/>
|
||||
|
||||
@@ -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(),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user