Skip to content

Commit

Permalink
chore: default ketcher2 configs in UI Feature (#1843)
Browse files Browse the repository at this point in the history
- The default editor id for ketcher2 config is missing. Although the ELN Admin can set it, this migration set the default value.

NB: a missing or wrong `editor` value will prevent the option to show up in the Structure Editor Modal

- Also updated the yml example file on pair with the doc (ComPlat/chemotion_saurus#321)
  • Loading branch information
PiTrem authored Mar 28, 2024
1 parent 3c2acc1 commit a714b63
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions config/structure_editors.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ development:

production:
:editors:
:ketcher2:
:label: 'Ketcher 2'
:extJs: '/editors/ketcher2/standalone/index.html'
:chemdraw:
:label: 'ChemDrawJS'
:license: 'license file'
Expand Down
9 changes: 9 additions & 0 deletions db/migrate/20240328150631_update_editor_feat.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class UpdateEditorFeat < ActiveRecord::Migration[6.1]
def change
m = Matrice.find_by(name: 'ketcher2Editor')
# update the feature config unless it is already set
m && m.configs&.fetch('editor', nil).blank? && m.update_columns(configs: { editor: 'ketcher2' })
rescue StandardError => e
Rails.logger.error "Error updating editor feature: #{e.message}"
end
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2023_12_19_162631) do
ActiveRecord::Schema.define(version: 2024_03_28_150631) do

# These are extensions that must be enabled in order to support this database
enable_extension "hstore"
Expand Down

0 comments on commit a714b63

Please sign in to comment.