Skip to content

Commit

Permalink
Merge pull request #269 from performant-software/feature/basira261_au…
Browse files Browse the repository at this point in the history
…thorized_vocabulary

BASIRA #261 - Authorized vocabulary
  • Loading branch information
dleadbetter authored Dec 9, 2024
2 parents 01a0219 + 5a991fa commit c88ac5c
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/models/value_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ValueList < ApplicationRecord
has_many :qualifications

# Resource params
allow_params :authorized_vocabulary, :comment, :object, :group, :human_name, :url_database_value
allow_params :authorized_vocabulary, :comment, :object, :group, :human_name, :authorized_vocabulary_url, :database_value

# Scopes
scope :entity_description, -> { where(object: 'Action', group: 'Characteristic') }
Expand Down
8 changes: 4 additions & 4 deletions app/serializers/value_lists_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class ValueListsSerializer < BaseSerializer
index_attributes :id, :object, :group, :human_name, :url_database_value, :authorized_vocabulary,
:comment, :qualifications_count
index_attributes :id, :object, :group, :human_name, :authorized_vocabulary, :authorized_vocabulary_url,
:database_value, :comment, :qualifications_count

show_attributes :id, :object, :group, :human_name, :url_database_value, :authorized_vocabulary,
:comment, :qualifications_count
show_attributes :id, :object, :group, :human_name, :authorized_vocabulary, :authorized_vocabulary_url,
:database_value, :comment, :qualifications_count
end
2 changes: 1 addition & 1 deletion app/services/airtable_importer/models/value_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def columns
attribute_name: :authorized_vocabulary,
airtable_name: 'Authorized vocabulary'
}, {
attribute_name: :url_database_value,
attribute_name: :authorized_vocabulary_url,
airtable_name: 'URL/Database value (if applicable)'
}, {
attribute_name: :comment,
Expand Down
17 changes: 12 additions & 5 deletions client/src/components/ValueListModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,18 @@ const ValueListModal = (props: Props) => {
/>
</Form.Input>
<Form.Input
error={props.isError('url_database_value')}
label={props.t('ValueList.labels.urlDatabaseValue')}
onChange={props.onTextInputChange.bind(this, 'url_database_value')}
required={props.isRequired('url_database_value')}
value={props.item.url_database_value || ''}
error={props.isError('authorized_vocabulary_url')}
label={props.t('ValueList.labels.authorizedVocabularyUrl')}
onChange={props.onTextInputChange.bind(this, 'authorized_vocabulary_url')}
required={props.isRequired('authorized_vocabulary_url')}
value={props.item.authorized_vocabulary_url || ''}
/>
<Form.Input
error={props.isError('database_value')}
label={props.t('ValueList.labels.databaseValue')}
onChange={props.onTextInputChange.bind(this, 'database_value')}
required={props.isRequired('database_value')}
value={props.item.database_value || ''}
/>
<Form.TextArea
error={props.isError('comment')}
Expand Down
5 changes: 3 additions & 2 deletions client/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -593,12 +593,13 @@
"ValueList": {
"labels": {
"authorizedVocabulary": "Authorized vocabulary",
"authorizedVocabularyUrl": "Authorized vocabulary URL",
"comment": "Comment",
"databaseValue": "Database value",
"groupName": "Group name",
"humanName": "Human name",
"linkedRecords": "Linked records",
"objectName": "Object name",
"urlDatabaseValue": "URL/Database value"
"objectName": "Object name"
},
"title": {
"add": "Add value list item",
Expand Down
3 changes: 2 additions & 1 deletion client/src/transforms/ValueList.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class ValueList extends BaseTransform {
'group',
'human_name',
'authorized_vocabulary',
'url_database_value',
'authorized_vocabulary_url',
'database_value',
'comment',
'_destroy'
];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RenameValueListsUrlDatabaseValue < ActiveRecord::Migration[7.0]
def change
rename_column :value_lists, :url_database_value, :authorized_vocabulary_url
end
end
5 changes: 5 additions & 0 deletions db/migrate/20241203181033_add_value_lists_database_value.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddValueListsDatabaseValue < ActiveRecord::Migration[7.0]
def change
add_column :value_lists, :database_value, :string
end
end
5 changes: 3 additions & 2 deletions 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[7.0].define(version: 2024_11_27_155237) do
ActiveRecord::Schema[7.0].define(version: 2024_12_03_181033) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
enable_extension "plpgsql"
Expand Down Expand Up @@ -286,7 +286,7 @@
t.string "object"
t.string "group"
t.string "human_name"
t.string "url_database_value"
t.string "authorized_vocabulary_url"
t.text "comment"
t.string "authorized_vocabulary"
t.string "airtable_id"
Expand All @@ -296,6 +296,7 @@
t.integer "qualifications_count", default: 0, null: false
t.bigint "created_by_id"
t.bigint "updated_by_id"
t.string "database_value"
t.index ["created_by_id"], name: "index_value_lists_on_created_by_id"
t.index ["updated_by_id"], name: "index_value_lists_on_updated_by_id"
end
Expand Down

0 comments on commit c88ac5c

Please sign in to comment.