Skip to content

Commit

Permalink
Implement instance URLs in Galaxy markdown.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Nov 6, 2023
1 parent ea0fe80 commit 7f13ca3
Show file tree
Hide file tree
Showing 14 changed files with 292 additions and 30 deletions.
31 changes: 31 additions & 0 deletions client/src/components/Markdown/Elements/InstanceUrl.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script setup lang="ts">
import { computed } from "vue";
import ExternalLink from "@/components/ExternalLink.vue";
import LoadingSpan from "@/components/LoadingSpan.vue";
interface InstanceUrlProps {
href?: string;
title?: string;
loading: boolean;
}
const props = withDefaults(defineProps<InstanceUrlProps>(), {
href: null,
title: null,
});
const effectiveTitle = computed(() => {
return props.title ? props.title : props.href;
});
</script>

<template>
<p>
<LoadingSpan v-if="props.loading" message="Loading instance configuration"> </LoadingSpan>
<ExternalLink v-else-if="props.href" :href="props.href">
{{ effectiveTitle }}
</ExternalLink>
<i v-else> Configuration value unset, please contact Galaxy admin. </i>
</p>
</template>
7 changes: 7 additions & 0 deletions client/src/components/Markdown/MarkdownContainer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ import MountTarget from "./MarkdownContainer.vue";
jest.mock("utils/redirect");
withPrefix.mockImplementation((url) => url);

jest.mock("@/composables/config", () => ({
useConfig: jest.fn(() => ({
config: {},
isConfigLoaded: true,
})),
}));

const localVue = getLocalVue();
const axiosMock = new MockAdapter(axios);

Expand Down
38 changes: 38 additions & 0 deletions client/src/components/Markdown/MarkdownContainer.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<script setup>
import { computed, ref } from "vue";
import { useConfig } from "@/composables/config";
import HistoryDatasetAsImage from "./Elements/HistoryDatasetAsImage.vue";
import HistoryDatasetCollectionDisplay from "./Elements/HistoryDatasetCollection/CollectionDisplay.vue";
import HistoryDatasetDetails from "./Elements/HistoryDatasetDetails.vue";
import HistoryDatasetDisplay from "./Elements/HistoryDatasetDisplay.vue";
import HistoryDatasetIndex from "./Elements/HistoryDatasetIndex.vue";
import HistoryDatasetLink from "./Elements/HistoryDatasetLink.vue";
import HistoryLink from "./Elements/HistoryLink.vue";
import InstanceUrl from "./Elements/InstanceUrl.vue";
import InvocationTime from "./Elements/InvocationTime.vue";
import JobMetrics from "./Elements/JobMetrics.vue";
import JobParameters from "./Elements/JobParameters.vue";
Expand All @@ -17,6 +20,8 @@ import WorkflowDisplay from "./Elements/Workflow/WorkflowDisplay.vue";
import WorkflowImage from "./Elements/Workflow/WorkflowImage.vue";
import WorkflowLicense from "./Elements/Workflow/WorkflowLicense.vue";
const { config, isConfigLoaded } = useConfig();
const toggle = ref(false);
const props = defineProps({
name: {
Expand Down Expand Up @@ -83,6 +88,39 @@ const isVisible = computed(() => !isCollapsible.value || toggle.value);
<div v-else-if="name == 'workflow_license'" class="workflow-license">
<WorkflowLicense :license-id="workflows[args.workflow_id]['license']" />
</div>
<InstanceUrl
v-else-if="name == 'instance_citation_link'"
:href="config.citation_url"
:loading="!isConfigLoaded">
</InstanceUrl>
<InstanceUrl v-else-if="name == 'instance_terms_link'" :href="config.terms_url" :loading="!isConfigLoaded">
</InstanceUrl>
<InstanceUrl
v-else-if="name == 'instance_support_link'"
:href="config.support_url"
:loading="!isConfigLoaded">
</InstanceUrl>
<InstanceUrl
v-else-if="name == 'instance_help_link'"
:href="config.helpsite_url"
:loading="!isConfigLoaded">
</InstanceUrl>
<InstanceUrl
v-else-if="name == 'instance_resources_link'"
:href="config.instance_resource_url"
:loading="!isConfigLoaded">
</InstanceUrl>
<InstanceUrl
v-else-if="name == 'instance_access_link'"
:href="config.instance_access_url"
:loading="!isConfigLoaded">
</InstanceUrl>
<InstanceUrl
v-else-if="name == 'instance_organization_link'"
:href="config.ga4gh_service_organization_url"
:title="config.ga4gh_service_organization_name"
:loading="!isConfigLoaded">
</InstanceUrl>
<HistoryLink v-else-if="name == 'history_link'" :args="args" :histories="histories" />
<HistoryDatasetAsImage v-else-if="name == 'history_dataset_as_image'" :args="args" />
<HistoryDatasetLink v-else-if="name == 'history_dataset_link'" :args="args" />
Expand Down
43 changes: 43 additions & 0 deletions client/src/components/Markdown/MarkdownToolBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
:expanded="true"
@onClick="onClick" />
<ToolSection v-else :category="workflowSection" :expanded="true" @onClick="onClick" />
<ToolSection :category="linksSection" :expanded="false" @onClick="onClick" />
<ToolSection :category="otherSection" :expanded="true" @onClick="onClick" />
<ToolSection
v-if="hasVisualizations"
Expand Down Expand Up @@ -250,6 +251,48 @@ export default {
},
],
},
linksSection: {
title: "Galaxy Instance Links",
name: "links",
elems: [
{
id: "instance_access_link",
name: "Access",
description: "(link used to access this Galaxy)",
},
{
id: "instance_resources_link",
name: "Resources",
description: "(link for more information about this Galaxy)",
},
{
id: "instance_help_link",
name: "Help",
description: "(link for finding help content for this Galaxy)",
},
{
id: "instance_support_link",
name: "Support",
description: "(link for support for this Galaxy)",
},
{
id: "instance_citation_link",
name: "Citation",
description: "(link describing how to cite this Galaxy instance)",
},
{
id: "instance_terms_link",
name: "Terms and Conditions",
description: "(link describing terms and conditions for using this Galaxy instance)",
},
{
id: "instance_organization_link",
name: "Organization",
description: "(link describing organization that runs this Galaxy instance)",
},
],
},
visualizationSection: {
title: "Visualizations",
name: "visualizations",
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/PageDisplay/PageDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@onEdit="onEdit" />
<PageHtml v-else :page="page" />
</div>
<b-alert v-else variant="info" show>Unsupported page format.</b-alert>
<LoadingSpan v-else message="Loading Galaxy configuration" />
</template>
</PublishedItem>
</template>
Expand All @@ -27,10 +27,12 @@ import { urlData } from "@/utils/url";
import PageHtml from "./PageHtml.vue";
import PublishedItem from "@/components/Common/PublishedItem.vue";
import LoadingSpan from "@/components/LoadingSpan.vue";
import Markdown from "@/components/Markdown/Markdown.vue";
export default {
components: {
LoadingSpan,
Markdown,
PageHtml,
PublishedItem,
Expand Down
2 changes: 2 additions & 0 deletions lib/galaxy/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,8 @@ class GalaxyAppConfiguration(BaseAppConfiguration, CommonConfigurationMixin):
"fetch_url_whitelist": "fetch_url_allowlist",
"containers_resolvers_config_file": "container_resolvers_config_file",
"activation_email": "email_from",
"ga4gh_service_organization_name": "organization_name",
"ga4gh_service_organization_url": "organization_url",
}

deprecated_options = list(renamed_options.keys()) + [
Expand Down
2 changes: 2 additions & 0 deletions lib/galaxy/config/config_manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ def lint(self, args, app_desc, key, value) -> None:
"legacy_eager_objectstore_initialization": _DeprecatedAndDroppedAction(),
"enable_openid": _DeprecatedAndDroppedAction(),
"openid_consumer_cache_path": _DeprecatedAndDroppedAction(),
"ga4gh_service_organization_name": _RenameAction("organization_name"),
"ga4gh_service_organization_url": _RenameAction("organization_url"),
}


Expand Down
51 changes: 34 additions & 17 deletions lib/galaxy/config/schemas/config_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1180,11 +1180,20 @@ mapping:
type: str
required: false
desc: |
URL of the support resource for the galaxy instance. Used in activation
emails.
URL of the support resource for the galaxy instance. Used outside of web contexts
such as in activation emails and in Galaxy markdown report generation.
Example value 'https://galaxyproject.org/'
instance_access_url:
type: str
required: false
desc: |
URL used to access this Galaxy server. Used outside of web contexts
such as in Galaxy markdown report generation.
Example value 'https://usegalaxy.org'
email_domain_blocklist_file:
type: str
required: false
Expand Down Expand Up @@ -2931,45 +2940,53 @@ mapping:
a real admin user account via API.
You should probably not set this on a production server.
ga4gh_service_id:
organization_name:
type: str
required: false
desc: |
Service ID for GA4GH services (exposed via the service-info endpoint for the Galaxy DRS API).
If unset, one will be generated using the URL the target API requests are made against.
The name of the organization that operates this Galaxy instance. Serves as the
default for the GA4GH service organization name and can be exposed through Galaxy
markdown for reports and such. For instance, "Not Evil Corporation".
For GA4GH APIs, this is exposed via the service-info endpoint for the Galaxy DRS API.
If unset, one will be generated using ga4gh_service_id (but only in the context
of GA4GH APIs).
For more information on GA4GH service definitions - check out
https://github.com/ga4gh-discovery/ga4gh-service-registry
and https://editor.swagger.io/?url=https://raw.githubusercontent.com/ga4gh-discovery/ga4gh-service-registry/develop/service-registry.yaml
This value should likely reflect your service's URL. For instance for usegalaxy.org
this value should be org.usegalaxy. Particular Galaxy implementations will treat this
value as a prefix and append the service type to this ID. For instance for the DRS
service "id" (available via the DRS API) for the above configuration value would be
org.usegalaxy.drs.
ga4gh_service_organization_name:
organization_url:
type: str
required: false
desc: |
Service name for host organization (exposed via the service-info endpoint for the Galaxy DRS API).
If unset, one will be generated using ga4gh_service_id.
The URL of the organization that operates this Galaxy instance. Serves as the
default for the GA4GH service organization name and can be exposed through Galaxy
markdown for reports and such. For instance, "notevilcorp.com".
For GA4GH APIs, this is exposed via the service-info endpoint.
For more information on GA4GH service definitions - check out
https://github.com/ga4gh-discovery/ga4gh-service-registry
and https://editor.swagger.io/?url=https://raw.githubusercontent.com/ga4gh-discovery/ga4gh-service-registry/develop/service-registry.yaml
ga4gh_service_organization_url:
ga4gh_service_id:
type: str
required: False
required: false
desc: |
Organization URL for host organization (exposed via the service-info endpoint for the Galaxy DRS API).
Service ID for GA4GH services (exposed via the service-info endpoint for the Galaxy DRS API).
If unset, one will be generated using the URL the target API requests are made against.
For more information on GA4GH service definitions - check out
https://github.com/ga4gh-discovery/ga4gh-service-registry
and https://editor.swagger.io/?url=https://raw.githubusercontent.com/ga4gh-discovery/ga4gh-service-registry/develop/service-registry.yaml
This value should likely reflect your service's URL. For instance for usegalaxy.org
this value should be org.usegalaxy. Particular Galaxy implementations will treat this
value as a prefix and append the service type to this ID. For instance for the DRS
service "id" (available via the DRS API) for the above configuration value would be
org.usegalaxy.drs.
ga4gh_service_environment:
type: str
required: False
Expand Down
25 changes: 17 additions & 8 deletions lib/galaxy/config/schemas/tool_shed_config_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ mapping:
type: str
required: false
desc: |
Service ID for GA4GH services (exposed via the service-info endpoint for the Galaxy DRS API).
Service ID for GA4GH services.
If unset, one will be generated using the URL the target API requests are made against.
For more information on GA4GH service definitions - check out
Expand All @@ -366,23 +367,31 @@ mapping:
service "id" (available via the DRS API) for the above configuration value would be
org.usegalaxy.drs.
ga4gh_service_organization_name:
organization_name:
type: str
required: false
desc: |
Service name for host organization (exposed via the service-info endpoint for the Galaxy DRS API).
If unset, one will be generated using ga4gh_service_id.
The name of the organization that operates this Galaxy instance. Serves as the
default for the GA4GH service organization name and can be exposed through Galaxy
markdown for reports and such. For instance, "Not Evil Corporation".
For GA4GH APIs, this is exposed via the service-info endpoint for the Galaxy DRS API.
If unset, one will be generated using ga4gh_service_id (but only in the context
of GA4GH APIs).
For more information on GA4GH service definitions - check out
https://github.com/ga4gh-discovery/ga4gh-service-registry
and https://editor.swagger.io/?url=https://raw.githubusercontent.com/ga4gh-discovery/ga4gh-service-registry/develop/service-registry.yaml
ga4gh_service_organization_url:
organization_url:
type: str
required: False
required: false
desc: |
Organization URL for host organization (exposed via the service-info endpoint for the Galaxy DRS API).
If unset, one will be generated using the URL the target API requests are made against.
The URL of the organization that operates this Galaxy instance. Serves as the
default for the GA4GH service organization name and can be exposed through Galaxy
markdown for reports and such. For instance, "notevilcorp.com".
For GA4GH APIs, this is exposed via the service-info endpoint.
For more information on GA4GH service definitions - check out
https://github.com/ga4gh-discovery/ga4gh-service-registry
Expand Down
4 changes: 4 additions & 0 deletions lib/galaxy/managers/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ def _config_is_truthy(item, key, **context):
"tool_training_recommendations_link": _use_config,
"tool_training_recommendations_api_url": _use_config,
"enable_notification_system": _use_config,
"instance_resource_url": _use_config,
"instance_access_url": _use_config,
"organization_name": _use_config,
"organization_url": _use_config,
}


Expand Down
7 changes: 7 additions & 0 deletions lib/galaxy/managers/markdown_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ class DynamicArguments:
"tool_stdout": ["step", "job_id"],
"generate_galaxy_version": [],
"generate_time": [],
"instance_access_link": [],
"instance_resources_link": [],
"instance_help_link": [],
"instance_support_link": [],
"instance_citation_link": [],
"instance_terms_link": [],
"instance_organization_link": [],
"visualization": DYNAMIC_ARGUMENTS,
# Invocation Flavored Markdown
"invocation_time": ["invocation_id"],
Expand Down
Loading

0 comments on commit 7f13ca3

Please sign in to comment.