Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #317: Added feature for multiple deletion of layers #329

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions ide/static/js/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ class Content extends React.Component {
rebuildNet: false,
selectedPhase: 0,
error: [],
multiple_layerId: [],
load: false,
modalIsOpen: false,
totalParameters: 0,
modelConfig: null,
modelFramework: 'caffe'

};
this.addNewLayer = this.addNewLayer.bind(this);
this.changeSelectedLayer = this.changeSelectedLayer.bind(this);
Expand Down Expand Up @@ -89,6 +91,8 @@ class Content extends React.Component {
// Might need to improve the logic of clickEvent
this.clickEvent = false;
this.handleClick = this.handleClick.bind(this);
this.store_list_layers = this.store_list_layers.bind(this);
this.delete_selected_layers = this.delete_selected_layers.bind(this);
}
openModal() {
this.setState({modalIsOpen: true});
Expand Down Expand Up @@ -241,6 +245,27 @@ class Content extends React.Component {
this.setState({ net, selectedLayer: null, nextLayerId: nextLayerId, totalParameters: totalParameters });
}

store_list_layers(layerId){
var stored_list = this.state.multiple_layerId;
stored_list.push(layerId);
this.setState({multiple_layerId: stored_list});
//console.log("Flag1");
}

delete_selected_layers(){
const layers = this.state.multiple_layerId;
layers.forEach(layerId => {
this.deleteLayer(layerId);
});
var multiple_layerId = [];
this.setState({multiple_layerId: multiple_layerId});

}





updateLayerShape(net, layerId) {
const netData = JSON.parse(JSON.stringify(net));
Object.keys(netData[layerId].params).forEach(param => {
Expand Down Expand Up @@ -1053,6 +1078,8 @@ class Content extends React.Component {
copyTrain={this.copyTrain}
trainOnly={this.trainOnly}
updateLayerWithShape={this.modifyLayer}
store_list_layers={this.store_list_layers}
delete_selected_layers={this.delete_selected_layers}
/>
<Tooltip
id={'tooltip_text'}
Expand Down
25 changes: 23 additions & 2 deletions ide/static/js/setParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,27 @@ class SetParams extends React.Component {
disabled={(layer.info.phase === null) && (this.props.selectedPhase === 1) && (data[layer.info.type].learn)}
onClick={() => this.props.deleteLayer(this.props.selectedLayer)}
>
DELETE LAYER
DELETE LAYER
</button>
<button
type="button"
className="btn btn-block deleteLayerButton sidebar-heading"
disabled={(layer.info.phase === null) && (this.props.selectedPhase === 1) && (data[layer.info.type].learn)}
onClick={() => this.props.store_list_layers(this.props.selectedLayer)}
>
SELECT MULTIPLE LAYER
</button>
<button
type="button"
className="btn btn-block deleteLayerButton sidebar-heading"
disabled={(layer.info.phase === null) && (this.props.selectedPhase === 1) && (data[layer.info.type].learn)}
onClick={() => this.props.delete_selected_layers()}
>
DELETE SELECTED LAYERS
</button>



</div>
</div>
);
Expand Down Expand Up @@ -175,7 +194,9 @@ SetParams.propTypes = {
selectedPhase: React.PropTypes.number,
copyTrain: React.PropTypes.func,
changeSelectedLayer: React.PropTypes.func,
updateLayerWithShape: React.PropTypes.func
updateLayerWithShape: React.PropTypes.func,
store_list_layers: React.PropTypes.func,
delete_selected_layers: React.PropTypes.func
};

export default SetParams;