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

Icon upload feature: static file server so icons can be uploaded and hosted on the ChRIS store #44

Open
3 tasks
jennydaman opened this issue Apr 15, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@jennydaman
Copy link
Collaborator

jennydaman commented Apr 15, 2021

Current Situation

ICON is part of the JSON description specification of a ChRIS plugin [1,2]. It's kind of awkward to have this defined in the Python source code of a ChRIS plugin.

By convention and per documentation, ICON is supposed to be an HTTPS URL to an image file. However, it is not currently used anywhere: All of our plugins (to my knowledge) define ICON as an empty string ("") and neither of our front-ends https://github.com/FNNDSC/ChRIS_ui/ nor https://github.com/FNNDSC/ChRIS_store_ui/ use the icon data.

[1] https://github.com/FNNDSC/cookiecutter-chrisapp/blob/ad4fb567640ae312baad69d9727e5a4ada40970b/%7B%7Bcookiecutter.app_repo_name%7D%7D/%7B%7Bcookiecutter.app_name%7D%7D/%7B%7Bcookiecutter.app_name%7D%7D.py#L92
[2] https://github.com/FNNDSC/chrisapp/blob/1863f2dc6d0b74cf789590e84370890d26e24c7d/chrisapp/base.py#L425

Proposal

ICON should no longer be something defined by the source code of a plugin. Instead, the ChRIS_store backend should provide the functionality to upload and serve icons. For example, one might upload a file like this:

https -a chris:chris1234 -f POST https://chrisstore.co/api/v1/plugins/6/icon/ icon@/home/jenni/my_icon.svg

The ChRIS_store backend will store the uploaded file in OpenStack Swift Object Storage.

The uploaded file will be accessible from:

GET https://chrisstore.co/api/v1/plugins/6/icon/

NOTE: the server should specify MIME type correctly.

An alternative implementation would be for the endpoint /api/v1/plugins/6/icon/ to return something like

{
	"collection": {
		"version": "1.0",
		"href": "https://chrisstore.co/api/v1/plugins/6/icon/",
		"items": [
			{
				"data": [],
				"href": "https://chrisstore.co/api/v1/plugins/6/icon/",
				"links": [
					{
						"rel": "file_resource",
						"value": "https://chrisstore.co/api/v1/uploadedfiles/1/my_icon.svg"
					}
				]
			}
		],
		"links": [],
		"template": {
			"data": [
				{
					"name": "icon",
					"value": ""
				}
			]
		},
		"total": 1
	}
}

The data returned from https://chrisstore.co/api/v1/plugins/6/ should fill in the correct value for icon (a URL to the static file, hosted on the backend).

The front-end(s) should make use of these icons.

Tasks

  • allow the icon field to be optional when uploading a plugin
  • upload icon file functionality
  • serving icon file functionality
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant