-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
Modify.js
117 lines (106 loc) · 3.15 KB
/
Modify.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import React from 'react';
import TableHeader from '../TableCommon/TableHeader';
import styles from './ModifyEvent.scss';
import { getTableColumns } from '../utils';
import _push from '../push';
import Info from './Info';
import WebhookEditor from './WebhookEditor';
import OperationEditor from './OperationEditor';
import RetryConfEditor from './RetryConfEditor';
import HeadersEditor from './HeadersEditor';
import ActionButtons from './ActionButtons';
import { save, setDefaults, RESET_MODIFY_STATE } from './Actions';
class Modify extends React.Component {
componentDidMount() {
const { dispatch } = this.props;
dispatch(setDefaults());
}
componentWillUnmount() {
const { dispatch } = this.props;
dispatch({
type: RESET_MODIFY_STATE,
});
}
render() {
const {
modifyTriggerName,
modifyTrigger,
triggerList,
dispatch,
} = this.props;
const currentTrigger = triggerList.find(
tr => tr.name === modifyTriggerName
);
if (!currentTrigger) {
dispatch(_push('/events/manage'));
return null;
}
const {
definition,
headers,
webhook,
webhook_from_env,
retry_conf,
} = currentTrigger.configuration;
return (
<div className={styles.containerWhole + ' container-fluid'}>
<TableHeader
dispatch={dispatch}
triggerName={modifyTriggerName}
tabName="modify"
/>
<br />
<div className={styles.container}>
<Info
triggerName={currentTrigger.name}
tableName={currentTrigger.table_name}
schemaName={currentTrigger.table_schema}
styles={styles}
/>
<WebhookEditor
webhook={webhook || webhook_from_env}
dispatch={dispatch}
modifyTrigger={modifyTrigger}
env={Boolean(webhook_from_env)}
newWebhook={null}
save={() => dispatch(save('webhook', modifyTriggerName))}
styles={styles}
/>
<OperationEditor
definition={definition}
allTableColumns={getTableColumns(currentTrigger)}
dispatch={dispatch}
modifyTrigger={modifyTrigger}
newDefinition={null}
styles={styles}
save={() => dispatch(save('ops', modifyTriggerName))}
/>
<RetryConfEditor
retryConf={retry_conf}
modifyTrigger={modifyTrigger}
styles={styles}
save={() => dispatch(save('retry', modifyTriggerName))}
serverVersion={this.props.serverVersion}
dispatch={dispatch}
/>
<HeadersEditor
headers={headers}
styles={styles}
modifyTrigger={modifyTrigger}
save={() => dispatch(save('headers', modifyTriggerName))}
dispatch={dispatch}
/>
<ActionButtons
styles={styles}
dispatch={dispatch}
ongoingRequest={modifyTrigger.ongoingRequest}
triggerName={modifyTriggerName}
/>
</div>
<br />
<br />
</div>
);
}
}
export default Modify;