 ProjectStatus = React.createClass
   displayName: "ProjectStatus"
 
-  getDefaultProps: ->
-    project: null
+  propTypes:
+    project: React.PropTypes.object.isRequired
+
+  getInitialState: ->
+    usedWorkflowLevels: []
+    workflows: []
+
+  getDefaultProps: ->
+    project: null
+
+  componentDidMount: ->
+    getWorkflowsInOrder @props.project, fields: 'display_name,active,configuration'
+      .then (workflows) =>
+        usedWorkflowLevels = @getUsedWorkflowLevels(workflows)
+        @setState usedWorkflowLevels: usedWorkflowLevels, workflows: workflows
+
+  onChangeWorkflowLevel: (workflow, event) ->
+    selected = event.target.value
+    if selected is 'none'
+      workflow.update({ 'configuration.level': undefined })
+    else
+      workflow.update({ 'configuration.level': selected })
+
+    usedWorkflowLevels = @getUsedWorkflowLevels(@state.workflows);
+
+    @setState usedWorkflowLevels: usedWorkflowLevels
+
+  getUsedWorkflowLevels: (workflows) ->
+    usedWorkflowLevels = []
+
+    for workflow in workflows
+      if workflow.configuration.level?
+        usedWorkflowLevels.push(workflow.configuration.level);
+
+    usedWorkflowLevels
 
   render: ->
     <ChangeListener target={@props.project}>{ =>

        <ProjectExperimentalFeatures project={@props.project} />
        <div className="project-status__section">
          <h4>Workflow Settings</h4>
          <PromiseRenderer promise={getWorkflowsInOrder @props.project, fields: 'display_name,active'}>{(workflows) =>
            if workflows.length is 0
              <div className="workflow-status-list">No workflows found</div>
            else
              <div className="workflow-status-list">
                <ul className="project-status__section-list">
                  {workflows.map (workflow) =>
                    <li key={workflow.id}>
                      <WorkflowToggle workflow={workflow} project={@props.project} field="active" />
                    </li>}
                </ul>
             </div>
          }</PromiseRenderer>
        </div>
        <hr />
        <div className="project-status__section">

  'column'
  'grid'
  'invert'
  'workflow level'
]

ProjectToggle = React.createClass
