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
c96c200d
Commit
c96c200d
authored
3 years ago
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
get linked_features to display in feature_detaid
parent
38608143
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/services/feature-api.js
+14
-0
14 additions, 0 deletions
src/services/feature-api.js
src/store/modules/feature.js
+14
-4
14 additions, 4 deletions
src/store/modules/feature.js
src/views/feature/Feature_detail.vue
+20
-27
20 additions, 27 deletions
src/views/feature/Feature_detail.vue
with
48 additions
and
31 deletions
src/services/feature-api.js
+
14
−
0
View file @
c96c200d
...
...
@@ -52,6 +52,20 @@ const featureAPI = {
return
null
;
}
},
async
getFeatureLinks
(
featureId
)
{
const
response
=
await
axios
.
get
(
`
${
baseUrl
}
features/
${
featureId
}
/feature-links/`
);
if
(
response
.
status
===
200
&&
response
.
data
)
{
return
response
.
data
;
}
else
{
return
null
;
}
},
}
export
default
featureAPI
;
This diff is collapsed.
Click to expand it.
src/store/modules/feature.js
+
14
−
4
View file @
c96c200d
...
...
@@ -15,7 +15,8 @@ const feature = {
linkedFormset
:
[],
features
:
[],
form
:
null
,
extra_form
:
[]
extra_form
:
[],
linked_features
:
[],
},
mutations
:
{
SET_FEATURES
(
state
,
features
)
{
...
...
@@ -56,6 +57,9 @@ const feature = {
REMOVE_LINKED_FORM
(
state
,
payload
)
{
state
.
linkedFormset
=
state
.
linkedFormset
.
filter
(
form
=>
form
.
dataKey
!==
payload
);
},
SET_LINKED_FEATURES
(
state
,
payload
)
{
state
.
linked_features
=
payload
;
},
},
getters
:
{
},
...
...
@@ -111,8 +115,8 @@ const feature = {
.
catch
((
error
)
=>
{
throw
error
;
});
}
else
{
axios
}
else
{
axios
.
post
(
`
${
this
.
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
features/`
,
geojson
)
.
then
((
response
)
=>
{
if
(
response
.
status
===
201
&&
response
.
data
)
{
...
...
@@ -153,7 +157,13 @@ const feature = {
throw
error
;
});
}
}
},
/* GET_FEATURE_LINK({ commit }, featureId) {
featureAPI
.getlinked_features(featureId)
.then((data) => commit("SET_FEATURE_LINKS", data));
} */
//DELETE_FEATURE({ state }, feature_slug) {
//console.log("Deleting feature:", feature_slug, state)
...
...
This diff is collapsed.
Click to expand it.
src/views/feature/Feature_detail.vue
+
20
−
27
View file @
c96c200d
...
...
@@ -138,8 +138,6 @@
</tbody>
</table>
<!--
<small>
{% for link in linked_features %} {% endfor %}
</small>
// ? EMPTY ?!??? -->
<h3>
Liaison entre signalements
</h3>
<table
class=
"ui very basic table"
>
<tbody>
...
...
@@ -153,8 +151,8 @@
:to=
"
{
name: 'details-signalement',
params: {
slug_type_signal: link.feature_to.feature_type
.
slug,
slug_signal: link.feature_to.
title
,
slug_type_signal: link.feature_to.feature_type
_
slug,
slug_signal: link.feature_to.
feature_id
,
},
}"
>
{{
link
.
feature_to
.
title
}}
</router-link
...
...
@@ -391,21 +389,7 @@ export default {
data
()
{
return
{
isCanceling
:
false
,
mock_linked_features
:
[
/* {
relation_type: "Doublon",
feature_to: {
title: "Éolienne offshore",
creator: "Mr Dupont",
created_on: new Date().toDateString(),
feature_type: {
title: "Éolienne",
},
},
}, */
],
attachments
:
[],
// TODO : Récupérer events depuis l'api
events
:
[],
comment_form
:
{
attachment_file
:
{
...
...
@@ -432,6 +416,7 @@ export default {
computed
:
{
...
mapState
([
"
user
"
]),
...
mapState
(
"
feature
"
,
[
"
linked_features
"
]),
DJANGO_BASE_URL
:
function
()
{
return
this
.
$store
.
state
.
configuration
.
VUE_APP_DJANGO_BASE
;
},
...
...
@@ -443,12 +428,6 @@ export default {
)
||
[]
);
},
linked_features
:
function
()
{
// todo: vérifier avec données réels si ça fonctionne correctement
//return this.mock_linked_features.filter((el) => el.feature_to);
return
[];
},
},
methods
:
{
...
...
@@ -559,6 +538,20 @@ export default {
throw
error
;
});
},
getFeatureAttachments
()
{
featureAPI
.
getFeatureAttachments
(
this
.
$route
.
params
.
slug_signal
)
.
then
((
data
)
=>
(
this
.
attachments
=
data
));
},
getLinkedFeatures
()
{
featureAPI
.
getFeatureLinks
(
this
.
$route
.
params
.
slug_signal
)
.
then
((
data
)
=>
this
.
$store
.
commit
(
"
feature/SET_LINKED_FEATURES
"
,
data
)
);
},
},
created
()
{
...
...
@@ -569,9 +562,9 @@ export default {
"
feature_type/SET_CURRENT_FEATURE_TYPE_SLUG
"
,
this
.
$route
.
params
.
slug_type_signal
);
featureAPI
.
getFeatureAttachments
(
this
.
$route
.
params
.
slug_signal
)
.
then
((
data
)
=>
(
this
.
attachments
=
data
)
);
this
.
getFeatureAttachments
()
;
this
.
getLinkedFeatures
(
);
},
mounted
()
{
...
...
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