Commit 18193568 authored by Florian Hübsch's avatar Florian Hübsch
Browse files

Merge pull request #136 from ninjaconcept/136-screen-detail-levels

Screen Detaillevels
parents 7ccee986 2a857b59
......@@ -56,13 +56,15 @@ module Chemotion
requires :sample_detail_level, type: Integer
requires :reaction_detail_level, type: Integer
requires :wellplate_detail_level, type: Integer
requires :screen_detail_level, type: Integer
end
put ':id' do
Collection.find(params[:id]).update({
permission_level: params[:permission_level],
sample_detail_level: params[:sample_detail_level],
reaction_detail_level: params[:reaction_detail_level],
wellplate_detail_level: params[:wellplate_detail_level]
wellplate_detail_level: params[:wellplate_detail_level],
screen_detail_level: params[:screen_detail_level]
})
end
......
......@@ -78,7 +78,7 @@ export default class MySharedCollections extends React.Component {
let collections = this.state.tree.children.filter((child) => {
return child.label
});
let params = {
collections: this.state.tree.children,
deleted_ids: this.state.deleted_ids
......
......@@ -16,10 +16,11 @@ export default class ShareSettingsModal extends React.Component {
node: props.node,
currentUser: currentUser,
users: users,
permissionLevel: 0,
sampleDetailLevel: 0,
reactionDetailLevel: 0,
wellplateDetailLevel: 0
permissionLevel: props.permission_level,
sampleDetailLevel: props.sample_detail_level,
reactionDetailLevel: props.reaction_detail_level,
wellplateDetailLevel: props.wellplate_detail_level,
screenDetailLevel: props.screen_detail_level
}
}
......@@ -50,14 +51,17 @@ export default class ShareSettingsModal extends React.Component {
let sampleDetailLevel = this.refs.sampleDetailLevelSelect.getValue();
let reactionDetailLevel = this.refs.reactionDetailLevelSelect.getValue();
let wellplateDetailLevel = this.refs.wellplateDetailLevelSelect.getValue();
let screenDetailLevel = this.refs.screenDetailLevelSelect.getValue();
let params = {
id: this.state.node.id,
permission_level: permissionLevel,
sample_detail_level: sampleDetailLevel,
reaction_detail_level: reactionDetailLevel,
wellplate_detail_level: wellplateDetailLevel
wellplate_detail_level: wellplateDetailLevel,
screen_detail_level: screenDetailLevel
}
CollectionActions.updateSharedCollection(params);
this.hideModal();
}
......@@ -71,7 +75,8 @@ export default class ShareSettingsModal extends React.Component {
permissionLevel: 4,
sampleDetailLevel: 2,
reactionDetailLevel: 1,
wellplateDetailLevel: 3
wellplateDetailLevel: 3,
screenDetailLevel: 1
});
break;
case 'partner':
......@@ -79,7 +84,8 @@ export default class ShareSettingsModal extends React.Component {
permissionLevel: 1,
sampleDetailLevel: 4,
reactionDetailLevel: 3,
wellplateDetailLevel: 3
wellplateDetailLevel: 3,
screenDetailLevel: 1
});
break;
case 'collaborator':
......@@ -87,7 +93,8 @@ export default class ShareSettingsModal extends React.Component {
permissionLevel: 0,
sampleDetailLevel: 1,
reactionDetailLevel: 1,
wellplateDetailLevel: 1
wellplateDetailLevel: 1,
screenDetailLevel: 0
});
break;
case 'reviewer':
......@@ -95,7 +102,8 @@ export default class ShareSettingsModal extends React.Component {
permissionLevel: 0,
sampleDetailLevel: 2,
reactionDetailLevel: 3,
wellplateDetailLevel: 2
wellplateDetailLevel: 2,
screenDetailLevel: 1
});
break;
case 'supervisor':
......@@ -103,7 +111,8 @@ export default class ShareSettingsModal extends React.Component {
permissionLevel: 4,
sampleDetailLevel: 4,
reactionDetailLevel: 3,
wellplateDetailLevel: 3
wellplateDetailLevel: 3,
screenDetailLevel: 2
});
break;
}
......@@ -141,6 +150,14 @@ export default class ShareSettingsModal extends React.Component {
});
}
handleScreenDLChange() {
let val = this.refs.screenDetailLevelSelect.getValue();
this.setState({
screenDetailLevel: val
});
}
render() {
return (
<div>
......@@ -183,6 +200,11 @@ export default class ShareSettingsModal extends React.Component {
<option value='2'>Readout</option>
<option value='3'>Everything</option>
</Input>
<Input ref='screenDetailLevelSelect' type='select' label='Screen detail level' defaultValue={this.state.node.screen_detail_level} value={this.state.screenDetailLevel} onChange={(e) => this.handleScreenDLChange(e)}>
<option value='0'>Name, description, conditions, requirements</option>
<option value='1'>Include Wellplate Level 1</option>
<option value='2'>Everything</option>
</Input>
<Button bsStyle="warning" onClick={this.handleUpdateSharing.bind(this)}>Update Share</Button>
</Modal.Body>
</Modal>
......
......@@ -103,7 +103,8 @@ export default class CollectionsFetcher {
permission_level: params.permission_level,
sample_detail_level: params.sample_detail_level,
reaction_detail_level: params.reaction_detail_level,
wellplate_detail_level: params.wellplate_detail_level
wellplate_detail_level: params.wellplate_detail_level,
screen_detail_level: params.screen_detail_level
})
})
......
......@@ -22,7 +22,8 @@ export default class ShareModal extends React.Component {
permissionLevel: 0,
sampleDetailLevel: 0,
reactionDetailLevel: 0,
wellplateDetailLevel: 0
wellplateDetailLevel: 0,
screenDetailLevel: 0
}
}
......@@ -79,6 +80,7 @@ export default class ShareModal extends React.Component {
let sampleDetailLevel = this.refs.sampleDetailLevelSelect.getValue();
let reactionDetailLevel = this.refs.reactionDetailLevelSelect.getValue();
let wellplateDetailLevel = this.refs.wellplateDetailLevelSelect.getValue();
let screenDetailLevel = this.refs.screenDetailLevelSelect.getValue();
let userIds = this.refs.userSelect.state.values.map(o => o.value);
let uiState = UIStore.getState();
......@@ -91,7 +93,8 @@ export default class ShareModal extends React.Component {
permission_level: permissionLevel,
sample_detail_level: sampleDetailLevel,
reaction_detail_level: reactionDetailLevel,
wellplate_detail_level: wellplateDetailLevel
wellplate_detail_level: wellplateDetailLevel,
screen_detail_level: screenDetailLevel
},
elements_filter: filterParams,
user_ids: userIds,
......@@ -110,7 +113,8 @@ export default class ShareModal extends React.Component {
permissionLevel: 4,
sampleDetailLevel: 2,
reactionDetailLevel: 1,
wellplateDetailLevel: 3
wellplateDetailLevel: 3,
screenDetailLevel: 1
});
break;
case 'partner':
......@@ -118,7 +122,8 @@ export default class ShareModal extends React.Component {
permissionLevel: 1,
sampleDetailLevel: 4,
reactionDetailLevel: 3,
wellplateDetailLevel: 3
wellplateDetailLevel: 3,
screenDetailLevel: 1
});
break;
case 'collaborator':
......@@ -126,7 +131,8 @@ export default class ShareModal extends React.Component {
permissionLevel: 0,
sampleDetailLevel: 1,
reactionDetailLevel: 1,
wellplateDetailLevel: 1
wellplateDetailLevel: 1,
screenDetailLevel: 0
});
break;
case 'reviewer':
......@@ -134,7 +140,8 @@ export default class ShareModal extends React.Component {
permissionLevel: 0,
sampleDetailLevel: 2,
reactionDetailLevel: 3,
wellplateDetailLevel: 2
wellplateDetailLevel: 2,
screenDetailLevel: 1
});
break;
case 'supervisor':
......@@ -142,7 +149,8 @@ export default class ShareModal extends React.Component {
permissionLevel: 4,
sampleDetailLevel: 4,
reactionDetailLevel: 3,
wellplateDetailLevel: 3
wellplateDetailLevel: 3,
screenDetailLevel: 2
});
break;
}
......@@ -180,6 +188,14 @@ export default class ShareModal extends React.Component {
});
}
handleScreenDLChange() {
let val = this.refs.screenDetailLevelSelect.getValue();
this.setState({
screenDetailLevel: val
});
}
usersEntries() {
let users = this.state.users.filter((u)=> u.id != this.state.currentUser.id);
return users.map(
......@@ -227,10 +243,15 @@ export default class ShareModal extends React.Component {
</Input>
<Input ref='wellplateDetailLevelSelect' type='select' label='Wellplate detail level' value={this.state.wellplateDetailLevel} onChange={(e) => this.handleWellplateDLChange(e)}>
<option value='0'>Include Samples Level 0/Wells (Positions)</option>
<option value='1'>Include Sample 1</option>
<option value='1'>Include Sample Level 1</option>
<option value='2'>Readout</option>
<option value='3'>Everything</option>
</Input>
<Input ref='screenDetailLevelSelect' type='select' label='Screen detail level' value={this.state.screenDetailLevel} onChange={(e) => this.handleScreenDLChange(e)}>
<option value='0'>Name, description, conditions, requirements</option>
<option value='1'>Include Wellplate Level 1</option>
<option value='2'>Everything</option>
</Input>
<b>Select Users to share with</b>
<Select ref='userSelect' name='users' multi={true}
......
class CollectionSerializer < ActiveModel::Serializer
attributes :id, :label, :descendant_ids, :is_shared, :shared_by_id,
:permission_level, :sample_detail_level, :reaction_detail_level, :wellplate_detail_level
:permission_level, :sample_detail_level, :reaction_detail_level, :wellplate_detail_level, :screen_detail_level
has_many :children
......
......@@ -4,7 +4,7 @@ describe Chemotion::CollectionAPI do
let(:json_options) {
{
only: [:id, :label],
methods: [:children, :descendant_ids, :permission_level, :shared_by_id, :sample_detail_level, :reaction_detail_level, :wellplate_detail_level, :is_shared]
methods: [:children, :descendant_ids, :permission_level, :shared_by_id, :sample_detail_level, :reaction_detail_level, :wellplate_detail_level, :screen_detail_level, :is_shared]
}
}
......@@ -226,7 +226,8 @@ describe Chemotion::CollectionAPI do
permission_level: 13,
sample_detail_level: 5,
reaction_detail_level: 2,
wellplate_detail_level: 1
wellplate_detail_level: 1,
screen_detail_level: 5
}
}
......@@ -240,6 +241,7 @@ describe Chemotion::CollectionAPI do
expect(c2.sample_detail_level).to eq 5
expect(c2.reaction_detail_level).to eq 2
expect(c2.wellplate_detail_level).to eq 1
expect(c2.screen_detail_level).to eq 5
end
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment