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
38899583
Commit
38899583
authored
3 years ago
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
transform pending to draft if import in non moderate project
parent
7c20ca33
No related branches found
No related tags found
2 merge requests
!213
2.3.2-rc1
,
!206
REDMINE_ISSUE-12339
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/store/modules/feature_type.js
+25
-8
25 additions, 8 deletions
src/store/modules/feature_type.js
with
25 additions
and
8 deletions
src/store/modules/feature_type.js
+
25
−
8
View file @
38899583
import
axios
from
'
@/axios-client.js
'
;
import
axios
from
'
@/axios-client.js
'
;
// axios.defaults.headers.common['X-CSRFToken'] = (name => {
// var re = new RegExp(name + "=([^;]+)");
// var value = re.exec(document.cookie);
// return (value !== null) ? unescape(value[1]) : null;
// })('csrftoken');
const
getColorsStyles
=
(
customForms
)
=>
customForms
.
filter
(
customForm
=>
customForm
.
options
&&
customForm
.
options
.
length
).
map
(
el
=>
{
const
getColorsStyles
=
(
customForms
)
=>
customForms
.
filter
(
customForm
=>
customForm
.
options
&&
customForm
.
options
.
length
).
map
(
el
=>
{
//* in dropdown, value is the name and name is the label to be displayed, could be changed...
//* in dropdown, value is the name and name is the label to be displayed, could be changed...
return
{
value
:
el
.
name
,
name
:
el
.
label
,
options
:
el
.
options
}
return
{
value
:
el
.
name
,
name
:
el
.
label
,
options
:
el
.
options
}
});
});
const
pending2draftFeatures
=
(
features
)
=>
{
let
result
=
[]
for
(
let
el
of
features
)
{
if
(
el
.
properties
.
status
===
"
pending
"
)
{
el
.
properties
.
status
=
"
draft
"
}
result
.
push
(
el
)
}
return
result
;
}
const
feature_type
=
{
const
feature_type
=
{
namespaced
:
true
,
namespaced
:
true
,
...
@@ -159,12 +163,25 @@ const feature_type = {
...
@@ -159,12 +163,25 @@ const feature_type = {
});
});
},
},
SEND_FEATURES_FROM_GEOJSON
({
state
,
dispatch
},
payload
)
{
async
SEND_FEATURES_FROM_GEOJSON
({
state
,
dispatch
,
rootGetters
},
payload
)
{
const
{
feature_type_slug
}
=
payload
;
const
{
feature_type_slug
}
=
payload
;
if
(
state
.
fileToImport
.
size
>
0
)
{
if
(
state
.
fileToImport
.
size
>
0
)
{
let
formData
=
new
FormData
();
let
formData
=
new
FormData
();
formData
.
append
(
'
json_file
'
,
state
.
fileToImport
);
if
(
!
rootGetters
.
project
.
moderation
)
{
const
textFile
=
await
state
.
fileToImport
.
text
();
const
geojson
=
JSON
.
parse
(
textFile
);
const
unmoderatedFeatures
=
pending2draftFeatures
(
geojson
.
features
);
const
newGeojson
=
{
"
type
"
:
"
FeatureCollection
"
,
"
features
"
:
unmoderatedFeatures
};
const
newFile
=
new
File
([
JSON
.
stringify
(
newGeojson
)],
state
.
fileToImport
.
name
,
{
type
:
state
.
fileToImport
.
type
});
formData
.
append
(
'
json_file
'
,
newFile
);
}
else
{
formData
.
append
(
'
json_file
'
,
state
.
fileToImport
);
}
formData
.
append
(
'
feature_type_slug
'
,
feature_type_slug
);
formData
.
append
(
'
feature_type_slug
'
,
feature_type_slug
);
let
url
=
let
url
=
this
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
+
this
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
+
...
...
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