diff --git a/src/components/ProjectList.jsx b/src/components/ProjectList.jsx
index e1ff54e5..6394a6c8 100644
--- a/src/components/ProjectList.jsx
+++ b/src/components/ProjectList.jsx
@@ -11,6 +11,19 @@ function ProjectListItem(props) {
return(
{props.project.display_name}
+ Workflows
+
+ {props.project.links.workflows.map(workflow => {
+ return (
+ -
+
+ {workflow}
+
+
+ );
+ })}
+
+
);
}
@@ -22,7 +35,7 @@ class ProjectList extends Component {
Projects
- {projects.data.map(project => )}
+ {projects.data.map(project => )}
);
diff --git a/src/components/WorkflowContents.jsx b/src/components/WorkflowContents.jsx
new file mode 100644
index 00000000..b89d6695
--- /dev/null
+++ b/src/components/WorkflowContents.jsx
@@ -0,0 +1,33 @@
+import React, { Component } from 'react';
+import PropTypes from 'prop-types';
+import fixIt, { options } from 'react-fix-it';
+
+const propTypes = {
+ contents: PropTypes.object.isRequired,
+};
+
+options.log = (test) => {
+ console.warn(test);
+};
+
+class WorkflowContents extends Component {
+
+ render() {
+ const { contents } = this.props;
+ const workflow_contents = contents.data.length ? contents.data[0] : {strings: []};
+ console.log(workflow_contents)
+ const strings = [];
+ for (const key in workflow_contents.strings) {
+ strings.push({key} {workflow_contents.strings[key]}
);
+ }
+ return (
+
+
Workflow Contents
+ {strings}
+
+ );
+ }
+}
+
+WorkflowContents.propTypes = propTypes;
+export default fixIt(WorkflowContents);
diff --git a/src/containers/ProjectContentsContainer.jsx b/src/containers/ProjectContentsContainer.jsx
index aefee203..82a3691f 100644
--- a/src/containers/ProjectContentsContainer.jsx
+++ b/src/containers/ProjectContentsContainer.jsx
@@ -27,7 +27,9 @@ class ProjectContentsContainer extends Component {
componentDidMount() {
const { actions } = this.props;
- return actions.fetchProjectContents(this.props.params.project_id);
+ const type = this.props.routes[2].path;
+ const id = type ? this.props.params.resource_id : this.props.params.project_id;
+ return actions.fetchProjectContents(id, type);
}
handleClick(event) {
diff --git a/src/ducks/contents.js b/src/ducks/contents.js
index a6696e07..f36c032e 100644
--- a/src/ducks/contents.js
+++ b/src/ducks/contents.js
@@ -26,13 +26,16 @@ const projectContentsReducer = (state = initialState, action) => {
};
// Action Creators
-const fetchProjectContents = (project_id) => {
+const fetchProjectContents = (id, type) => {
+ type = type ? type.split('/')[0] : 'project';
return (dispatch) => {
dispatch({
type: FETCH_PROJECT_CONTENTS,
});
- const query = { project_id };
- apiClient.type('project_contents').get(query)
+ const key = `${type}_id`;
+ const query = {};
+ query[key] = id;
+ apiClient.type(`${type}_contents`).get(query)
.then((projectContents) => {
dispatch({
type: FETCH_PROJECT_CONTENTS_SUCCESS,
diff --git a/src/ducks/projects.js b/src/ducks/projects.js
index 1c6f6215..249d15c7 100644
--- a/src/ducks/projects.js
+++ b/src/ducks/projects.js
@@ -32,7 +32,8 @@ const fetchProjects = () => {
type: FETCH_PROJECTS,
});
const query = {
- current_user_roles: ['owner', 'translator']
+ current_user_roles: ['owner', 'translator'],
+ include: ['workflows']
}
apiClient.type('projects').get(query)
.then((projects) => {
diff --git a/src/index.jsx b/src/index.jsx
index 0ed70578..f8b00697 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -11,6 +11,7 @@ import configureStore from './store';
import ProjectContentsContainer from './containers/ProjectContentsContainer';
import ProjectContents from './components/ProjectContents';
import ProjectList from './containers/ProjectListContainer';
+import WorkflowContents from './components/WorkflowContents';
// Todo: let's find a better way to include Styles,
// currently Styles looks like an unused var to eslint
@@ -27,6 +28,7 @@ oauth.init(config.panoptesAppId)
+