feat: batches with dry run, undo, and CSV import and export
- POST /_seo/api/v1/batch runs changes in one transaction: dry_run answers the diff and the conflicts (loops, chains, noindex on a published record, canonicals to redirected or noindex addresses) and rolls back; a refused change refuses the batch (D-12) - undo of a change or a whole batch from History and through MCP, with the undo_stale, undo_loop and undo_gone refusals (D-13) - CSV export and import of redirects, rules and records by URL: BOM, comma or semicolon, formula cells escaped, a dry-run preview, all or nothing with via import; the screen's apply token is HMAC-SHA256 over the file and a fingerprint of the data (transfer.stale) - Import and export singleton with the seo_transfer widget action, History record actions undo and undo_batch, navigation entry - MCP tools undo_change, undo_batch, apply_batch, export_csv, import_csv - TestBatch, TestUndo, TestCSVTransfer, TestLoopRefused mcp and import
This commit is contained in:
24
models/transfer.go
Normal file
24
models/transfer.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
// Transfer is the import and export screen's view of the settings row
|
||||
// (id 1 on golem15_seo_settings, UI-SPEC C13): the CSV delimiter its
|
||||
// footer Save stores. It is not listed in All, because the row's model is
|
||||
// Settings.
|
||||
type Transfer struct {
|
||||
ID uint `gorm:"column:id;primaryKey"`
|
||||
CSVDelimiter string `gorm:"column:csv_delimiter"`
|
||||
UpdatedAt *time.Time `gorm:"column:updated_at"`
|
||||
}
|
||||
|
||||
func (Transfer) TableName() string { return "golem15_seo_settings" }
|
||||
|
||||
// MorphName names the screen's record.
|
||||
func (Transfer) MorphName() string { return `Golem15\SEO\Models\Transfer` }
|
||||
|
||||
// Fillable is the delimiter.
|
||||
func (Transfer) Fillable() []string { return []string{"csv_delimiter"} }
|
||||
|
||||
// Rules is empty: the controller checks the delimiter.
|
||||
func (Transfer) Rules() map[string]string { return map[string]string{} }
|
||||
20
models/transfer/fields.yaml
Normal file
20
models/transfer/fields.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
# Import and export (UI-SPEC C13): the CSV delimiter the footer Save
|
||||
# stores, and the files widget (E6) with the export, the import preview and
|
||||
# the apply, all through the seo_transfer action.
|
||||
fields:
|
||||
csv_delimiter:
|
||||
label: golem15.seo::lang.transfer.delimiter
|
||||
comment: golem15.seo::lang.transfer.delimiter_comment
|
||||
type: dropdown
|
||||
span: left
|
||||
options:
|
||||
',': golem15.seo::lang.transfer.delimiter_comma
|
||||
';': golem15.seo::lang.transfer.delimiter_semicolon
|
||||
|
||||
_transfer:
|
||||
label: golem15.seo::lang.transfer.widget
|
||||
type: widget
|
||||
widget: golem15-seo-transfer
|
||||
action: seo_transfer
|
||||
fill: [csv_delimiter]
|
||||
span: full
|
||||
Reference in New Issue
Block a user