Skip to content

Commit 964736c

Browse files
evavogievetsky
authored andcommitted
modal bindings
1 parent 2b4018d commit 964736c

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

src/client/modals/attribute-modal/attribute-modal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export class AttributeModal extends React.Component<AttributeModalProps, Attribu
125125
className="attribute-modal"
126126
title={title}
127127
onClose={onClose}
128+
onEnter={this.save.bind(this)}
128129
>
129130
<form>
130131
{nameDiv}

src/client/modals/cluster-seed-modal/cluster-seed-modal.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,11 @@ export class ClusterSeedModal extends React.Component<ClusterSeedModalProps, Clu
101101
}
102102

103103
onNext() {
104-
this.connect();
105-
this.setState({loading: true});
104+
const { canSave } = this.state;
105+
if (canSave) {
106+
this.connect();
107+
this.setState({loading: true});
108+
}
106109
}
107110

108111
render(): JSX.Element {
@@ -135,6 +138,7 @@ export class ClusterSeedModal extends React.Component<ClusterSeedModalProps, Clu
135138
className="cluster-seed-modal"
136139
title={STRINGS.connectNewCluster}
137140
onClose={this.props.onCancel}
141+
onEnter={this.onNext.bind(this)}
138142
deaf={loading}
139143
>
140144
<form>

src/client/modals/data-cube-seed-modal/data-cube-seed-modal.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export class DataCubeSeedModal extends React.Component<DataCubeSeedModalProps, D
111111
const { dataCubes, clusters } = this.props;
112112
if (!dataCubes || !clusters) return;
113113
var { clusterSource, autoFill } = this.state;
114+
if (!clusterSource) return;
114115

115116
var newDataCube = DataCube.fromClusterAndSource(
116117
generateUniqueName('dc', name => indexByAttribute(dataCubes, 'name', name) === -1),
@@ -160,6 +161,11 @@ export class DataCubeSeedModal extends React.Component<DataCubeSeedModalProps, D
160161
});
161162
}
162163

164+
onEnter() {
165+
this.onNext();
166+
this.props.onCancel();
167+
}
168+
163169
render(): JSX.Element {
164170
const { onNext, onCancel } = this.props;
165171
const { errors, autoFill, clusterSources, clusterSource } = this.state;
@@ -170,6 +176,7 @@ export class DataCubeSeedModal extends React.Component<DataCubeSeedModalProps, D
170176
className="data-cube-seed-modal"
171177
title={STRINGS.createDataCube}
172178
onClose={this.props.onCancel}
179+
onEnter={this.onEnter.bind(this)}
173180
>
174181
<form>
175182
{ FormLabel.dumbLabel('Source') }
@@ -189,7 +196,7 @@ export class DataCubeSeedModal extends React.Component<DataCubeSeedModalProps, D
189196
/>
190197
</form>
191198
<div className="button-bar">
192-
<Button type="primary" title={`${STRINGS.next}: ${STRINGS.configureDataCube}`} onClick={this.onNext.bind(this)}/>
199+
<Button type="primary" title={`${STRINGS.next}: ${STRINGS.configureDataCube}`} disabled={!clusterSource} onClick={this.onNext.bind(this)}/>
193200
<Button className="cancel" title="Cancel" type="secondary" onClick={onCancel}/>
194201
</div>
195202

src/client/modals/suggestion-modal/suggestion-modal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ export class SuggestionModal<T> extends React.Component<SuggestionModalProps<T>,
183183
className="suggestion-modal"
184184
title={`${title}`}
185185
onClose={onClose}
186+
onEnter={this.onAdd.bind(this)}
186187
>
187188
<div className="actions">
188189
<button key='all' onClick={this.selectAll.bind(this)}>Select all</button>

0 commit comments

Comments
 (0)