mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-27 10:08:11 +08:00
Add step table metadata during import/export and copy [SCI-7948]
This commit is contained in:
parent
ed76fac640
commit
df8579d52f
4 changed files with 4 additions and 0 deletions
|
@ -576,6 +576,7 @@ function importProtocolFromFile(
|
||||||
var contents = tableNode.children('contents').text();
|
var contents = tableNode.children('contents').text();
|
||||||
json.id = tableNode.attr('id');
|
json.id = tableNode.attr('id');
|
||||||
json.name = tableNode.children('name').text();
|
json.name = tableNode.children('name').text();
|
||||||
|
json.metadata = tableNode.children('metadata').text();
|
||||||
contents = hex2a(contents);
|
contents = hex2a(contents);
|
||||||
contents = window.btoa(contents);
|
contents = window.btoa(contents);
|
||||||
json.contents = contents;
|
json.contents = contents;
|
||||||
|
|
|
@ -137,6 +137,7 @@ class Table < ApplicationRecord
|
||||||
contents: contents.encode('UTF-8', 'UTF-8'),
|
contents: contents.encode('UTF-8', 'UTF-8'),
|
||||||
team: step.protocol.team,
|
team: step.protocol.team,
|
||||||
created_by: user,
|
created_by: user,
|
||||||
|
metadata: metadata,
|
||||||
last_modified_by: user
|
last_modified_by: user
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,7 @@ module ProtocolsExporterV2
|
||||||
"<elnTable id=\"#{table.id}\" guid=\"#{get_guid(table.id)}\">\n" \
|
"<elnTable id=\"#{table.id}\" guid=\"#{get_guid(table.id)}\">\n" \
|
||||||
"<name>#{table.name}</name>\n" \
|
"<name>#{table.name}</name>\n" \
|
||||||
"<contents>#{table.contents.unpack1('H*')}</contents>\n" \
|
"<contents>#{table.contents.unpack1('H*')}</contents>\n" \
|
||||||
|
"<metadata>#{table.metadata.to_json}</metadata>\n" \
|
||||||
"</elnTable>\n"
|
"</elnTable>\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,7 @@ class ProtocolsImporterV2
|
||||||
table: Table.new(
|
table: Table.new(
|
||||||
name: params['name'],
|
name: params['name'],
|
||||||
contents: Base64.decode64(params['contents']),
|
contents: Base64.decode64(params['contents']),
|
||||||
|
metadata: JSON.parse(params['metadata'] || '{}'),
|
||||||
created_by: @user,
|
created_by: @user,
|
||||||
last_modified_by: @user,
|
last_modified_by: @user,
|
||||||
team: @team
|
team: @team
|
||||||
|
|
Loading…
Reference in a new issue