GithubHelp home page GithubHelp logo

Add Modify Plugin about chris_store_ui HOT 8 OPEN

fnndsc avatar fnndsc commented on September 13, 2024
Add Modify Plugin

from chris_store_ui.

Comments (8)

jennydaman avatar jennydaman commented on September 13, 2024 1

@zrthxn some documentation is here: https://fnndsc.github.io/ChRIS_store/

But more helpful is the API itself. It's designed to be self-documenting in a way. (does it work? you be the judge)

For example:

https https://chrisstore.co/api/v1/20/
HTTP/1.1 200 OK
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Connection: Keep-Alive
Content-Length: 973
Content-Type: application/vnd.collection+json
Date: Thu, 08 Apr 2021 06:54:39 GMT
Keep-Alive: timeout=5, max=100
Server: Apache
Vary: Accept,Cookie
X-Frame-Options: SAMEORIGIN

{
    "collection": {
        "href": "https://chrisstore.co/api/v1/20/",
        "items": [
            {
                "data": [
                    {
                        "name": "id",
                        "value": 20
                    },
                    {
                        "name": "creation_date",
                        "value": "2021-02-08T11:49:15.818028-05:00"
                    },
                    {
                        "name": "modification_date",
                        "value": "2021-02-09T07:44:00.312420-05:00"
                    },
                    {
                        "name": "name",
                        "value": "pl-med2img"
                    },
                    {
                        "name": "title",
                        "value": "A ChRIS plugin app"
                    },
                    {
                        "name": "stars",
                        "value": 0
                    },
                    {
                        "name": "public_repo",
                        "value": "https://github.com/FNNDSC/pl-med2img"
                    },
                    {
                        "name": "license",
                        "value": "MIT"
                    },
                    {
                        "name": "type",
                        "value": "ds"
                    },
                    {
                        "name": "icon",
                        "value": ""
                    },
                    {
                        "name": "category",
                        "value": ""
                    },
                    {
                        "name": "authors",
                        "value": "Arushi Vyas <[email protected]>"
                    },
                    {
                        "name": "documentation",
                        "value": "https://github.com/FNNDSC/pl-med2img"
                    }
                ],
                "href": "https://chrisstore.co/api/v1/20/",
                "links": [
                    {
                        "href": "https://chrisstore.co/api/v1/20/plugins/",
                        "rel": "plugins"
                    },
                    {
                        "href": "https://chrisstore.co/api/v1/users/1/",
                        "rel": "owner"
                    }
                ]
            }
        ],
        "links": [],
        "template": {
            "data": [
                {
                    "name": "public_repo",
                    "value": ""
                },
                {
                    "name": "new_owner",
                    "value": ""
                }
            ]
        },
        "version": "1.0"
    }
}

Take note of these parts:

Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
[...]
        "template": {
            "data": [
                {
                    "name": "public_repo",
                    "value": ""
                },
                {
                    "name": "new_owner",
                    "value": ""
                }
            ]
        },

Piecing it together, such a request would be legal:

https -a <username>:<password> PATCH https://chrisstore.co/api/v1/20/ content-type:application/vnd.collection+json template:='{"data":[{"name": "public_repo", "value": "https://github.com/FNNDSC/pl-med2img"}]}'

The effect is, the plugin's public code repository is changed.

from chris_store_ui.

zrthxn avatar zrthxn commented on September 13, 2024

@mairin I could start working on this if I can get some documentation on the backend API. Also please let me know if there are specific requirements for this

from chris_store_ui.

zrthxn avatar zrthxn commented on September 13, 2024

After creating a test account and creating a sample plugin for testing, whose representation file I copied from the cookiecutter Wiki here, I get the following runtime error when I try to open the Dashboard.

TypeError: DashApplicationType is not a constructor

Screenshot (35)

I haven't modified anything related to the Dashboard yet.
I think this happens because DashApplicationType is a function

const DashApplicationType = (type) => {
  if (type === 'ds') {
    return (<React.Fragment><span className="fa fa-database" /> Data System</React.Fragment>);
  }
  return (<React.Fragment><span className="fa fa-file" /> File System</React.Fragment>);
};

and it's being called with the new keyword.

const applicationType = new DashApplicationType(plugin.type);

Should I modify this or is there something I'm missing here?

from chris_store_ui.

jennydaman avatar jennydaman commented on September 13, 2024

@zrthxn I am getting the same error. Maybe it is a backwards incompatible change with latest version of node. Would you submit a PR for your fix?

from chris_store_ui.

zrthxn avatar zrthxn commented on September 13, 2024

from chris_store_ui.

zrthxn avatar zrthxn commented on September 13, 2024

From the documentation, if I understand correctly, the modifiable fields are

  • public_repo
  • dock_image
  • name
  • descriptor_file

Now there is already a edit modal that is able to edit the public_repo field. I am considering two approaches to this, one which uses the existing modal setup and another that will make more drastic changes.

  1. Using the modal, just add more fields to the modal and change the API call to include those fields. This will be simple but limited in the number of things you can put in the modal.
  2. Changing the CreatePlugin component to PluginEditor, and introduce an intent prop. Based on this the component can either populate the fields with given values if (intent == 'edit') or it can show empty fields if (intent == 'create')

Which dyou think is better and is this the right direction?

from chris_store_ui.

jennydaman avatar jennydaman commented on September 13, 2024

I don't see where in the documentation page it says that descriptor_file, name, or dock_image is modifiable. Neither do I think these should be modifiable.

Using the edit modal would be easier to implement, I believe. The 'intent' idea would be great, but at the moment we have too much first to figure out.

Perhaps I should have studied this issue a bit before having you take it up, since the edit modal allows for editing of the only editable field (aside from "owner," which is a bit special). I will ask @jbernal0019, our backend developer, how to proceed.

The "intent" idea might be worthwhile to pursue. If you were to implement the feature, uneditable fields such as name should be greyed out. i.e. most things should be greyed out. But the plugin's long description should maybe be editable. Unfortunately the backend does not support the long description yet.

from chris_store_ui.

zrthxn avatar zrthxn commented on September 13, 2024

I don't see where in the documentation page it says that descriptor_file, name, or dock_image is modifiable. Neither do I think these should be modifiable.

I saw them being sent in the "template" field and I tried to piece it together from how you had described it. I think that was wrong then.

The "intent" idea might be worthwhile to pursue. If you were to implement the feature, uneditable fields such as name should be greyed out. i.e. most things should be greyed out. But the plugin's long description should maybe be editable. Unfortunately the backend does not support the long description yet.

Yea that's what I had thought of as well.

Perhaps I should have studied this issue a bit before having you take it up, since the edit modal allows for editing of the only editable field (aside from "owner," which is a bit special). I will ask @jbernal0019, our backend developer, how to proceed.

Alright I'll wait for a response from him.

from chris_store_ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.