Skip to content

Commit

Permalink
drag sample element to segment
Browse files Browse the repository at this point in the history
  • Loading branch information
phuang26 committed Nov 14, 2023
1 parent da0074b commit 7ff7808
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ gem 'kaminari'
gem 'kaminari-grape'
gem 'ketcherails', git: 'https://github.com/complat/ketcher-rails.git', branch: 'upgrade-to-rails-6'

gem 'labimotion', '1.0.18'
gem 'labimotion', '1.0.19'

gem 'mimemagic', '0.3.10'

Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ GEM
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
labimotion (1.0.18)
labimotion (1.0.19)
rails (~> 6.1.7)
latex-decode (0.4.0)
launchy (2.5.0)
Expand Down Expand Up @@ -921,7 +921,7 @@ DEPENDENCIES
kaminari
kaminari-grape
ketcherails!
labimotion (= 1.0.18)
labimotion (= 1.0.19)
launchy
listen
memory_profiler
Expand Down
9 changes: 6 additions & 3 deletions app/models/concerns/element_codes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ElementCodes
extend ActiveSupport::Concern

Expand All @@ -8,11 +10,12 @@ module ElementCodes
def source_class() @source_class||=self.class.name.demodulize.underscore end

def code_logs
CodeLog.where(source: source_class).
where(source_id: id).order(created_at: 'DESC')
return [] if source_class == 'container' && containable_type == 'Labimotion::Element'

CodeLog.where(source: source_class).where(source_id: id).order(created_at: 'DESC')
end

def code_log() code_logs.first end
def code_log() code_logs&.first end


# [ "bar_code", "qr_code", "bruker_code"].each do |type|
Expand Down
2 changes: 1 addition & 1 deletion app/packs/src/components/generic/GenericContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const headerBtnGroup = (props) => {
const { hasChemSpectra } = UIStore.getState();
const toggleSpectraModal = (e) => {
SpectraActions.ToggleModal();
SpectraActions.LoadSpectra.defer(spcInfo);
SpectraActions.LoadSpectra.defer(spcInfos);
};
return (
<div className="upper-btn">
Expand Down
10 changes: 3 additions & 7 deletions app/packs/src/components/generic/GenericElDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export default class GenericElDetails extends Component {
genericEl.can_copy && !genericEl.isNew ? (
<CopyElementModal element={genericEl} defCol={defCol} />
) : null;
const saveBtnDisplay = genericEl.changed ? '' : 'none';
const saveBtnDisplay = genericEl.changed && genericEl.can_update ? '' : 'none';
const datetp = `Created at: ${genericEl.created_at} \n Updated at: ${genericEl.updated_at}`;
return (
<div>
Expand Down Expand Up @@ -408,12 +408,8 @@ export default class GenericElDetails extends Component {
render() {
const { genericEl } = this.state;
const submitLabel = genericEl && genericEl.isNew ? 'Create' : 'Save';
const saveBtnDisplay =
(genericEl && genericEl.isNew) ||
(genericEl && genericEl.changed) ||
false
? { display: '' }
: { display: 'none' };
// eslint-disable-next-line max-len
const saveBtnDisplay = (genericEl?.isNew || (genericEl?.can_update && genericEl?.changed)) ? { display: '' } : { display: 'none' };

let tabContents = [
i => this.propertiesTab(i),
Expand Down
12 changes: 3 additions & 9 deletions app/packs/src/components/navigation/UserAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,14 +655,6 @@ export default class UserAuth extends Component {
if (MatrixCheck(this.state.currentUser.matrix, 'userLabel')) {
userLabel = <MenuItem onClick={this.handleLabelShow}>My Labels</MenuItem>;
}
let converterBtn = <span />;
if (UIStore.getState().hasConverter === true) {
converterBtn = (
<MenuItem eventKey="12" href="/converter_admin">
Converter Profile
</MenuItem>
);
}

return (
<div>
Expand All @@ -687,11 +679,13 @@ export default class UserAuth extends Component {
{userLabel}
{/* <MenuItem onClick={this.handleSubscriptionShow}>My Subscriptions</MenuItem>
Disable for now as there is no subsciption channel yet (Paggy) */}
{converterBtn}
<MenuItem eventKey="7" href="/command_n_control">
My Devices
</MenuItem>
{this.state.currentUser.molecule_editor ? moderatorLink : null}
<MenuItem eventKey="12" href="/converter_admin">
Converter Profile
</MenuItem>
<MenuItem eventKey="8" href="/generic_elements_admin">Generic Designer</MenuItem>
</NavDropdown>
<NavItem
Expand Down
3 changes: 1 addition & 2 deletions app/packs/src/components/navigation/search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Form, FormControl, Radio, Grid, Row, Col
} from 'react-bootstrap';
import PropTypes from 'prop-types';
import { GenericElCriteriaModal } from 'chem-generic-ui';
import { GenericElCriteriaModal, clsInputGroup } from 'chem-generic-ui';

import AutoCompleteInput from 'src/components/navigation/search/AutoCompleteInput';
import StructureEditorModal from 'src/components/structureEditor/StructureEditorModal';
Expand All @@ -14,7 +14,6 @@ import UIStore from 'src/stores/alt/stores/UIStore';
import UIActions from 'src/stores/alt/actions/UIActions';
import UserStore from 'src/stores/alt/stores/UserStore';
import GenericElCriteria from 'src/components/generic/GenericElCriteria';
import { clsInputGroup } from 'chem-generic-ui';

export default class Search extends React.Component {
constructor(props) {
Expand Down
2 changes: 1 addition & 1 deletion app/policies/element_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def maximum_permission_level(collections,sync_collections=SyncCollectionsUser.no
end

def maximum_element_permission_level(sync_collections = SyncCollectionsUser.none)
sync_collections.pluck("#{@record.class.name.downcase}_detail_level").max || -1
sync_collections.pluck("#{Labimotion::Utils.element_name_dc(@record.class.to_s)}_detail_level").max || -1
end

def user_ids
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"antd": "^3.19.3",
"aviator": "v0.6.1",
"base-64": "^0.1.0",
"chem-generic-ui": "^1.0.10",
"chem-generic-ui": "^1.0.11",
"chemotion-converter-client": "0.5.0",
"citation-js": "0.6.8",
"classnames": "^2.2.5",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5529,10 +5529,10 @@ cheerio@^1.0.0-rc.3:
parse5-htmlparser2-tree-adapter "^6.0.1"
tslib "^2.2.0"

chem-generic-ui@^1.0.10:
version "1.0.10"
resolved "https://registry.yarnpkg.com/chem-generic-ui/-/chem-generic-ui-1.0.10.tgz#c2f1735eae0a480f8dcebeaf72b21e77a7c79fdf"
integrity sha512-ggmWjTgKv15GCeA0jJHaI8RraoiXwK0Ee7pQ09l6OEa7IWWtPqVFq9ojrgFbX9LB3LPbOZrXNKn6Hg/PdUc/jQ==
chem-generic-ui@^1.0.11:
version "1.0.11"
resolved "https://registry.yarnpkg.com/chem-generic-ui/-/chem-generic-ui-1.0.11.tgz#3ac832a935facf2dec86fdc07642f51510c8914e"
integrity sha512-JaEYA2ghquw/06M0Q1BzLRrmTFs8YY/89XRc2C3qO6T4HlhCw+mUDoAqNNhZJmOtTjksQTupklFZUIY8b44JgA==
dependencies:
"@fortawesome/fontawesome-svg-core" "^6.1.2"
"@fortawesome/free-regular-svg-icons" "^6.1.2"
Expand Down

0 comments on commit 7ff7808

Please sign in to comment.