Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
PEDASI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Research Software Group
PEDASI
Commits
7a074ae5
Commit
7a074ae5
authored
6 years ago
by
James Graham
Browse files
Options
Downloads
Patches
Plain Diff
Only show dataset search for data catalogues
parent
f480d005
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!60
Merge dev pre-hackday
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
datasources/models.py
+26
-11
26 additions, 11 deletions
datasources/models.py
datasources/templates/datasources/datasource/detail.html
+47
-45
47 additions, 45 deletions
datasources/templates/datasources/datasource/detail.html
with
73 additions
and
56 deletions
datasources/models.py
+
26
−
11
View file @
7a074ae5
...
...
@@ -7,7 +7,7 @@ from django.urls import reverse
import
requests
import
requests.exceptions
from
datasources.connectors.base
import
AuthMethod
,
BaseDataConnector
,
REQUEST_AUTH_FUNCTIONS
from
datasources.connectors.base
import
AuthMethod
,
BaseDataConnector
,
ConnectorType
,
REQUEST_AUTH_FUNCTIONS
from
core.models
import
BaseAppDataModel
,
MAX_LENGTH_API_KEY
,
MAX_LENGTH_NAME
,
MAX_LENGTH_PATH
...
...
@@ -59,6 +59,10 @@ class DataSource(BaseAppDataModel):
return
super
().
save
(
**
kwargs
)
@property
def
is_catalogue
(
self
):
return
self
.
data_connector_class
.
TYPE
==
ConnectorType
.
CATALOGUE
@property
def
connector_string
(
self
):
if
self
.
_connector_string
:
...
...
@@ -66,13 +70,12 @@ class DataSource(BaseAppDataModel):
return
self
.
url
@property
def
data_connector
(
self
)
->
BaseDataConnector
:
def
data_connector
_class
(
self
):
"""
Construc
t the data connector for this source.
Ge
t the data connector
class
for this source.
:return: Data connector
instance
:return: Data connector
class
"""
if
self
.
_data_connector
is
None
:
BaseDataConnector
.
load_plugins
(
'
datasources/connectors
'
)
try
:
...
...
@@ -84,6 +87,18 @@ class DataSource(BaseAppDataModel):
raise
KeyError
(
'
Data source plugin not found
'
)
from
e
return
plugin
@property
def
data_connector
(
self
)
->
BaseDataConnector
:
"""
Construct the data connector for this source.
:return: Data connector instance
"""
if
self
.
_data_connector
is
None
:
plugin
=
self
.
data_connector_class
# Is the authentication method set?
auth_method
=
AuthMethod
(
self
.
auth_method
)
if
not
auth_method
:
...
...
This diff is collapsed.
Click to expand it.
datasources/templates/datasources/datasource/detail.html
+
47
−
45
View file @
7a074ae5
...
...
@@ -65,6 +65,7 @@
<hr>
{% if datasource.is_catalogue %}
<h2
class=
"mt-3"
>
Data Sets
</h2>
<script
type=
"application/javascript"
>
...
...
@@ -113,5 +114,6 @@
<div
id=
"dataset-results"
class=
"row px-2"
>
</div>
{% endif %}
{% endblock %}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment