Fix step table renaming [SCI-8216]

This commit is contained in:
Oleksii Kriuchykhin 2023-03-28 16:03:45 +02:00
parent 0beb64511d
commit ee7abc2912
2 changed files with 16 additions and 15 deletions

View file

@ -27,7 +27,7 @@ module StepElements
ActiveRecord::Base.transaction do
@table.assign_attributes(table_params.except(:metadata))
begin
@table.metadata = JSON.parse(table_params[:metadata])
@table.metadata = JSON.parse(table_params[:metadata]) if table_params[:metadata].present?
rescue JSON::ParserError
@table.metadata = {}
end

View file

@ -156,8 +156,13 @@
updateTable() {
if (this.editingTable == false) return;
this.update();
this.editingTable = false;
},
update() {
this.element.attributes.orderable.contents = JSON.stringify({ data: this.tableObject.getData() });
this.element.attributes.orderable.metadata = JSON.stringify({ cells: this.tableObject.getCellsMeta().map(
this.element.attributes.orderable.metadata = JSON.stringify({
cells: this.tableObject.getCellsMeta().map(
(x) => {
if (x) {
return {
@ -170,10 +175,6 @@
}
}).filter(e => { return e !== null })
});
this.update();
this.editingTable = false;
},
update() {
this.$emit('update', this.element)
},
loadTableData() {