Skip to content

Commit

Permalink
Merge pull request #232 from Kitware/refactor-pyfr
Browse files Browse the repository at this point in the history
fix(PyFr): Refactor PyFr code base to share as much as possible compo…
  • Loading branch information
TristanWright committed Mar 14, 2016
2 parents fdfac5c + d9d26c8 commit 63177eb
Show file tree
Hide file tree
Showing 24 changed files with 140 additions and 78,323 deletions.
77,908 changes: 69 additions & 77,839 deletions dist/HPCCloud.js

Large diffs are not rendered by default.

29 changes: 15 additions & 14 deletions src/panels/run/RunCluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import style from 'HPCCloudStyle/ItemEditor.mcss';
import theme from 'HPCCloudStyle/Theme.mcss';

export default React.createClass({
displayName: 'run/cluster',
displayName: 'panels/run/RunCluster',

propTypes: {
contents: React.PropTypes.object,
Expand All @@ -28,20 +28,21 @@ export default React.createClass({
updateState() {
this.setState({ busy: true });
client.listClusterProfiles()
.then(resp => {
this.setState({
profiles: resp.data,
profile: resp.data[0],
busy: false,
.then(
resp => {
this.setState({
profiles: resp.data,
profile: resp.data[0],
busy: false,
});
if (this.props.onChange) {
this.props.onChange('profile', resp.data[0]._id, 'Traditional');
}
},
err => {
console.log('Error: Sim/RunCluster', err);
this.setState({ busy: false });
});
if (this.props.onChange) {
this.props.onChange('profile', resp.data[0]._id, 'Traditional');
}
})
.catch(err => {
console.log('Error: Sim/RunCluster', err);
this.setState({ busy: false });
});
},

dataChange(event) {
Expand Down
4 changes: 2 additions & 2 deletions src/workflows/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CodeSaturn from './code-saturn';
import PyFr from './pyfr';
import PyFrExec from './pyfr-exec';
import PyFr from './pyfr/pyfr-simput';
import PyFrExec from './pyfr/pyfr-exec';
import Visualizer from './visualizer';

export default {
Expand Down
14 changes: 0 additions & 14 deletions src/workflows/pyfr-exec/components/steps/Introduction/index.js

This file was deleted.

129 changes: 0 additions & 129 deletions src/workflows/pyfr-exec/components/steps/Visualization/View/index.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import formStyle from 'HPCCloudStyle/ItemEditor.mcss';
import React from 'react';
import deepEquals from 'mout/src/lang/deepEquals';
import formStyle from 'HPCCloudStyle/ItemEditor.mcss';

const TYPES = {
cuda: 'Cuda',
Expand All @@ -23,11 +24,10 @@ export default React.createClass({
},

componentWillReceiveProps(nextProps) {
const { type, types } = this.getStateFromProps(nextProps);
const { type, types, profile } = this.getStateFromProps(nextProps);

if (types.indexOf(this.state.type) === -1) {
this.setState({ type, types });
const profile = this.props.profiles[type][0] ? this.props.profiles[type][0].name : '';
this.setState({ type, types, profile });
this.updateBackend(type, profile, this.state.device);
} else {
this.setState({ types });
Expand All @@ -37,6 +37,7 @@ export default React.createClass({

getStateFromProps(props) {
let type = '';
let profile = '';
const types = [];

if (props.profiles) {
Expand All @@ -47,13 +48,15 @@ export default React.createClass({
if (props.profiles.opencl && props.profiles.opencl.length) {
type = 'opencl';
types.push(type);
profile = props.profiles.opencl[0].name;
}
if (props.profiles.openmp && props.profiles.openmp.length) {
type = 'openmp';
types.push(type);
profile = props.profiles.openmp[0].name;
}
}
return { type, types };
return { type, types, profile };
},

updateActiveType(event) {
Expand All @@ -77,6 +80,10 @@ export default React.createClass({
},

updateBackend(type, profile, device) {
if (!type) {
return;
}

const backend = { type };
if (type === 'cuda') {
backend['device-id'] = device;
Expand All @@ -87,7 +94,10 @@ export default React.createClass({
}
}
if (this.props.onChange) {
this.props.onChange(backend);
if (!deepEquals(this.state.backend, backend)) {
this.setState({ backend });
this.props.onChange(backend);
}
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const staticContent = require('./content.html');

export default React.createClass({

displayName: 'StaticContent',
displayName: 'pyfr/common/steps/Introduction',

/* eslint-disable react/no-danger */
render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import RunEC2 from '../../../../../../panels/run/RunEC2';
import RunCluster from '../../../../../../panels/run/RunCluster';
import RunOpenStack from '../../../../../../panels/run/RunOpenStack';
import ButtonBar from '../../../../../../panels/ButtonBar';
import RuntimeBackend from '../../../helpers/RuntimeBackend';
import RuntimeBackend from '../../../panels/RuntimeBackend';

import client from '../../../../../../network';
import deepClone from 'mout/src/lang/deepClone';
Expand All @@ -14,7 +14,7 @@ import formStyle from 'HPCCloudStyle/ItemEditor.mcss';

export default React.createClass({

displayName: 'pyfr-exec/start-sim',
displayName: 'pyfr/common/steps/Simulation/Start',

propTypes: {
location: React.PropTypes.object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ACTIONS = {
};

export default React.createClass({
displayName: 'pyfr/view-simulation',
displayName: 'pyfr/common/steps/Simulation/View',

propTypes: {
location: React.PropTypes.object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import formStyle from 'HPCCloudStyle/ItemEditor.mcss';

export default React.createClass({

displayName: 'pyfr-exec/run-viz',
displayName: 'pyfr/common/steps/Visualization/Start',

propTypes: {
location: React.PropTypes.object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const ACTIONS = {
};

export default React.createClass({
displayName: 'pyfr-exec/view-viz',
displayName: 'pyfr/common/steps/Visualization/View',

propTypes: {
location: React.PropTypes.object,
Expand Down
16 changes: 0 additions & 16 deletions src/workflows/pyfr/components/steps/Introduction/content.html

This file was deleted.

Loading

0 comments on commit 63177eb

Please sign in to comment.