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
a705aa0d
Commit
a705aa0d
authored
3 years ago
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
WIP
parent
a81194fb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!162
REDMINE_ISSUE-11784
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/views/feature/Feature_list.vue
+51
-39
51 additions, 39 deletions
src/views/feature/Feature_list.vue
with
51 additions
and
39 deletions
src/views/feature/Feature_list.vue
+
51
−
39
View file @
a705aa0d
...
@@ -30,9 +30,7 @@
...
@@ -30,9 +30,7 @@
></a>
></a>
<div
class=
"item"
>
<div
class=
"item"
>
<h4>
<h4>
{{
filteredFeatures
.
length
}}
signalement
{{
{{
featuresCount
}}
signalement
{{
featuresCount
>
1
?
"
s
"
:
""
}}
filteredFeatures
.
length
>
1
?
"
s
"
:
""
}}
</h4>
</h4>
</div>
</div>
...
@@ -139,11 +137,11 @@
...
@@ -139,11 +137,11 @@
<div
v-show=
"showMap"
class=
"ui tab active map-container"
data-tab=
"map"
>
<div
v-show=
"showMap"
class=
"ui tab active map-container"
data-tab=
"map"
>
<div
id=
"map"
ref=
"map"
></div>
<div
id=
"map"
ref=
"map"
></div>
<SidebarLayers
v-if=
"base
M
aps && map"
/>
<SidebarLayers
v-if=
"base
m
aps && map"
/>
</div>
</div>
<FeatureListTable
<FeatureListTable
v-show=
"!showMap"
v-show=
"!showMap"
:filteredFeatures=
"
filtered
Features"
:filteredFeatures=
"
geojson
Features"
:checkedFeatures.sync=
"checkedFeatures"
:checkedFeatures.sync=
"checkedFeatures"
/>
/>
...
@@ -188,11 +186,11 @@ import FeatureListTable from "@/components/feature/FeatureListTable";
...
@@ -188,11 +186,11 @@ import FeatureListTable from "@/components/feature/FeatureListTable";
import
Dropdown
from
"
@/components/Dropdown.vue
"
;
import
Dropdown
from
"
@/components/Dropdown.vue
"
;
const
axios
=
require
(
"
axios
"
);
const
axios
=
require
(
"
axios
"
);
axios
.
defaults
.
headers
.
common
[
'
X-CSRFToken
'
]
=
(
name
=>
{
axios
.
defaults
.
headers
.
common
[
"
X-CSRFToken
"
]
=
(
(
name
)
=>
{
var
re
=
new
RegExp
(
name
+
"
=([^;]+)
"
);
var
re
=
new
RegExp
(
name
+
"
=([^;]+)
"
);
var
value
=
re
.
exec
(
document
.
cookie
);
var
value
=
re
.
exec
(
document
.
cookie
);
return
(
value
!==
null
)
?
unescape
(
value
[
1
])
:
null
;
return
value
!==
null
?
unescape
(
value
[
1
])
:
null
;
})(
'
csrftoken
'
);
})(
"
csrftoken
"
);
export
default
{
export
default
{
name
:
"
Feature_list
"
,
name
:
"
Feature_list
"
,
...
@@ -239,6 +237,9 @@ export default {
...
@@ -239,6 +237,9 @@ export default {
},
},
geojsonFeatures
:
[],
geojsonFeatures
:
[],
featuresCount
:
0
,
previous
:
null
,
next
:
null
,
filterStatus
:
null
,
filterStatus
:
null
,
filterType
:
null
,
filterType
:
null
,
baseUrl
:
this
.
$store
.
state
.
configuration
.
BASE_URL
,
baseUrl
:
this
.
$store
.
state
.
configuration
.
BASE_URL
,
...
@@ -246,6 +247,8 @@ export default {
...
@@ -246,6 +247,8 @@ export default {
zoom
:
null
,
zoom
:
null
,
lat
:
null
,
lat
:
null
,
lng
:
null
,
lng
:
null
,
limit
:
15
,
offset
:
0
,
showMap
:
true
,
showMap
:
true
,
showAddFeature
:
false
,
showAddFeature
:
false
,
};
};
...
@@ -255,12 +258,13 @@ export default {
...
@@ -255,12 +258,13 @@ export default {
...
mapGetters
([
"
project
"
,
"
permissions
"
]),
...
mapGetters
([
"
project
"
,
"
permissions
"
]),
...
mapState
(
"
feature
"
,
[
"
checkedFeatures
"
]),
...
mapState
(
"
feature
"
,
[
"
checkedFeatures
"
]),
...
mapState
(
"
feature_type
"
,
[
"
feature_types
"
]),
...
mapState
(
"
feature_type
"
,
[
"
feature_types
"
]),
...
mapState
(
"
map
"
,
[
"
basemaps
"
]),
baseMaps
()
{
API_BASE_URL
()
{
return
this
.
$store
.
state
.
map
.
basemaps
;
return
this
.
$store
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
;
},
},
filteredFeatures
()
{
/*
filteredFeatures() {
let results = this.geojsonFeatures;
let results = this.geojsonFeatures;
if (this.form.type.selected) {
if (this.form.type.selected) {
results = results.filter(
results = results.filter(
...
@@ -283,7 +287,7 @@ export default {
...
@@ -283,7 +287,7 @@ export default {
});
});
}
}
return results;
return results;
},
},
*/
statusChoices
()
{
statusChoices
()
{
//* if project is not moderate, remove pending status
//* if project is not moderate, remove pending status
...
@@ -293,13 +297,13 @@ export default {
...
@@ -293,13 +297,13 @@ export default {
},
},
},
},
watch
:
{
/*
watch: {
filteredFeatures(newValue, oldValue) {
filteredFeatures(newValue, oldValue) {
if (newValue && newValue !== oldValue) {
if (newValue && newValue !== oldValue) {
this.onFilterChange();
this.onFilterChange();
}
}
},
},
},
},
*/
methods
:
{
methods
:
{
modalAllDelete
()
{
modalAllDelete
()
{
...
@@ -307,15 +311,15 @@ export default {
...
@@ -307,15 +311,15 @@ export default {
},
},
deleteFeature
(
feature_id
)
{
deleteFeature
(
feature_id
)
{
const
url
=
`
${
this
.
$store
.
state
.
configuration
.
VUE_APP_DJANGO_
API_BASE
}
features/
${
feature_id
}
/?project__slug=
${
this
.
project
.
slug
}
`
;
const
url
=
`
${
this
.
API_BASE
_URL
}
features/
${
feature_id
}
/?project__slug=
${
this
.
project
.
slug
}
`
;
axios
axios
.
delete
(
url
,
{})
.
delete
(
url
,
{})
.
then
(()
=>
{
.
then
(()
=>
{
if
(
!
this
.
modalAllDeleteOpen
)
{
if
(
!
this
.
modalAllDeleteOpen
)
{
this
.
$store
this
.
$store
.
dispatch
(
"
feature/GET_PROJECT_FEATURES
"
,
this
.
project
.
slug
)
.
dispatch
(
"
feature/GET_PROJECT_FEATURES
"
,
this
.
project
.
slug
)
// ? Toujours nécessaire de mettre à jour les features classiques ?
.
then
(()
=>
{
.
then
(()
=>
{
this
.
getNloadGeojson
Features
();
this
.
update
Features
();
this
.
checkedFeatures
.
splice
(
feature_id
);
this
.
checkedFeatures
.
splice
(
feature_id
);
});
});
}
}
...
@@ -335,8 +339,10 @@ export default {
...
@@ -335,8 +339,10 @@ export default {
},
},
onFilterChange
()
{
onFilterChange
()
{
// ? Besoin de faire un fetch avec nouveau filtres ici ?
if
(
this
.
featureGroup
)
{
if
(
this
.
featureGroup
)
{
const
features
=
this
.
filteredFeatures
;
//const features = this.filteredFeatures;
const
features
=
this
.
geojsonFeatures
;
this
.
featureGroup
.
clearLayers
();
this
.
featureGroup
.
clearLayers
();
this
.
featureGroup
=
mapUtil
.
addFeatures
(
this
.
featureGroup
=
mapUtil
.
addFeatures
(
features
,
features
,
...
@@ -381,26 +387,23 @@ export default {
...
@@ -381,26 +387,23 @@ export default {
});
});
// --------- End sidebar events ----------
// --------- End sidebar events ----------
this
.
getNloadGeojsonFeatures
();
this
.
updateFeatures
();
setTimeout
(
setTimeout
(()
=>
{
function
()
{
let
project_id
=
this
.
$route
.
params
.
slug
.
split
(
"
-
"
)[
0
];
let
project_id
=
this
.
$route
.
params
.
slug
.
split
(
"
-
"
)[
0
];
const
mvtUrl
=
`
${
this
.
API_BASE_URL
}
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
(
mapUtil
.
addVectorTileLayer
(
mvtUrl
,
mvtUrl
,
this
.
$route
.
params
.
slug
,
this
.
$route
.
params
.
slug
,
this
.
$store
.
state
.
feature_type
.
feature_types
,
this
.
$store
.
state
.
feature_type
.
feature_types
,
this
.
form
this
.
form
);
);
mapUtil
.
addGeocoders
(
this
.
$store
.
state
.
configuration
);
mapUtil
.
addGeocoders
(
this
.
$store
.
state
.
configuration
);
},
1000
);
}.
bind
(
this
),
1000
);
},
},
getNloadGeojson
Features
()
{
update
Features
()
{
const
url
=
`
${
this
.
$store
.
state
.
configuration
.
VUE_APP_DJANGO_
API_BASE
}
projects/
${
this
.
$route
.
params
.
slug
}
/feature/?output=geojson`
;
const
url
=
`
${
this
.
API_BASE
_URL
}
projects/
${
this
.
$route
.
params
.
slug
}
/feature
-paginated
/?output=geojson
&limit=
${
this
.
limit
}
&offset=
${
this
.
offset
}
`
;
this
.
$store
.
commit
(
this
.
$store
.
commit
(
"
DISPLAY_LOADER
"
,
"
DISPLAY_LOADER
"
,
"
Récupération des signalements en cours...
"
"
Récupération des signalements en cours...
"
...
@@ -408,8 +411,13 @@ export default {
...
@@ -408,8 +411,13 @@ export default {
axios
axios
.
get
(
url
)
.
get
(
url
)
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
if
(
response
.
status
===
200
&&
response
.
data
.
features
.
length
>
0
)
{
if
(
response
.
status
===
200
)
{
this
.
loadFeatures
(
response
.
data
.
features
);
this
.
featuresCount
=
response
.
data
.
count
;
this
.
previous
=
response
.
data
.
previous
;
this
.
next
=
response
.
data
.
next
;
if
(
response
.
data
.
results
.
features
.
length
>
0
)
{
this
.
loadFeatures
(
response
.
data
.
results
.
features
);
}
}
}
this
.
$store
.
commit
(
"
DISCARD_LOADER
"
);
this
.
$store
.
commit
(
"
DISCARD_LOADER
"
);
})
})
...
@@ -455,7 +463,11 @@ export default {
...
@@ -455,7 +463,11 @@ export default {
created
()
{
created
()
{
if
(
!
this
.
project
)
{
if
(
!
this
.
project
)
{
this
.
$store
.
dispatch
(
"
GET_PROJECT_INFO
"
,
this
.
$route
.
params
.
slug
,
"
noFeatures
"
);
this
.
$store
.
dispatch
(
"
GET_PROJECT_INFO
"
,
this
.
$route
.
params
.
slug
,
"
noFeatures
"
);
}
}
},
},
...
...
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