Skip to content

Commit 1f8c5ab

Browse files
author
Ben Thomson
committed
On delete, do not load form for deleted table.
This will gracefully allow the database table editor to close the tab for the deleted table. Fixes #294.
1 parent ad3e401 commit 1f8c5ab

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

behaviors/IndexDatabaseTableOperations.php

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,33 @@ public function onDatabaseTableMigrationApply()
107107
$this->controller->widget->versionList->refreshActivePlugin()
108108
);
109109

110-
$widget = $this->makeBaseFormWidget($table);
111-
$this->vars['tableName'] = $table;
112-
113-
$result['builderResponseData'] = [
114-
'builderObjectName'=>$table,
115-
'tabId' => $this->getTabId($table),
116-
'tabTitle' => $table,
117-
'tableName' => $table,
118-
'operation' => $operation,
119-
'pluginCode' => $pluginCode->toCode(),
120-
'tab' => $this->makePartial('tab', [
121-
'form' => $widget,
122-
'pluginCode' => $this->getPluginCode()->toCode(),
123-
'tableName' => $table
124-
])
125-
];
110+
if ($operation === 'delete') {
111+
$result['builderResponseData'] = [
112+
'builderObjectName' => $table,
113+
'tabId' => $this->getTabId($table),
114+
'tabTitle' => $table,
115+
'tableName' => $table,
116+
'operation' => $operation,
117+
'pluginCode' => $pluginCode->toCode()
118+
];
119+
} else {
120+
$widget = $this->makeBaseFormWidget($table);
121+
$this->vars['tableName'] = $table;
122+
123+
$result['builderResponseData'] = [
124+
'builderObjectName' => $table,
125+
'tabId' => $this->getTabId($table),
126+
'tabTitle' => $table,
127+
'tableName' => $table,
128+
'operation' => $operation,
129+
'pluginCode' => $pluginCode->toCode(),
130+
'tab' => $this->makePartial('tab', [
131+
'form' => $widget,
132+
'pluginCode' => $this->getPluginCode()->toCode(),
133+
'tableName' => $table
134+
])
135+
];
136+
}
126137

127138
return $result;
128139
}

0 commit comments

Comments
 (0)