Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
web-app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
web-et-numerique-internet
data.grandlyon.com
web-portal
components
custom-apps
web-app
Commits
13644fb5
Commit
13644fb5
authored
5 years ago
by
ext.sopra.ncastejon
Browse files
Options
Downloads
Patches
Plain Diff
Display the correct formats in the Download tab.
parent
0a962f90
No related branches found
No related tags found
1 merge request
!62
v2.5.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/dataset-detail/components/dataset-detail/dataset-detail.component.ts
+29
-5
29 additions, 5 deletions
...ail/components/dataset-detail/dataset-detail.component.ts
with
29 additions
and
5 deletions
src/app/dataset-detail/components/dataset-detail/dataset-detail.component.ts
+
29
−
5
View file @
13644fb5
...
...
@@ -109,15 +109,43 @@ export class DatasetDetailComponent implements OnInit, OnDestroy {
return
formatted
;
}
// Get the formats available to download
get
datasetFormatsList
()
{
const
links
=
this
.
_datasetDetailService
.
datasetMetadata
.
link
;
let
list
=
links
.
map
(
l
=>
l
.
formats
);
let
list
=
links
.
map
((
link
)
=>
{
let
filteredList
=
link
.
formats
;
if
(
link
.
formats
)
{
filteredList
=
link
.
formats
.
filter
((
f
)
=>
{
let
validFormat
=
true
;
if
(
!
f
)
{
validFormat
=
false
;
}
// If nongeographical dataset, there is no shapefile format
// tslint:disable-next-line: ter-indent
// tslint:disable-next-line: brace-style
else
if
(
this
.
_datasetDetailService
.
datasetMetadata
.
type
===
'
nonGeographicDataset
'
&&
f
===
'
ShapeFile
'
)
{
validFormat
=
false
;
}
else
if
(
f
===
'
PDF
'
&&
link
.
name
.
includes
(
'
Licence
'
))
{
// Remove PDF because it's Licence
validFormat
=
false
;
}
return
validFormat
;
});
}
return
filteredList
;
});
// Flat the arrays
list
=
[].
concat
(...
list
);
// Remove duplicates
list
=
[...
new
Set
(
list
)];
list
=
list
.
filter
((
el
)
=>
{
return
el
!==
undefined
;
});
let
formatted
:
string
;
if
(
list
.
length
>
4
)
{
...
...
@@ -126,10 +154,6 @@ export class DatasetDetailComponent implements OnInit, OnDestroy {
formatted
=
list
.
join
(
'
,
'
);
}
if
(
links
.
length
===
1
&&
links
[
0
].
name
.
includes
(
'
Licence
'
))
{
formatted
=
null
;
}
return
formatted
;
}
...
...
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