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
externe Matthieu
Géocontrib Frontend
Commits
d04b4662
Commit
d04b4662
authored
3 years ago
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
fix modal style, click event in button not icon & reload only features after delete
parent
b55d545e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/Dropdown.vue
+3
-1
3 additions, 1 deletion
src/components/Dropdown.vue
src/views/feature/Feature_list.vue
+57
-41
57 additions, 41 deletions
src/views/feature/Feature_list.vue
with
60 additions
and
42 deletions
src/components/Dropdown.vue
+
3
−
1
View file @
d04b4662
...
@@ -112,7 +112,9 @@ export default {
...
@@ -112,7 +112,9 @@ export default {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
isOpen
=
false
;
this
.
isOpen
=
false
;
},
0
);
},
0
);
if
(
this
.
filteredOptions
)
this
.
$emit
(
"
update:selection
"
,
this
.
filteredOptions
[
index
]);
if
(
this
.
filteredOptions
)
{
this
.
$emit
(
"
update:selection
"
,
this
.
filteredOptions
[
index
]);
}
this
.
input
=
""
;
this
.
input
=
""
;
},
},
...
...
This diff is collapsed.
Click to expand it.
src/views/feature/Feature_list.vue
+
57
−
41
View file @
d04b4662
...
@@ -75,12 +75,13 @@
...
@@ -75,12 +75,13 @@
<div
<div
v-if=
"checkedFeatures.length"
v-if=
"checkedFeatures.length"
@
click=
"modalAllDelete"
class=
"ui button compact button-hover-red margin-left-25"
class=
"ui button compact button-hover-red margin-left-25"
data-tooltip=
"Effacer tous les types de signalements sélectionnés"
data-tooltip=
"Effacer tous les types de signalements sélectionnés"
data-position=
"left center"
data-position=
"left center"
data-variation=
"mini"
data-variation=
"mini"
>
>
<i
class=
"grey trash fitted icon"
@
click=
"modalAllDelete"
></i>
<i
class=
"grey trash fitted icon"
></i>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -170,7 +171,7 @@
...
@@ -170,7 +171,7 @@
<button
<button
@
click=
"deleteAllFeatureSelection"
@
click=
"deleteAllFeatureSelection"
type=
"button"
type=
"button"
class=
"ui red compact fluid button"
class=
"ui red compact fluid button
no-margin
"
>
>
Confirmer la suppression
Confirmer la suppression
</button>
</button>
...
@@ -303,12 +304,14 @@ export default {
...
@@ -303,12 +304,14 @@ export default {
},
},
deleteFeature
(
feature
)
{
deleteFeature
(
feature
)
{
const
url
=
`
${
this
.
$store
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
features/
${
feature
.
feature_id
}
`
;
const
url
=
`
${
this
.
$store
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
features/
${
feature
.
feature_id
}
/?project__slug=
${
this
.
project
.
slug
}
`
;
axios
axios
.
delete
(
url
,
{})
.
delete
(
url
,
{})
.
then
(()
=>
{
.
then
(()
=>
{
if
(
!
this
.
modalAllDeleteOpen
)
{
if
(
!
this
.
modalAllDeleteOpen
)
{
this
.
$router
.
go
();
this
.
$store
.
dispatch
(
"
feature/GET_PROJECT_FEATURES
"
,
this
.
project
.
slug
)
.
then
(()
=>
this
.
getFeaturesAsGeojson
());
}
}
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
...
@@ -329,27 +332,27 @@ export default {
...
@@ -329,27 +332,27 @@ export default {
if
(
this
.
featureGroup
)
{
if
(
this
.
featureGroup
)
{
const
features
=
this
.
filteredFeatures
;
const
features
=
this
.
filteredFeatures
;
this
.
featureGroup
.
clearLayers
();
this
.
featureGroup
.
clearLayers
();
this
.
featureGroup
=
mapUtil
.
addFeatures
(
features
,
{},
false
,
this
.
$store
.
state
.
feature_type
.
feature_types
);
this
.
featureGroup
=
mapUtil
.
addFeatures
(
features
,
{},
false
,
this
.
$store
.
state
.
feature_type
.
feature_types
);
mapUtil
.
getMap
().
invalidateSize
();
mapUtil
.
getMap
().
invalidateSize
();
mapUtil
.
getMap
().
_onResize
();
// force refresh for vector tiles
mapUtil
.
getMap
().
_onResize
();
// force refresh for vector tiles
if
(
this
.
featureGroup
.
getLayers
().
length
>
0
){
if
(
this
.
featureGroup
.
getLayers
().
length
>
0
)
{
mapUtil
mapUtil
.
getMap
()
.
getMap
()
.
fitBounds
(
this
.
featureGroup
.
getBounds
(),
{
padding
:
[
25
,
25
]
});
.
fitBounds
(
this
.
featureGroup
.
getBounds
(),
{
padding
:
[
25
,
25
]
});
}
else
{
mapUtil
.
getMap
().
zoomOut
(
1
);
}
}
else
{
mapUtil
.
getMap
()
.
zoomOut
(
1
);
}
}
}
},
},
initMap
()
{
initMap
()
{
console
.
log
(
this
)
console
.
log
(
this
)
;
this
.
zoom
=
this
.
$route
.
query
.
zoom
||
""
;
this
.
zoom
=
this
.
$route
.
query
.
zoom
||
""
;
this
.
lat
=
this
.
$route
.
query
.
lat
||
""
;
this
.
lat
=
this
.
$route
.
query
.
lat
||
""
;
this
.
lng
=
this
.
$route
.
query
.
lng
||
""
;
this
.
lng
=
this
.
$route
.
query
.
lng
||
""
;
...
@@ -373,47 +376,60 @@ export default {
...
@@ -373,47 +376,60 @@ export default {
});
});
// --------- End sidebar events ----------
// --------- End sidebar events ----------
const
url
=
`
${
this
.
$store
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
projects/
${
this
.
$route
.
params
.
slug
}
/feature/?output=geojson`
;
this
.
getFeaturesAsGeojson
();
this
.
$store
.
commit
(
"
DISPLAY_LOADER
"
,
"
Récupération des signalements en cours...
"
);
axios
.
get
(
url
)
.
then
((
response
)
=>
{
if
(
response
.
status
===
200
&&
response
.
data
.
features
.
length
>
0
)
{
this
.
loadFeatures
(
response
.
data
.
features
);
}
this
.
$store
.
commit
(
"
DISCARD_LOADER
"
);
})
.
catch
((
error
)
=>
{
this
.
$store
.
commit
(
"
DISCARD_LOADER
"
);
throw
error
;
});
setTimeout
(
setTimeout
(
function
()
{
function
()
{
let
project_id
=
this
.
$route
.
params
.
slug
.
split
(
'
-
'
)[
0
];
let
project_id
=
this
.
$route
.
params
.
slug
.
split
(
"
-
"
)[
0
];
const
mvtUrl
=
`
${
this
.
$store
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
/features.mvt/?tile={z}/{x}/{y}&project_id=
${
project_id
}
`
;
const
mvtUrl
=
`
${
this
.
$store
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
/features.mvt/?tile={z}/{x}/{y}&project_id=
${
project_id
}
`
;
mapUtil
.
addVectorTileLayer
(
mvtUrl
,
this
.
$route
.
params
.
slug
,
this
.
$store
.
state
.
feature_type
.
feature_types
,
this
.
form
);
mapUtil
.
addVectorTileLayer
(
mvtUrl
,
this
.
$route
.
params
.
slug
,
this
.
$store
.
state
.
feature_type
.
feature_types
,
this
.
form
);
mapUtil
.
addGeocoders
(
this
.
$store
.
state
.
configuration
);
mapUtil
.
addGeocoders
(
this
.
$store
.
state
.
configuration
);
}.
bind
(
this
),
}.
bind
(
this
),
1000
1000
);
);
},
},
getFeaturesAsGeojson
()
{
const
url
=
`
${
this
.
$store
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
projects/
${
this
.
$route
.
params
.
slug
}
/feature/?output=geojson`
;
this
.
$store
.
commit
(
"
DISPLAY_LOADER
"
,
"
Récupération des signalements en cours...
"
);
axios
.
get
(
url
)
.
then
((
response
)
=>
{
if
(
response
.
status
===
200
&&
response
.
data
.
features
.
length
>
0
)
{
this
.
loadFeatures
(
response
.
data
.
features
);
}
this
.
$store
.
commit
(
"
DISCARD_LOADER
"
);
})
.
catch
((
error
)
=>
{
this
.
$store
.
commit
(
"
DISCARD_LOADER
"
);
throw
error
;
});
},
loadFeatures
(
features
)
{
loadFeatures
(
features
)
{
this
.
geojsonFeatures
=
features
;
this
.
geojsonFeatures
=
features
;
const
urlParams
=
new
URLSearchParams
(
window
.
location
.
search
);
const
urlParams
=
new
URLSearchParams
(
window
.
location
.
search
);
const
featureType
=
urlParams
.
get
(
"
feature_type
"
);
const
featureType
=
urlParams
.
get
(
"
feature_type
"
);
const
featureStatus
=
urlParams
.
get
(
"
status
"
);
const
featureStatus
=
urlParams
.
get
(
"
status
"
);
const
featureTitle
=
urlParams
.
get
(
"
title
"
);
const
featureTitle
=
urlParams
.
get
(
"
title
"
);
this
.
featureGroup
=
mapUtil
.
addFeatures
(
this
.
geojsonFeatures
,
{
this
.
featureGroup
=
mapUtil
.
addFeatures
(
featureType
,
this
.
geojsonFeatures
,
featureStatus
,
{
featureTitle
,
featureType
,
},
false
,
this
.
$store
.
state
.
feature_type
.
feature_types
);
featureStatus
,
featureTitle
,
},
false
,
this
.
$store
.
state
.
feature_type
.
feature_types
);
// Fit the map to bound only if no initial zoom and center are defined
// Fit the map to bound only if no initial zoom and center are defined
if
(
if
(
(
this
.
lat
===
""
||
this
.
lng
===
""
||
this
.
zoom
===
""
)
&&
(
this
.
lat
===
""
||
this
.
lng
===
""
||
this
.
zoom
===
""
)
&&
...
...
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