diff --git a/client/src/api/schema/schema.ts b/client/src/api/schema/schema.ts index 5020592423ed..09f781afd5f0 100644 --- a/client/src/api/schema/schema.ts +++ b/client/src/api/schema/schema.ts @@ -2637,11 +2637,6 @@ export interface components { * @description Documentation or extended description for this plugin. */ doc: string; - /** - * Extra - * @description Extra configuration options that the plugin may serialize. This is plugin specific. - */ - extra?: Record | null; /** * ID * @description The `FilesSource` plugin identifier @@ -2672,6 +2667,11 @@ export interface components { * @description The URI root used by this type of plugin. */ uri_root: string; + /** + * URL + * @description Optional URL that might be provided by some plugins to link to the remote source. + */ + url?: string | null; /** * Writeable * @description Whether this files source plugin allows write access. @@ -5215,11 +5215,6 @@ export interface components { * @description Documentation or extended description for this plugin. */ doc: string; - /** - * Extra - * @description Extra configuration options that the plugin may serialize. This is plugin specific. - */ - extra?: Record | null; /** * ID * @description The `FilesSource` plugin identifier @@ -5245,6 +5240,11 @@ export interface components { * @description The type of the plugin. */ type: string; + /** + * URL + * @description Optional URL that might be provided by some plugins to link to the remote source. + */ + url?: string | null; /** * Writeable * @description Whether this files source plugin allows write access. diff --git a/client/src/components/Common/ExportRecordDOILink.vue b/client/src/components/Common/ExportRecordDOILink.vue index 80aeb46536b4..22683615482c 100644 --- a/client/src/components/Common/ExportRecordDOILink.vue +++ b/client/src/components/Common/ExportRecordDOILink.vue @@ -41,7 +41,7 @@ async function getDOIFromExportRecordUri(uri?: string) { console.debug("No file source found for URI: ", uri); return undefined; } - const repositoryUrl = fileSource.extra?.url; + const repositoryUrl = fileSource.url; if (!repositoryUrl) { console.debug("Invalid repository URL for file source: ", fileSource); return undefined; diff --git a/lib/galaxy/files/sources/__init__.py b/lib/galaxy/files/sources/__init__.py index d78b5f03414f..2633df91e6b3 100644 --- a/lib/galaxy/files/sources/__init__.py +++ b/lib/galaxy/files/sources/__init__.py @@ -9,7 +9,6 @@ from typing import ( Any, ClassVar, - Dict, List, Optional, Set, @@ -97,7 +96,7 @@ class FilesSourceProperties(TypedDict): uri_root: NotRequired[str] type: NotRequired[str] browsable: NotRequired[bool] - extra: NotRequired[Dict[str, Any]] + url: NotRequired[Optional[str]] @dataclass @@ -301,7 +300,6 @@ def get_browsable(self) -> bool: class BaseFilesSource(FilesSource): plugin_kind: ClassVar[PluginKind] = PluginKind.rfs # Remote File Source by default, override in subclasses - serialize_extra_props: ClassVar[List[str]] = [] # Extra properties safe to serialize def get_browsable(self) -> bool: # Check whether the list method has been overridden @@ -337,6 +335,10 @@ def get_uri_root(self) -> str: root = uri_join(root, prefix) return root + def get_url(self) -> Optional[str]: + """Returns a URL that can be used to link to the remote source.""" + return None + def to_relative_path(self, url: str) -> str: return url.replace(self.get_uri_root(), "") or "/" @@ -377,13 +379,10 @@ def to_dict(self, for_serialization=False, user_context: "OptionalUserContext" = } if self.get_browsable(): rval["uri_root"] = self.get_uri_root() + if self.get_url() is not None: + rval["url"] = self.get_url() if for_serialization: rval.update(self._serialization_props(user_context=user_context)) - if self.serialize_extra_props: - extra_props = {} - for prop in self.serialize_extra_props: - extra_props[prop] = getattr(self, prop, None) - rval["extra"] = extra_props return rval def to_dict_time(self, ctime): diff --git a/lib/galaxy/files/sources/_rdm.py b/lib/galaxy/files/sources/_rdm.py index 635c0fc2b3a9..8a5ef5b4bf8e 100644 --- a/lib/galaxy/files/sources/_rdm.py +++ b/lib/galaxy/files/sources/_rdm.py @@ -21,7 +21,6 @@ class RDMFilesSourceProperties(FilesSourceProperties): - url: str token: str public_name: str @@ -135,7 +134,6 @@ class RDMFilesSource(BaseFilesSource): """ plugin_kind = PluginKind.rdm - serialize_extra_props = ["url"] def __init__(self, **kwd: Unpack[RDMFilesSourceProperties]): props = self._parse_common_config_opts(kwd) @@ -149,6 +147,9 @@ def __init__(self, **kwd: Unpack[RDMFilesSourceProperties]): def repository(self) -> RDMRepositoryInteractor: return self._repository_interactor + def get_url(self) -> Optional[str]: + return self.url + def get_repository_interactor(self, repository_url: str) -> RDMRepositoryInteractor: """Returns an interactor compatible with the given repository URL. diff --git a/lib/galaxy/schema/remote_files.py b/lib/galaxy/schema/remote_files.py index ab21cc7a5e70..b4cec1860c67 100644 --- a/lib/galaxy/schema/remote_files.py +++ b/lib/galaxy/schema/remote_files.py @@ -1,7 +1,6 @@ from enum import Enum from typing import ( Any, - Dict, List, Optional, Union, @@ -82,10 +81,10 @@ class FilesSourcePlugin(Model): title="Requires groups", description="Only users belonging to the groups specified here can access this files source.", ) - extra: Optional[Dict[str, Any]] = Field( + url: Optional[str] = Field( None, - title="Extra", - description="Extra configuration options that the plugin may serialize. This is plugin specific.", + title="URL", + description="Optional URL that might be provided by some plugins to link to the remote source.", )