mirror of
				https://github.com/scinote-eln/scinote-web.git
				synced 2025-11-04 21:09:13 +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();
 | 
			
		||||
    json.id = tableNode.attr('id');
 | 
			
		||||
    json.name = tableNode.children('name').text();
 | 
			
		||||
    json.metadata = tableNode.children('metadata').text();
 | 
			
		||||
    contents = hex2a(contents);
 | 
			
		||||
    contents = window.btoa(contents);
 | 
			
		||||
    json.contents = contents;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -137,6 +137,7 @@ class Table < ApplicationRecord
 | 
			
		|||
        contents: contents.encode('UTF-8', 'UTF-8'),
 | 
			
		||||
        team: step.protocol.team,
 | 
			
		||||
        created_by: user,
 | 
			
		||||
        metadata: metadata,
 | 
			
		||||
        last_modified_by: user
 | 
			
		||||
      )
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -100,6 +100,7 @@ module ProtocolsExporterV2
 | 
			
		|||
    "<elnTable id=\"#{table.id}\" guid=\"#{get_guid(table.id)}\">\n" \
 | 
			
		||||
      "<name>#{table.name}</name>\n" \
 | 
			
		||||
      "<contents>#{table.contents.unpack1('H*')}</contents>\n" \
 | 
			
		||||
      "<metadata>#{table.metadata.to_json}</metadata>\n" \
 | 
			
		||||
      "</elnTable>\n"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -144,6 +144,7 @@ class ProtocolsImporterV2
 | 
			
		|||
      table: Table.new(
 | 
			
		||||
        name: params['name'],
 | 
			
		||||
        contents: Base64.decode64(params['contents']),
 | 
			
		||||
        metadata: JSON.parse(params['metadata'] || '{}'),
 | 
			
		||||
        created_by: @user,
 | 
			
		||||
        last_modified_by: @user,
 | 
			
		||||
        team: @team
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue