Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for manifests to override the caption #1941

Merged
merged 2 commits into from
Apr 12, 2022
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
7 changes: 7 additions & 0 deletions apps/dashboard/app/apps/manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ def new_window
@manifest_options[:new_window]
end

# Return the app's caption
#
# @return [String] caption as string
def caption
@manifest_options[:caption].to_s
end

# Manifest objects are valid
#
# @return [true] Always return true
Expand Down
6 changes: 5 additions & 1 deletion apps/dashboard/app/apps/ood_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class OodApp
include Rails.application.routes.url_helpers

attr_reader :router
delegate :owner, :caption, :type, :path, :name, :token, to: :router
delegate :owner, :type, :path, :name, :token, to: :router

def accessible?
path.executable? && path.readable?
Expand Down Expand Up @@ -182,6 +182,10 @@ def category
end
end

def caption
manifest.caption.empty? ? router.caption : manifest.caption
end

def subcategory
manifest.subcategory
end
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/test/fixtures/files/manifest_valid
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ url: /pun/sys/vncsim/%{app_token}/sessions
metadata:
tags: test
field_of_science: CS
caption: 'this is the caption from a manifest'
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ role: batch_connect
metadata:
machine_learning: 'true'
languages: python julia R Ruby
caption: 'A really cool Jupyter app'
4 changes: 4 additions & 0 deletions apps/dashboard/test/integration/pinned_apps_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ def teardown
assert_select "a.app-card[href='/batch_connect/sys/bc_paraview/session_contexts/new']", 1
assert_select "a.app-card[href='/apps/show/pseudofun']", 1
assert_select "a.app-card[href='/batch_connect/sys/bc_desktop/owens/session_contexts/new']", 1

# pinned apps show captions
assert_equal 'A really cool Jupyter app', css_select("a.app-card[href='/batch_connect/sys/bc_jupyter/session_contexts/new'] p.text-muted").text
assert_equal 'System Installed App', css_select("a.app-card[href='/batch_connect/sys/bc_paraview/session_contexts/new'] p.text-muted").text
end

test "does not create pinned apps when no configuration" do
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/test/models/manifest_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class ManifestTest < ActiveSupport::TestCase
assert_equal "Virtual Desktop Interface", manifest.subcategory
assert_equal "/pun/sys/vncsim/%{app_token}/sessions", manifest.url
assert_equal metadata, manifest.metadata
assert_equal 'this is the caption from a manifest', manifest.caption
end

test "default keys are safe" do
Expand Down