Skip to content

Commit b7b7b93

Browse files
committed
showing modal Clone menu
1 parent 9705713 commit b7b7b93

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

src/dashboard/Data/Browser/Browser.react.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class Browser extends DashboardView {
127127
this.saveNewRow = this.saveNewRow.bind(this);
128128
this.saveEditCloneRow = this.saveEditCloneRow.bind(this);
129129
this.abortEditCloneRow = this.abortEditCloneRow.bind(this);
130+
this.cancelPendingEditRows = this.cancelPendingEditRows.bind(this);
130131
}
131132

132133
componentWillMount() {
@@ -426,6 +427,12 @@ class Browser extends DashboardView {
426427
this.showEditRowDialog();
427428
}
428429

430+
cancelPendingEditRows() {
431+
this.setState({
432+
editCloneRows: null
433+
});
434+
}
435+
429436
addEditCloneRows(cloneRows) {
430437
this.setState({
431438
editCloneRows: cloneRows
@@ -1225,6 +1232,7 @@ class Browser extends DashboardView {
12251232
onAbortAddRow={this.abortAddRow}
12261233
onSaveEditCloneRow={this.saveEditCloneRow}
12271234
onAbortEditCloneRow={this.abortEditCloneRow}
1235+
onCancelPendingEditRows={this.cancelPendingEditRows}
12281236

12291237
columns={columns}
12301238
className={className}

src/dashboard/Data/Browser/BrowserToolbar.react.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ let BrowserToolbar = ({
4949
uniqueField,
5050
handleColumnDragDrop,
5151
handleColumnsOrder,
52+
editCloneRows,
53+
onCancelPendingEditRows,
5254
order,
5355

5456
enableDeleteAllRows,
@@ -59,6 +61,7 @@ let BrowserToolbar = ({
5961
enableClassManipulation,
6062
}) => {
6163
let selectionLength = Object.keys(selection).length;
64+
let isPendingEditCloneRows = editCloneRows && editCloneRows.length > 0;
6265
let details = [];
6366
if (count !== undefined) {
6467
if (count === 1) {
@@ -103,7 +106,7 @@ let BrowserToolbar = ({
103106
);
104107
} else if (onAddRow) {
105108
menu = (
106-
<BrowserMenu title='Edit' icon='edit-solid' disabled={isUnique}>
109+
<BrowserMenu title='Edit' icon='edit-solid' disabled={isUnique || isPendingEditCloneRows}>
107110
<MenuItem text='Add a row' onClick={onAddRow} />
108111
<MenuItem text='Add a row with modal' onClick={onAddRowWithModal} />
109112
{enableColumnManipulation ? <MenuItem text='Add a column' onClick={onAddColumn} /> : <noscript />}
@@ -249,7 +252,7 @@ let BrowserToolbar = ({
249252
setCurrent={setCurrent}
250253
title="Security"
251254
icon="locked-solid"
252-
disabled={!!relation || !!isUnique}
255+
disabled={!!relation || !!isUnique || isPendingEditCloneRows}
253256
>
254257
<MenuItem text={'Class Level Permissions'} onClick={showCLP} />
255258
<MenuItem text={'Protected Fields'} onClick={showProtected} />
@@ -263,6 +266,16 @@ let BrowserToolbar = ({
263266
<noscript />
264267
)}
265268
{menu}
269+
{editCloneRows && editCloneRows.length > 0 && <div className={styles.toolbarSeparator} />}
270+
{editCloneRows && editCloneRows.length > 0 && (
271+
<BrowserMenu title="Clone" icon="clone-icon">
272+
<MenuItem
273+
text={"Cancel All Pending Rows"}
274+
onClick={onCancelPendingEditRows}
275+
/>
276+
</BrowserMenu>
277+
)}
278+
266279
</Toolbar>
267280
);
268281
};

src/dashboard/Data/Browser/DataBrowser.react.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export default class DataBrowser extends React.Component {
270270
}
271271

272272
render() {
273-
let { className, count, disableSecurityDialog, ...other } = this.props;
273+
let { className, count, disableSecurityDialog, onCancelPendingEditRows, editCloneRows, ...other } = this.props;
274274
const { preventSchemaEdits } = this.context.currentApp;
275275
return (
276276
<div>
@@ -280,6 +280,7 @@ export default class DataBrowser extends React.Component {
280280
editing={this.state.editing}
281281
simplifiedSchema={this.state.simplifiedSchema}
282282
className={className}
283+
editCloneRows={editCloneRows}
283284
handleHeaderDragDrop={this.handleHeaderDragDrop}
284285
handleResize={this.handleResize}
285286
setEditing={this.setEditing}
@@ -301,6 +302,8 @@ export default class DataBrowser extends React.Component {
301302
enableClassManipulation={!preventSchemaEdits}
302303
handleColumnDragDrop={this.handleHeaderDragDrop}
303304
handleColumnsOrder={this.handleColumnsOrder}
305+
editCloneRows={editCloneRows}
306+
onCancelPendingEditRows={onCancelPendingEditRows}
304307
order={this.state.order}
305308
{...other} />
306309

src/icons/clone-icon.svg

Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)