Added task types

This commit is contained in:
2016-09-20 17:39:22 +02:00
parent 959549eec0
commit eb1a972dbb
5 changed files with 19 additions and 3 deletions

View File

@@ -39,3 +39,5 @@ node_type_shot = {
'form_schema': {},
'parent': ['scene']
}
task_types = ['layout', 'animation', 'lighting', 'fx', 'rendering']

View File

@@ -17,7 +17,9 @@ node_type_task = {
'default': 'todo',
'required': True,
},
'task_type': {
'type': 'string',
},
'assigned_to': {
'type': 'dict',
'schema': {

View File

@@ -64,7 +64,8 @@ def setup_for_attract(project_url, replace=False, svn_url=None):
Returns the updated project.
"""
from .node_types import NODE_TYPES
from .node_types import NODE_TYPES, shot
# Copy permissions from the project, then give everyone with PUT
# access also DELETE access.
@@ -116,6 +117,10 @@ def setup_for_attract(project_url, replace=False, svn_url=None):
log.info('Setting SVN URL to %s', svn_url)
attract_props['svn_url'] = svn_url
# Set up task types
task_types = attract_props.setdefault('task_types', {})
task_types.setdefault(shot.node_type_shot['name'], shot.task_types)
_update_project(project)
log.info('Project %s was updated for Attract.', project_url)

View File

@@ -24,7 +24,7 @@ class TaskManager(object):
self._log.info("Task '%s' logged in SVN: %s", task_id, log_entry)
def create_task(self, project):
def create_task(self, project, task_type=None):
"""Creates a new task, owned by the current user.
:rtype: pillarsdk.Node
@@ -45,6 +45,9 @@ class TaskManager(object):
},
)
if task_type:
node_props['properties']['task_type'] = task_type
task = pillarsdk.Node(node_props)
task.create(api=api)
return task
@@ -63,6 +66,7 @@ class TaskManager(object):
task.name = fields.pop('name')
task.description = fields.pop('description')
task.properties.status = fields.pop('status')
task.properties.task_type = fields.pop('task_type', '').strip() or None
self._log.info('Saving task %s', task.to_dict())

View File

@@ -4,6 +4,9 @@ script(src="{{ url_for('static_attract', filename='js/tasks.js') }}",async=true)
.input-group
span.input-group-addon#task-addon-name(title='Name') N
input.form-control(name="name",autofocus=true,type=text,placeholder='Task name',aria-describedby="task-addon-name",value="{{ task.name|hide_none }}")
.input-group
span.input-group-addon#task-addon-type(title='Task type') T
input.form-control(name="task_type",type=text,placeholder='Task type',aria-describedby="task-addon-type",value="{{ task.properties.task_type|hide_none }}")
.input-group
span.input-group-addon#task-addon-description(title='Description') D
textarea.form-control(name="description",type=text,placeholder='Task description',aria-describedby="task-addon-description") {{ task.description|hide_none }}