Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
V
validata-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
21
Issues
21
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Validata
validata-ui
Commits
128689fe
Commit
128689fe
authored
Jun 18, 2019
by
Pierre Dittgen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display documentation link for master branch
parent
65b02f92
Pipeline
#1017
failed with stage
in 16 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
9 deletions
+21
-9
validata_ui/templates/schema_info_part.html
validata_ui/templates/schema_info_part.html
+11
-4
validata_ui/templates/validation_form.html
validata_ui/templates/validation_form.html
+1
-1
validata_ui/templates/validation_report.html
validata_ui/templates/validation_report.html
+1
-1
validata_ui/views.py
validata_ui/views.py
+8
-3
No files found.
validata_ui/templates/schema_info_part.html
View file @
128689fe
{% macro html(schema_info, schema_versions, schema_current_version) %}
{% macro html(schema_info, schema_versions, schema_current_version
, doc_url
) %}
<h5
class=
"card-title"
>
Schéma
{% if schema_info.title %}
...
...
@@ -26,14 +26,17 @@
</ul>
</p>
{% endif %}
{% if schema_info.
doc_url
or schema_info.url %}
{% if schema_info.
homepage
or schema_info.url %}
<p>
{% if schema_info.
doc_url
%}
<a
href=
"{{ schema_info.doc_url }}"
target=
"_blank"
class=
"card-link"
>
Documentation
</a>
{% if schema_info.
homepage
%}
Site :
<a
href=
"{{ schema_info.homepage }}"
target=
"_blank"
title=
"{{ schema_info.homepage }}"
class=
"card-link"
>
{{ schema_info.homepage | truncate(40) }}
</a>
{% endif %}
{#
{% if schema_info.homepage and schema_info.url %}
<br
/>
{% endif %}
{% if schema_info.url %}
Source :
<a
href=
"{{ schema_info.url }}"
target=
"_blank"
title=
"{{ schema_info.url }}"
class=
"card-link"
>
{{ schema_info.url | truncate(40) }}
</a>
{% endif %}
#}
</p>
{% endif %}
{% if schema_versions %}
...
...
@@ -44,6 +47,10 @@
<option
{%
if
sv =
=
schema_current_version
%}
selected=
"selected"
{%
endif
%}
>
{{ sv }}
</option>
{% endfor %}
</select>
{% if schema_current_version == 'master' %}
<br
/>
<a
href=
"{{ doc_url }}"
target=
"_blank"
>
Documentation
</a>
{% endif %}
</p>
{% endif %}
{% endmacro %}
...
...
validata_ui/templates/validation_form.html
View file @
128689fe
...
...
@@ -12,7 +12,7 @@
<div
class=
"col-md-4 {{ cols_my_classes }}"
>
<div
class=
"card bg-faded"
>
<div
class=
"card-body"
>
{{ schema_info_part.html(schema_info, schema_versions, schema_current_version) }}
{{ schema_info_part.html(schema_info, schema_versions, schema_current_version
, doc_url
) }}
</div>
</div>
</div>
...
...
validata_ui/templates/validation_report.html
View file @
128689fe
...
...
@@ -51,7 +51,7 @@
<div
class=
"col-md-{% if print_mode %}12{% else %}5{% endif %} my-4"
>
<div
class=
"card bg-faded"
>
<div
class=
"card-body"
>
{{ schema_info_part.html(schema_info, schema_versions, schema_current_version) }}
{{ schema_info_part.html(schema_info, schema_versions, schema_current_version
, doc_url
) }}
<hr
/>
<div>
<h5
class=
"card-title"
>
...
...
validata_ui/views.py
View file @
128689fe
...
...
@@ -34,7 +34,7 @@ log = logging.getLogger(__name__)
class
SchemaInstance
():
"""Handly class to handle schema information"""
def
__init__
(
self
,
url
=
None
,
name
=
None
,
ref
=
None
,
spec
=
None
,
versions
=
None
):
def
__init__
(
self
,
url
=
None
,
name
=
None
,
ref
=
None
,
spec
=
None
,
versions
=
None
,
doc_url
=
None
):
"""This function is not intended to be called directly
but via from_parameters() static method!"""
self
.
url
=
url
...
...
@@ -42,12 +42,13 @@ class SchemaInstance():
self
.
ref
=
ref
self
.
spec
=
spec
self
.
versions
=
versions
self
.
doc_url
=
doc_url
@
staticmethod
def
from_parameters
(
parameter_dict
,
schema_catalog_map
):
"""Initializes schema instance from requests dict and tableschema catalog (for name ref)
"""
schema_url
,
schema_name
,
schema_ref
,
versions
=
None
,
None
,
None
,
None
schema_url
,
schema_name
,
schema_ref
,
versions
,
doc_url
=
None
,
None
,
None
,
None
,
None
# From schema_url
if
'schema_url'
in
parameter_dict
:
...
...
@@ -78,6 +79,7 @@ class SchemaInstance():
# Git refs
if
table_schema_reference
:
versions
=
table_schema_reference
.
get_refs
()
doc_url
=
table_schema_reference
.
doc_url
options
=
{
'ref'
:
schema_ref
}
if
schema_ref
else
{}
schema_url
=
table_schema_reference
.
get_schema_url
(
**
options
)
...
...
@@ -85,7 +87,8 @@ class SchemaInstance():
else
:
return
None
return
SchemaInstance
(
schema_url
,
schema_name
,
schema_ref
,
schema_from_url
(
schema_url
),
versions
)
return
SchemaInstance
(
url
=
schema_url
,
name
=
schema_name
,
ref
=
schema_ref
,
spec
=
schema_from_url
(
schema_url
),
versions
=
versions
,
doc_url
=
doc_url
)
def
request_parameters
(
self
):
if
self
.
name
:
...
...
@@ -384,6 +387,7 @@ def validate(schema_instance: SchemaInstance, source: ValidataResource):
validation_date
=
report_datetime
.
strftime
(
'le %d/%m/%Y à %Hh%M'
),
source
=
source
,
source_data
=
source_data
,
schema_current_version
=
schema_instance
.
ref
,
doc_url
=
schema_instance
.
doc_url
,
print_mode
=
request
.
args
.
get
(
'print'
,
'false'
)
==
'true'
,
badge_url
=
badge_url
,
badge_msg
=
badge_msg
,
report_str
=
json
.
dumps
(
validata_report
,
sort_keys
=
True
,
indent
=
2
),
...
...
@@ -542,6 +546,7 @@ def custom_validator():
return
render_template
(
'validation_form.html'
,
title
=
title
,
schema_info
=
schema_info
,
schema_versions
=
schema_versions
,
schema_current_version
=
schema_instance
.
ref
,
doc_url
=
schema_instance
.
doc_url
,
schema_params
=
schema_instance
.
request_parameters
(),
breadcrumbs
=
[{
'url'
:
url_for
(
'home'
),
'title'
:
'Accueil'
},
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment