| 120 | }; |
| 121 | |
| 122 | const onSaveClick = () => { |
| 123 | // Do nothing when there is no change or there is an error |
| 124 | if ( |
| 125 | !schemaState._changes || Object.keys(schemaState._changes).length === 0 || |
| 126 | schemaState.errors.name |
| 127 | ) return; |
| 128 | |
| 129 | setSaving(true); |
| 130 | setLoaderText(schemaState.customLoadingText || gettext('Saving...')); |
| 131 | |
| 132 | if (!schema.warningText) { |
| 133 | save(schemaState.changes(true)); |
| 134 | return; |
| 135 | } |
| 136 | |
| 137 | Notifier.confirm( |
| 138 | gettext('Warning'), |
| 139 | schema.warningText, |
| 140 | () => { save(schemaState.changes(true)); }, |
| 141 | () => { |
| 142 | setSaving(false); |
| 143 | setLoaderText(''); |
| 144 | return true; |
| 145 | }, |
| 146 | ); |
| 147 | }; |
| 148 | |
| 149 | const getSQLValue = () => { |
| 150 | // Called when SQL tab is active. |