Skip to content

Commit

Permalink
On delete, do not load form for deleted table.
Browse files Browse the repository at this point in the history
This will gracefully allow the database table editor to close the tab for the deleted table.

Fixes #294.
  • Loading branch information
Ben Thomson committed Aug 22, 2019
1 parent ad3e401 commit 1f8c5ab
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions behaviors/IndexDatabaseTableOperations.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,33 @@ 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(),
'tab' => $this->makePartial('tab', [
'form' => $widget,
'pluginCode' => $this->getPluginCode()->toCode(),
'tableName' => $table
])
];
if ($operation === 'delete') {
$result['builderResponseData'] = [
'builderObjectName' => $table,
'tabId' => $this->getTabId($table),
'tabTitle' => $table,
'tableName' => $table,
'operation' => $operation,
'pluginCode' => $pluginCode->toCode()
];
} else {
$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(),
'tab' => $this->makePartial('tab', [
'form' => $widget,
'pluginCode' => $this->getPluginCode()->toCode(),
'tableName' => $table
])
];
}

return $result;
}
Expand Down

0 comments on commit 1f8c5ab

Please sign in to comment.