-
Notifications
You must be signed in to change notification settings - Fork 18
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
Generic javascript template support design #7
Comments
This looks great. A couple comments:
|
I'll take a look at your WIP PR tonight or tomorrow, which I'm sure will help answer some of these questions. |
Answers to questions:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Documenting what we talked about yesterday (Dan) and what I plan on implementing.
Django Model:
TaskType
Responsibility
Responsible for storing all information for a new task type. This will be exposed via a json api to support dynamic/runtime creation of new task types which are then stored in the database.
Fields
name
: common string name of task type (eg. Image Recognition, Entity Resolution)iterator_template
:TemplateResource
instance for point iterator,type=iterator_template
point_template
:TemplateResource
instance for a point,type=point_template
renderer
: html/css/js code inserted into<body>
which utilizes js variables to render the taskdependencies
: alias for getting a list of dependencies from the prior three fields. The resources for iterator_template, point_template, and renderer are brought in as wellDjango Model:
TemplateResource
Responsibility
Contains html/css/js which is injected into the the template. The purpose is to have a set of composable resources representing javascript dependencies
Fields
name
content
type
: value from [point_template
,iterator_template
,resource
,renderer
]dependencies
: List ofTemplateResource
s this one needs and pulls these inrequirements
: List ofTemplateResources
that must be present, but will not import if they don't exist, instead error out. This is helpful to enforce for example that a given "iterator_template" requires therenderer
to support its assumed frontend framework (egreact
)point_template
-> js string variable in<head>
,iterator_template
-> js string variable in<head>
,resource
-> renders as html into<head>
,renderer
-> rendered as html into<body>
Django Template
content
from Task and injects it as a javascript variable to the django template.iterator_template
as a javascript string into<head>
point_template
as javascript string into<head>
dependencies
into<html>
depending on its type.renderer
into<body>
Features
TaskType
allows for creation of new task types dynamically which are stored in the database.TaskType
defines fields for the basic abstraction boundaries: how to render a point given its data, how to render a list of points given its data. It further allows for those to be rendered in any container (via renderer)renderer
becomes just plain html code (perhaps with javascript injecting answers in to make it useful).Template inheritance
For the first initial templates, I plan on making these based on ReactJS. Due to the implementation above, they are separate from implementation, so the ability to use inheritance is a function of being able to do that in React. This is fully supported and is a mean component of React so I don't see problems with this. The primary difference is that the responsibility to support inheritance is pushed from
ampcrowd
to the frontend user generated code and we provide reasonable default templates users can use or trash.The text was updated successfully, but these errors were encountered: