diff --git a/assets/js/build-min.js b/assets/js/build-min.js index 49f2352a..7dfa37df 100644 --- a/assets/js/build-min.js +++ b/assets/js/build-min.js @@ -155,7 +155,8 @@ if(data.builderResponseData.operation!='delete'){$masterTabPane.find('input[name this.updateMasterTabIdAndTitle($masterTabPane,data.builderResponseData) this.unhideFormDeleteButton($masterTabPane) this.getTableList().fileList('markActive',data.builderResponseData.tabId) -this.getIndexController().unchangeTab($masterTabPane)} +this.getIndexController().unchangeTab($masterTabPane) +this.updateTable(data.builderResponseData)} else{this.forceCloseTab($masterTabPane)} $.oc.builder.dataRegistry.clearCache(data.builderResponseData.pluginCode,'model-columns')} DatabaseTable.prototype.getTableList=function(){return $('#layout-side-panel form[data-content-id=database] [data-control=filelist]')} @@ -178,6 +179,9 @@ tableObj.addRecord('bottom',true) tableObj.setRowValues(currentData.length-1,rowData) tableObj.addRecord('bottom',false) tableObj.deleteRecord()} +DatabaseTable.prototype.updateTable=function(data){var tabsObject=this.getMasterTabsObject(),tabs=$('#builder-master-tabs').data('oc.tab'),tab=tabs.findByIdentifier(data.tabId) +tabsObject.updateTab(tab,data.tableName,data.tab) +this.onTableLoaded()} $.oc.builder.entityControllers.databaseTable=DatabaseTable;}(window.jQuery);+function($){"use strict";if($.oc.builder===undefined) $.oc.builder={} if($.oc.builder.entityControllers===undefined) diff --git a/assets/js/builder.index.entity.databasetable.js b/assets/js/builder.index.entity.databasetable.js index 0802fb78..a2afaa40 100644 --- a/assets/js/builder.index.entity.databasetable.js +++ b/assets/js/builder.index.entity.databasetable.js @@ -218,6 +218,8 @@ this.getTableList().fileList('markActive', data.builderResponseData.tabId) this.getIndexController().unchangeTab($masterTabPane) + + this.updateTable(data.builderResponseData) } else { this.forceCloseTab($masterTabPane) @@ -295,6 +297,15 @@ tableObj.deleteRecord() } + DatabaseTable.prototype.updateTable = function(data) { + var tabsObject = this.getMasterTabsObject(), + tabs = $('#builder-master-tabs').data('oc.tab'), + tab = tabs.findByIdentifier(data.tabId) + + tabsObject.updateTab(tab, data.tableName, data.tab) + this.onTableLoaded() + } + // REGISTRATION // ============================ diff --git a/behaviors/IndexDatabaseTableOperations.php b/behaviors/IndexDatabaseTableOperations.php index 41d5bb3b..5e976d85 100644 --- a/behaviors/IndexDatabaseTableOperations.php +++ b/behaviors/IndexDatabaseTableOperations.php @@ -103,13 +103,21 @@ public function onDatabaseTableMigrationApply() $this->controller->widget->versionList->refreshActivePlugin() ); + $widget = $this->makeBaseFormWidget($table); + $this->vars['tableName'] = $table; + $result['builderResponseData'] = [ 'builderObjectName'=>$table, 'tabId' => $this->getTabId($table), 'tabTitle' => $table, 'tableName' => $table, 'operation' => $operation, - 'pluginCode' => $pluginCode->toCode() + 'pluginCode' => $pluginCode->toCode(), + 'tab' => $this->makePartial('tab', [ + 'form' => $widget, + 'pluginCode' => $this->getPluginCode()->toCode(), + 'tableName' => $table + ]) ]; return $result; diff --git a/classes/MigrationModel.php b/classes/MigrationModel.php index d0e693fd..6bfceb02 100644 --- a/classes/MigrationModel.php +++ b/classes/MigrationModel.php @@ -11,6 +11,7 @@ use ValidationException; use SystemException; use Exception; +use Throwable; /** * Manages plugin migrations @@ -133,12 +134,12 @@ public function save($executeOnSave = true) VersionManager::instance()->updatePlugin($this->getPluginCodeObj()->toCode(), $this->version); } } - catch (Exception $ex) { - // Remove the script file, and rollback + catch (Throwable $e) { + // Remove the script file, and rollback // the version.yaml. $this->rollbackSaving($originalVersionData, $originalFileContents); - throw $ex; + throw $e; } $this->originalVersion = $this->version; diff --git a/classes/migrationmodel/fields.yaml b/classes/migrationmodel/fields.yaml index 42184013..cff6f49e 100644 --- a/classes/migrationmodel/fields.yaml +++ b/classes/migrationmodel/fields.yaml @@ -5,7 +5,5 @@ fields: label: rainlab.builder::lang.migration.field_description code: label: rainlab.builder::lang.migration.field_code - commentAbove: rainlab.builder::lang.migration.field_code_comment type: codeeditor language: php - readOnly: true \ No newline at end of file diff --git a/lang/cs/lang.php b/lang/cs/lang.php index 47c44046..1758c530 100644 --- a/lang/cs/lang.php +++ b/lang/cs/lang.php @@ -573,7 +573,6 @@ 'field_version' => 'Verze', 'field_description' => 'Popis migrace', 'field_code' => 'Kód migrace', - 'field_code_comment' => 'Kód migrace je pouze pro čtení a slouží pouze pro náhled. Vlastní migraci můžete vytvořit v sekci Verze v levém menu.', 'save_and_apply' => 'Uložit a aplikovat', 'error_version_exists' => 'Tato verze migrace již existuje.', 'error_script_filename_invalid' => 'The migration script file name can contain only Latin letters, digits and underscores. The name should start with a Latin letter and could not contain spaces.', diff --git a/lang/en/lang.php b/lang/en/lang.php index 8e1b8335..397a3e95 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -636,7 +636,6 @@ 'field_version' => 'Version', 'field_description' => 'Description', 'field_code' => 'Code', - 'field_code_comment' => 'The migration code is read-only and for the preview purpose only. You can create custom migrations manually in the Versions section of the Builder.', 'save_and_apply' => 'Save & Apply', 'error_version_exists' => 'The migration version already exists.', 'error_script_filename_invalid' => 'The migration script file name can contain only Latin letters, digits and underscores. The name should start with a Latin letter and could not contain spaces.', diff --git a/lang/es/lang.php b/lang/es/lang.php index ccf3d44d..47626c0a 100644 --- a/lang/es/lang.php +++ b/lang/es/lang.php @@ -589,7 +589,6 @@ 'field_version' => 'Versión', 'field_description' => 'Descripción', 'field_code' => 'Code', - 'field_code_comment' => 'The migration code is read-only and for the preview purpose only. You can create custom migrations manually in the Versions section of the Builder.', 'save_and_apply' => 'Salvar y Aplicar', 'error_version_exists' => 'The migration version already exists.', 'error_script_filename_invalid' => 'The migration script file name can contain only Latin letters, digits and underscores. The name should start with a Latin letter and could not contain spaces.', diff --git a/lang/fa/lang.php b/lang/fa/lang.php index d82ed8d6..9269751e 100644 --- a/lang/fa/lang.php +++ b/lang/fa/lang.php @@ -574,7 +574,6 @@ 'field_version' => 'ویرایش', 'field_description' => 'توضیحات', 'field_code' => 'کد', - 'field_code_comment' => 'کد ساختار بانک اطلاعاتی فقط خواندنی و فقط جهت پیش نمایش می باشد. شما میتوانید ساختار بانک اطلاعاتی سفارشی را به صورت دستی در بخش ویرایش ها ایجاد نمایید.', 'save_and_apply' => 'ذخیره و اعمال', 'error_version_exists' => 'فایل ساختار بانک اطلاعاتی قبلا تعریف شده است.', 'error_script_filename_invalid' => 'نام فایل ساختار بانک اطلاعاتی فقط میتواند حاوی حروف لاتین، اعداد و خط زیر باشد و با یک حرف لاتین بزرگ شروع شود.', diff --git a/lang/nl/lang.php b/lang/nl/lang.php index 699c61aa..37a8cad2 100644 --- a/lang/nl/lang.php +++ b/lang/nl/lang.php @@ -590,7 +590,6 @@ 'field_version' => 'Versie', 'field_description' => 'Omschrijving', 'field_code' => 'Code', - 'field_code_comment' => 'De migratie-code in alleen-lezen en alleen voor voorbeeldweergave. Je kan handmatig migraties aanmaken in het Versies onderdeel van Builder.', 'save_and_apply' => 'Opslaan & toepassen', 'error_version_exists' => 'De migratie-versie bestaat reeds.', 'error_script_filename_invalid' => 'De bestandsnaam van de migratie kan alleen letters, getallen en underscores bevatten. De naam moet beginnen met een letter en mag geen spaties bevatten.', diff --git a/lang/pt-br/lang.php b/lang/pt-br/lang.php index 9b9527cc..9a10e55f 100644 --- a/lang/pt-br/lang.php +++ b/lang/pt-br/lang.php @@ -615,7 +615,6 @@ 'field_version' => 'Versão', 'field_description' => 'Descrição', 'field_code' => 'Código', - 'field_code_comment' => 'O código da migration é apenas leitura e apenas para o propósito de preview. Você pode criar migrations customizadas manualmente na seção Versões do Builder.', 'save_and_apply' => 'Salvar e aplicar', 'error_version_exists' => 'A versão da migration já existe.', 'error_script_filename_invalid' => 'O nome do arquivo de script do migration pode conter apenas letras latinas, números e underlines. O nome deve começar com uma letra latina e não pode conter espaços.',