Skip to content
Merged
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
5 changes: 4 additions & 1 deletion app/dashboards/isilon_folder_dashboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class IsilonFolderDashboard < Administrate::BaseDashboard
class_name: "IsilonAsset",
foreign_key: "parent_folder_id"
),
notes: Field::Text,
created_at: Field::DateTime,
updated_at: Field::DateTime
}.freeze
Expand All @@ -38,6 +39,8 @@ class IsilonFolderDashboard < Administrate::BaseDashboard
# SHOW_PAGE_ATTRIBUTES
# an array of attributes that will be displayed on the model's show page.
SHOW_PAGE_ATTRIBUTES = %i[
full_path
notes
child_folders
isilon_assets
].freeze
Expand All @@ -46,7 +49,7 @@ class IsilonFolderDashboard < Administrate::BaseDashboard
# an array of attributes that will be displayed
# on the model's form (`new` and `edit`) pages.
FORM_ATTRIBUTES = %i[
full_path
notes
].freeze

# COLLECTION_FILTERS
Expand Down
11 changes: 10 additions & 1 deletion app/javascript/controllers/wunderbaum_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,16 @@ export default class extends Controller {
}
break;

case "notes":
case "notes": {
const input = document.createElement("input");
input.type = "text";
input.name = colId;
input.value = value ?? "";
colInfo.elem.innerHTML = "";
colInfo.elem.appendChild(input);
break;
}

case "preservica_reference_id":
// These fields only apply to assets, not folders
if (!isFolder) {
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/isilon_folder_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class IsilonFolderSerializer < ActiveModel::Serializer
attributes :title, :folder, :id, :lazy, :assigned_to, :parent_folder_id, :path, :key
attributes :title, :folder, :id, :lazy, :assigned_to, :parent_folder_id, :path, :key, :notes

def title
object.full_path
Expand Down
Empty file added db/development.sqlite3
Empty file.
5 changes: 5 additions & 0 deletions db/migrate/20250912120000_add_notes_to_isilon_folders.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddNotesToIsilonFolders < ActiveRecord::Migration[7.1]
def change
add_column :isilon_folders, :notes, :text
end
end
12 changes: 12 additions & 0 deletions spec/requests/volumes/file_tree_updates_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
expect(response).to have_http_status(:ok)
expect(asset.reload.notes).to eq("reviewed")
end

it "updates and persists a folder" do
patch file_tree_updates_volume_path(volume), params: {
node_id: folder.id,
node_type: "folder",
field: "notes",
value: "Folder note"
}, as: :json

expect(response).to have_http_status(:ok)
expect(folder.reload.notes).to eq("Folder note")
end
end

context "with an invalid node_id" do
Expand Down
13 changes: 13 additions & 0 deletions spec/serializers/isilon_folder_serializer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require "rails_helper"

RSpec.describe IsilonFolderSerializer do
it "includes the notes attribute" do
folder = create(:isilon_folder, notes: "Serializer note")

serialized = described_class.new(folder).serializable_hash

expect(serialized[:notes]).to eq("Serializer note")
end
end