mirror of
https://github.com/simonw/datasette.git
synced 2026-06-23 09:14:34 +02:00
Use label column in 'Inserted X' messages
This commit is contained in:
parent
e91c646ee6
commit
a7cd746613
1 changed files with 12 additions and 2 deletions
|
|
@ -475,6 +475,14 @@ function rowTitleLabel(row) {
|
|||
return row.getAttribute("data-row-label") || "";
|
||||
}
|
||||
|
||||
function insertedRowStatusMessage(rowId, rowLabel) {
|
||||
var message = "Inserted row " + rowId;
|
||||
if (rowLabel && rowLabel !== rowId) {
|
||||
message += " (" + rowLabel + ")";
|
||||
}
|
||||
return message + ".";
|
||||
}
|
||||
|
||||
function tableBaseUrl() {
|
||||
var tableUrl =
|
||||
window._datasetteTableData && window._datasetteTableData.tableUrl;
|
||||
|
|
@ -1201,8 +1209,6 @@ async function saveRowEditDialog(state) {
|
|||
|
||||
state.currentRowId = insertedRowId;
|
||||
state.currentFragmentUrl = rowFragmentUrlById(insertedRowId);
|
||||
var insertedStatusMessage =
|
||||
"Inserted row " + tildeDecode(insertedRowId) + ".";
|
||||
var insertedRow = null;
|
||||
try {
|
||||
insertedRow = await fetchUpdatedRowElement(state);
|
||||
|
|
@ -1217,6 +1223,10 @@ async function saveRowEditDialog(state) {
|
|||
return;
|
||||
}
|
||||
if (insertedRow) {
|
||||
var insertedStatusMessage = insertedRowStatusMessage(
|
||||
tildeDecode(insertedRowId),
|
||||
rowTitleLabel(insertedRow),
|
||||
);
|
||||
var addedRow = addInsertedRowToPage(insertedRow);
|
||||
state.dialog.close();
|
||||
showRowMutationStatus(state.manager, insertedStatusMessage, false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue