Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: add portal configuration interface #929

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

imadbourouche
Copy link
Member

Context

What's new

Adding an interface for the admin of the portals to change the configurations of their portal (or Catalog) in the context of the MOD-API implementation. This interface will use the / route in the backend

Screenshot

image

attribute_to_delete = ["context", "links", "@id", "@type"]
attribute_to_not_modify = ["id", "federated_portals", "fundedBy", "keyword", "numberOfArtefacts", "metrics", "numberOfClasses", "numberOfIndividuals", "numberOfProperties", "numberOfAxioms", "numberOfObjectProperties", "numberOfDataProperties", "numberOfLabels", "numberOfDeprecated", "numberOfUsingProjects", "numberOfEndorsements", "numberOfMappings", "numberOfUsers", "numberOfAgents" ]
root_url = "#{rest_url}/?display=all"
attributes_catalog = LinkedData::Client::HTTP.get(root_url, {display: :all})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to create a model in the UI, see the existent to get inspiration https://github.com/ontoportal-lirmm/ontologies_api_ruby_client/tree/master/lib/ontologies_api_client/models
With you can use
your_model.get
your_model.update

@@ -0,0 +1,25 @@
- if flash[:notice]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this file called ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it called from this function

https://github.com/ontoportal-lirmm/bioportal_web_ui/pull/929/files#diff-b2b7b0a62c7bcca1112e0e0b7577d9a38a3ed1c191487ef4d3ca9526e7444a73R285

def change_portal_config
    config_params = params.except(:controller, :action, :format, :authenticity_token, :commit)
    root_url = "#{rest_url}/"
    begin
      response = LinkedData::Client::HTTP.patch(root_url, JSON.parse(config_params.to_json))
      if response.success?
        flash[:notice] = 'Configuration updated successfully'
      else
        flash[:alert] = "Update failed: #{response.body}"
      end
    rescue StandardError => e
      flash[:error] = "An error occurred: #{e.message}"
    end

  end

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok, you did the rendering in the helper function.
move the render to the controller action it is the normal way of doing in Rails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants