From 0d628f57bbdde849cef0cd8251056b139c0a162c Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Sat, 25 Jul 2015 13:58:26 -0700 Subject: [PATCH] move jobs flux, use createClass for react --- common/app/routes/Jobs/components/Actions.js | 15 ------- common/app/routes/Jobs/components/Jobs.jsx | 46 ++++++++++---------- common/app/routes/Jobs/components/List.jsx | 14 +++--- common/app/routes/Jobs/components/Store.js | 9 ---- common/app/routes/Jobs/flux/Actions.js | 11 +++++ common/app/routes/Jobs/flux/Store.js | 8 ++++ 6 files changed, 47 insertions(+), 56 deletions(-) delete mode 100644 common/app/routes/Jobs/components/Actions.js delete mode 100644 common/app/routes/Jobs/components/Store.js create mode 100644 common/app/routes/Jobs/flux/Actions.js create mode 100644 common/app/routes/Jobs/flux/Store.js diff --git a/common/app/routes/Jobs/components/Actions.js b/common/app/routes/Jobs/components/Actions.js deleted file mode 100644 index b590678e30..0000000000 --- a/common/app/routes/Jobs/components/Actions.js +++ /dev/null @@ -1,15 +0,0 @@ -import { Actions } from 'thundercats'; - -export default class JobsActions extends Actions { - constructor() { - super(); - } - static displayName = 'JobsActions' - - getJob(id) { - return { id }; - } - getJobs(params) { - return { params }; - } -} diff --git a/common/app/routes/Jobs/components/Jobs.jsx b/common/app/routes/Jobs/components/Jobs.jsx index 4725abc09c..87546ba570 100644 --- a/common/app/routes/Jobs/components/Jobs.jsx +++ b/common/app/routes/Jobs/components/Jobs.jsx @@ -1,28 +1,26 @@ import React, { PropTypes } from 'react'; -import { createContainer } from 'thundercats'; +import { contain } from 'thundercats'; import { Grid, Row } from 'react-bootstrap'; -@createContainer({ - store: 'JobsStore' -}) -export default class extends React.Component { - constructor(props) { - super(props); - } +export default contain( + { + store: 'jobsStore', + actions: 'jobActions' + }, + React.createClass({ + displayName: 'Jobs', + propTypes: { + jobs: PropTypes.array + }, - - static displayName = 'Jobs' - static propTypes = { - jobs: PropTypes.array - } - - render() { - return ( - - - foo - - - ); - } -} + render() { + return ( + + + foo + + + ); + } + }) +); diff --git a/common/app/routes/Jobs/components/List.jsx b/common/app/routes/Jobs/components/List.jsx index 7eccffbe05..946a8380bd 100644 --- a/common/app/routes/Jobs/components/List.jsx +++ b/common/app/routes/Jobs/components/List.jsx @@ -1,13 +1,11 @@ import React, { PropTypes } from 'react'; -export default class extends React.Component { - constructor(props) { - super(props); - } - - static displayName = 'JobsList' - static propTypes = {} +export default React.createClass({ + displayName: 'JobsList', + propTypes: { + foo: PropTypes.string + }, render() { return null; } -} +}); diff --git a/common/app/routes/Jobs/components/Store.js b/common/app/routes/Jobs/components/Store.js deleted file mode 100644 index 6c022f4773..0000000000 --- a/common/app/routes/Jobs/components/Store.js +++ /dev/null @@ -1,9 +0,0 @@ -import { Store } from 'thundercats'; - -export default class JobsStore extends Store { - constructor(cat) { - super(); - let JobsActions = cat.getActions('JobsActions'); - } - static displayName = 'JobsStore' -} diff --git a/common/app/routes/Jobs/flux/Actions.js b/common/app/routes/Jobs/flux/Actions.js new file mode 100644 index 0000000000..479b2fdbf5 --- /dev/null +++ b/common/app/routes/Jobs/flux/Actions.js @@ -0,0 +1,11 @@ +import { Actions } from 'thundercats'; + +export default Actions({ + getJob(id) { + return { id }; + }, + getJobs(params) { + return { params }; + } +}) + .refs({ displayName: 'JobsActions' }); diff --git a/common/app/routes/Jobs/flux/Store.js b/common/app/routes/Jobs/flux/Store.js new file mode 100644 index 0000000000..aa71d71197 --- /dev/null +++ b/common/app/routes/Jobs/flux/Store.js @@ -0,0 +1,8 @@ +import { Store } from 'thundercats'; + +export default Store() + .refs({ displayName: 'JobsStore' }) + .init(({ instane: jobsStore, args: [cat] }) => { + let jobsActions = cat.getActions('JobsActions'); + jobsStore.register(jobsActions); + });