Skip to content

Commit

Permalink
Merge pull request #231 from Kitware/cluster-pref
Browse files Browse the repository at this point in the history
Cluster pref
  • Loading branch information
jourdain committed Mar 14, 2016
2 parents 5866ef4 + ef6012b commit 8aa8a43
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"history": "1.17.0",
"react-router": "2.0.0",

"paraviewweb": "1.2.15",
"paraviewweb": "1.2.18",
"simput": "1.1.8",
"pvw-visualizer": "1.0.8",

Expand Down
2 changes: 1 addition & 1 deletion src/pages/HPCCloud/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default React.createClass({
<div className={ layout.verticalFlexContainer }>
<div className={ theme.topBar } style={{ position: 'relative' }}>
<div className={ this.state.isBusy ? state.isBusy : '' }>
<Link to="/"><i className={ theme.hpcCloudIcon }></i> HPC</Link>
<Link to="/"><i className={ theme.hpcCloudIcon }></i>+HPC</Link>
</div>

<div className={ theme.progressBar }
Expand Down
23 changes: 19 additions & 4 deletions src/pages/Preferences/Cluster/ClusterForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,28 @@ import React from 'react';
import Workflows from '../../../workflows';
import FormPanel from '../../../panels/FormPanel';

import CollapsibleWidget from 'paraviewweb/src/React/Widgets/CollapsibleWidget';

import style from 'HPCCloudStyle/ItemEditor.mcss';

const preventDefault = (e) => { e.preventDefault(); };

const allConfigs = {};
const wfNames = [];

for (const wfName in Workflows) {
const wf = Workflows[wfName];
allConfigs[wfName] = {};
let foundConfig = false;
if (wf.config && wf.config.cluster) {
for (const propKey in wf.config.cluster) {
allConfigs[propKey] = wf.config.cluster[propKey];
allConfigs[wfName][propKey] = wf.config.cluster[propKey];
foundConfig = true;
}
}
if (foundConfig) {
wfNames.push(wfName);
}
}

export default React.createClass({
Expand Down Expand Up @@ -76,6 +85,8 @@ export default React.createClass({
return null;
}

const sepa = <hr style={{ position: 'relative', top: '-2px' }} />;

return (
<div>
<section className={style.group}>
Expand Down Expand Up @@ -158,9 +169,6 @@ export default React.createClass({
<option value="slurm">SLURM</option>
</select>
</section>
<form onSubmit={ preventDefault }>
<FormPanel config={ allConfigs } style={ style } data={ this.state.data } onChange={ this.mergeData } />
</form>
{ this.state.data.status !== 'running' ? null :
<section className={style.group}>
<label className={style.label}>Public SSH key</label>
Expand Down Expand Up @@ -188,6 +196,13 @@ ssh ${this.state.data.config.ssh.user}@${this.state.data.config.host} \
</section> :
null
}
{ wfNames.map(name =>
<CollapsibleWidget title={ Workflows[name].name } open={ false } key={name} subtitle={ sepa }>
<form onSubmit={ preventDefault }>
<FormPanel config={ allConfigs[name] } style={ style } data={ this.state.data } onChange={ this.mergeData } />
</form>
</CollapsibleWidget>
)}
</div>);
},
});
13 changes: 7 additions & 6 deletions src/pages/Preferences/Cluster/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,13 @@ export default React.createClass({

render() {
const activeData = this.state.active < this.state.clusters.length ? this.state.clusters[this.state.active] : null;
const actions = [{ name: 'removeItem', label: 'Delete', icon: style.deleteIcon }];
if (activeData) {
actions.push(activeData.config.ssh.publicKey && activeData.status !== 'running'
? { name: 'testCluster', label: 'Test', icon: style.testIcon }
: { name: 'saveItem', label: 'Save', icon: style.saveIcon }
);
const actions = [
{ name: 'removeItem', label: 'Delete', icon: style.deleteIcon },
{ name: 'saveItem', label: 'Save', icon: style.saveIcon },
];

if (activeData && activeData.config.ssh.publicKey && activeData.status !== 'running') {
actions.push({ name: 'testCluster', label: 'Test', icon: style.testIcon });
}

updateClusterStatusAsClassPrefix(this.state.clusters);
Expand Down
3 changes: 1 addition & 2 deletions src/panels/FormPanel/CheckboxInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ export default React.createClass({
<section className={style.group}>
<label className={style.label} title={item.description}>{item.label}</label>
<input
className={style.input}
style={{ position: 'relative', top: '-5px' }}
type="checkbox"
checked={ value }
onChange={this.editField}
required
/>
</section>);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,21 @@ export default React.createClass({
},

getInitialState() {
const state = Object.assign({ device: 'round-robin', profile: 'cuda' }, this.getStateFromProps(this.props));
const state = Object.assign({ device: 'round-robin', profile: 'cuda', type: 'cuda' }, this.getStateFromProps(this.props));
this.updateBackend(state.type, state.profile, state.device);
return state;
},

componentWillReceiveProps(nextProps) {
const { type, types } = 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.updateBackend(type, profile, this.state.device);
} else {
this.setState({ types });
this.updateBackend(this.state.type, this.state.profile, this.state.device);
}
},

Expand Down
4 changes: 2 additions & 2 deletions style/PageWithMenu.mcss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
max-width: 300px;
width: 10%;
border-right: solid 1px #ccc;
overflow-y: scroll;
overflow-y: auto;
}

.menu20 {
Expand All @@ -34,7 +34,7 @@
.content {
flex: 1;
height: calc(100vh - 4em - 1px);
overflow-y: scroll;
overflow-y: auto;
}

.addIcon {
Expand Down

0 comments on commit 8aa8a43

Please sign in to comment.