Fix #16693 - Show the new column and the table structure on the same page

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2021-08-25 17:47:33 +02:00
parent 6019680c6a
commit 157c072c3c
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
2 changed files with 24 additions and 2 deletions

View File

@ -91,12 +91,24 @@ AJAX.registerOnload('table/structure.js', function () {
.show();
Functions.highlightSql($('#page_content'));
$('.result_query .alert-primary').remove();
reloadFieldForm();
if (typeof data.structure_refresh_route !== 'string') {
// Do not reload the form when the code below freshly filled it
reloadFieldForm();
}
$form.remove();
Functions.ajaxRemoveMessage($msg);
Functions.initSlider();
Navigation.reload();
CommonActions.refreshMain('index.php?route=/table/structure');
if (typeof data.structure_refresh_route === 'string') {
// Fetch the table structure right after adding a new column
$.get(data.structure_refresh_route, function (data) {
if (typeof data.success !== 'undefined' && data.success === true) {
$('#page_content').append(data.message).show();
}
});
} else {
CommonActions.refreshMain('index.php?route=/table/structure');
}
} else {
Functions.ajaxShowMessage(data.error, false);
}

View File

@ -159,6 +159,16 @@ class AddFieldController extends AbstractController
Generator::getMessage($message, $sql_query, 'success')
);
// Give an URL to call and use to appends the structure after the success message
$this->response->addJSON(
'structure_refresh_route',
Url::getFromRoute('/table/structure', [
'db' => $db,
'table' => $table,
'ajax_request' => '1',
])
);
return;
}