Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Géocontrib Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GéoContrib
Géocontrib Frontend
Commits
b3687af6
Commit
b3687af6
authored
3 years ago
by
Sébastien DA ROCHA
Browse files
Options
Downloads
Plain Diff
Merge branch 'redmine-issues/12431' into 'develop'
REDMINE_ISSUE-12431
See merge request
!139
parents
4b1d61f4
aeb2e98e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!139
REDMINE_ISSUE-12407
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/services/feature-api.js
+13
-0
13 additions, 0 deletions
src/services/feature-api.js
src/views/feature_type/Feature_type_detail.vue
+12
-9
12 additions, 9 deletions
src/views/feature_type/Feature_type_detail.vue
with
25 additions
and
9 deletions
src/services/feature-api.js
+
13
−
0
View file @
b3687af6
...
...
@@ -77,6 +77,19 @@ const featureAPI = {
return
null
;
}
},
async
getFeaturesBlob
(
url
)
{
const
response
=
await
axios
.
get
(
url
,
{
responseType
:
"
blob
"
})
if
(
response
.
status
===
200
&&
response
.
data
)
{
return
response
.
data
;
}
else
{
return
null
;
}
},
}
export
default
featureAPI
;
This diff is collapsed.
Click to expand it.
src/views/feature_type/Feature_type_detail.vue
+
12
−
9
View file @
b3687af6
...
...
@@ -102,7 +102,8 @@
</div>
<div
:class=
"['content',
{ active: !showImport }]">
<p>
Vous pouvez télécharger tous les signalements qui vous sont accessibles.
Vous pouvez télécharger tous les signalements qui vous sont
accessibles.
</p>
<button
type=
"button"
...
...
@@ -192,6 +193,7 @@
<
script
>
import
{
mapGetters
,
mapState
}
from
"
vuex
"
;
import
ImportTask
from
"
@/components/ImportTask
"
;
import
featureAPI
from
"
@/services/feature-api
"
;
export
default
{
name
:
"
Feature_type_detail
"
,
...
...
@@ -284,14 +286,10 @@ export default {
options
:
el
.
options
,
};
});
console
.
log
({
json
,
fields
});
for
(
const
feature
of
json
.
features
)
{
console
.
log
(
feature
.
properties
);
for
(
const
{
name
,
field_type
,
options
}
of
fields
)
{
console
.
log
(
"
name
"
,
name
,
"
field_type
"
,
field_type
);
//* check if custom field is present
if
(
!
(
name
in
feature
.
properties
))
{
console
.
log
(
"
NOT present
"
);
return
false
;
}
const
fieldInFeature
=
feature
.
properties
[
name
];
...
...
@@ -302,12 +300,10 @@ export default {
if
(
field_type
===
"
list
"
)
{
//*then check if the value is an available option
if
(
!
options
.
includes
(
fieldInFeature
))
{
console
.
log
(
"
NOT an element of list options
"
);
return
false
;
}
}
else
if
(
customType
!==
field_type
)
{
//* check if custom field value match
console
.
log
(
"
NOT matched
"
);
this
.
importError
=
`Le fichier est invalide: Un champ de type
${
field_type
}
ne peut pas avoir la valeur [
${
fieldInFeature
}
]`
;
return
false
;
}
...
...
@@ -344,8 +340,15 @@ export default {
exportFeatures
()
{
const
url
=
`
${
this
.
$store
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
projects/
${
this
.
$route
.
params
.
slug
}
/feature-type/
${
this
.
$route
.
params
.
feature_type_slug
}
/export/`
;
console
.
log
(
url
);
window
.
open
(
url
);
featureAPI
.
getFeaturesBlob
(
url
).
then
((
blob
)
=>
{
if
(
blob
)
{
const
link
=
document
.
createElement
(
"
a
"
);
link
.
href
=
URL
.
createObjectURL
(
blob
);
link
.
download
=
`
${
this
.
project
.
title
}
-
${
this
.
structure
.
title
}
.json`
;
link
.
click
();
URL
.
revokeObjectURL
(
link
.
href
);
}
});
},
},
...
...
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