-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Destination.js
75 lines (71 loc) · 1.9 KB
/
Destination.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import React from 'react';
import {
updateDestinationAccessId,
updateDestinationSecretKey,
updateAccountId,
} from '../slice';
import { useDispatch, useSelector } from 'react-redux';
const Destination = (props) => {
const dispatch = useDispatch();
const { origin, destination } = useSelector((state) => state.GUI);
return (
<>
<h1>Destination</h1>
{props.name && (
<h2>
{props.name} {props.service}
</h2>
)}
<div>
{' '}
<label htmlFor="accessId">Access Id:</label>
{destination.accessId ? (
<div>{'\u2705'}</div>
) : (
<input
name="accessId"
onChange={(e) => {
const newState = props.accessIdHandler(e, origin, destination);
dispatch(updateDestinationAccessId(newState));
}}
></input>
)}
</div>
<div>
{' '}
<label htmlFor="secretKey">Secret Key:</label>
{destination.secretKey ? (
<div>{'\u2705'}</div>
) : (
<input
name="secretKey"
onChange={(e) => {
const newState = props.secretKeyHandler(e, origin, destination);
dispatch(updateDestinationSecretKey(newState));
}}
></input>
)}
</div>
{props.name === 'CloudFlare' && (
<div>
{' '}
<label htmlFor="accountId">Account Id:</label>
<input
name="accountId"
onChange={(e) => {
const newState = props.accountIdHandler(
e,
origin,
destination,
props.remoteType
);
dispatch(updateAccountId(newState));
}}
></input>
{destination.accountId.length > 1 && <div>{'\u2705'}</div>}
</div>
)}
</>
);
};
export default Destination;