diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 53b554cf52..84a25b2c08 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -732,6 +732,11 @@ def publish_to_csh end identifier = JSON.parse(JSON.parse(endpoints.to_json)["endpoint"])["resource"]["identifier"] + em = @project.extended_metadata + jem = JSON.parse(em.json_metadata) + jem['Resource_identifier_Project'] = identifier + em.update_column(:json_metadata, jem.to_json) + flash[:notice] = "#{t('project')} was successfully published with ID #{identifier}." respond_to do |format| #@project.reload diff --git a/lib/nfdi4health/csh_client.rb b/lib/nfdi4health/csh_client.rb index 6a544f1043..c271ca0906 100644 --- a/lib/nfdi4health/csh_client.rb +++ b/lib/nfdi4health/csh_client.rb @@ -42,53 +42,53 @@ def handle_restclient_error(e, name_server) when 'get_token' case e.response.code when 400 - 'Bad Request: The server could not understand the request.' + 'Token:CODE400- Bad Request: The server could not understand the request.' when 401 - 'Unauthorized: Access is denied due to invalid credentials.' + 'Token:CODE401- Unauthorized: Access is denied due to invalid credentials.' when 403 - 'Forbidden: You do not have the necessary permissions to access this resource.' + 'Token:CODE403- Forbidden: You do not have the necessary permissions to access this resource.' when 404 - 'Not Found: The requested resource could not be found.' + 'Token:CODE404- Not Found: The requested resource could not be found.' when 500 - 'Internal Server Error: The server encountered an error and could not complete your request.' + 'Token:CODE500- Internal Server Error: The server encountered an error and could not complete your request.' else "An unexpected error occurred: #{e.response}" end when 'send_transforming_api' case e.response.code when 400 - 'Bad Request: The server could not understand the request.' + 'Transorm:CODE400- Bad Request: The server could not understand the request.' when 401 - 'Unauthorized: Access is denied due to invalid credentials.' + 'Transorm:CODE401- Unauthorized: Access is denied due to invalid credentials.' when 403 - 'Forbidden: You do not have the necessary permissions to access this resource.' + 'Transorm:CODE403- Forbidden: You do not have the necessary permissions to access this resource.' when 404 - 'Not Found: The requested resource could not be found.' + 'Transorm:CODE404- Not Found: The requested resource could not be found.' when 500 - 'Internal Server Error: The server encountered an error and could not complete your request.' + 'Transorm:CODE500- Internal Server Error: The server encountered an error and could not complete your request.' else "An unexpected error occurred: #{e.response}" end when 'publish_csh' case e.response.code when 200 - 'No new draft version created because uploaded resource contains no changes' + 'pub_csh:CODE200- No new draft version created because uploaded resource contains no changes' when 400 - 'Bad Request: The server could not understand the request.' + 'pub_csh:CODE400- Bad Request: The server could not understand the request.' when 401 - 'Not allowed to edit resource. User must either be the original creator of the resource or have been added as a collaborator.' + 'pub_csh:CODE401- Not allowed to edit resource. User must either be the original creator of the resource or have been added as a collaborator.' when 403 - 'Forbidden: You do not have the necessary permissions to access this resource.' + 'pub_csh:CODE403- Forbidden: You do not have the necessary permissions to access this resource.' when 404 - 'Not Found: The requested resource could not be found.' + 'pub_csh:CODE404- Not Found: The requested resource could not be found.' when 422 JSON.parse(JSON.parse(e.response.to_json)["message"]) when 500 - 'Internal Server Error: The server encountered an error and could not complete your request.' + 'pub_csh:CODE500- Internal Server Error: The server encountered an error and could not complete your request.' else "An unexpected error occurred: #{e.response}" end end end end -end \ No newline at end of file +end