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
fc14b3c2
Commit
fc14b3c2
authored
3 years ago
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
add user to idgo catalog request & handle error
parent
aba2f5ee
No related branches found
No related tags found
4 merge requests
!295
Version 3.0.0
,
!247
REDMINE_ISSUE-12787
,
!245
REDMINE_ISSUE-12786
,
!233
REDMINE_ISSUE-12378
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/services/misc-api.js
+16
-12
16 additions, 12 deletions
src/services/misc-api.js
src/views/Catalog.vue
+21
-13
21 additions, 13 deletions
src/views/Catalog.vue
with
37 additions
and
25 deletions
src/services/misc-api.js
+
16
−
12
View file @
fc14b3c2
...
@@ -6,18 +6,22 @@ const baseUrl = store.state.configuration.VUE_APP_DJANGO_API_BASE;
...
@@ -6,18 +6,22 @@ const baseUrl = store.state.configuration.VUE_APP_DJANGO_API_BASE;
const
miscAPI
=
{
const
miscAPI
=
{
async
getIdgoCatalog
()
{
async
getIdgoCatalog
(
username
)
{
const
response
=
await
axios
.
get
(
try
{
`
${
baseUrl
}
idgo-catalog/`
const
response
=
await
axios
.
get
(
);
`
${
baseUrl
}
idgo-catalog/?user=
${
username
}
`
if
(
);
response
.
status
===
200
&&
if
(
response
.
data
response
.
status
===
200
&&
)
{
response
.
data
return
response
.
data
;
)
{
}
else
{
return
response
.
data
;
return
null
;
}
else
{
}
return
null
;
}
}
catch
(
err
)
{
return
err
;
}
},
},
async
getExternalGeojson
(
queryParams
)
{
async
getExternalGeojson
(
queryParams
)
{
...
...
This diff is collapsed.
Click to expand it.
src/views/Catalog.vue
+
21
−
13
View file @
fc14b3c2
...
@@ -11,9 +11,9 @@
...
@@ -11,9 +11,9 @@
<div>
Dataset
</div>
<div>
Dataset
</div>
<div>
Ressource
</div>
<div>
Ressource
</div>
</div>
</div>
<div>
<div
v-if=
"resources && resources.length > 0"
>
<div
<div
v-for=
"(resource, index) in paginatedRes
s
ources"
v-for=
"(resource, index) in paginatedResources"
:key=
"`$
{resource.resource_name}-${index}`"
:key=
"`$
{resource.resource_name}-${index}`"
@click="selectResource(resource)"
@click="selectResource(resource)"
:class="[
:class="[
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
<div>
{{
resource
.
resource_name
}}
</div>
<div>
{{
resource
.
resource_name
}}
</div>
</div>
</div>
</div>
</div>
<div
class=
"no-response"
v-else
>
Pas de données trouvées pour l'utilisateur
{{
this
.
user
.
username
}}
</div>
</div>
</div>
<div
class=
"pagination_wrapper"
>
<div
class=
"pagination_wrapper"
>
...
@@ -39,7 +40,7 @@
...
@@ -39,7 +40,7 @@
>
>
Affichage de l'élément
{{
pagination
.
start
+
1
}}
à
Affichage de l'élément
{{
pagination
.
start
+
1
}}
à
{{
displayedPageEnd
}}
{{
displayedPageEnd
}}
sur
{{
res
s
ources
.
length
}}
éléments
sur
{{
resources
.
length
}}
éléments
</div>
</div>
<div
<div
v-if=
"nbPages.length > 1"
v-if=
"nbPages.length > 1"
...
@@ -96,7 +97,7 @@
...
@@ -96,7 +97,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
mapGetters
}
from
"
vuex
"
;
import
{
mapGetters
,
mapState
}
from
"
vuex
"
;
import
miscAPI
from
"
@/services/misc-api
"
;
import
miscAPI
from
"
@/services/misc-api
"
;
export
default
{
export
default
{
...
@@ -104,7 +105,7 @@ export default {
...
@@ -104,7 +105,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
res
s
ources
:
[],
resources
:
[],
pagination
:
{
pagination
:
{
currentPage
:
1
,
currentPage
:
1
,
pagesize
:
15
,
pagesize
:
15
,
...
@@ -116,15 +117,16 @@ export default {
...
@@ -116,15 +117,16 @@ export default {
},
},
computed
:
{
computed
:
{
...
mapState
([
"
user
"
]),
...
mapGetters
([
"
project
"
,
"
permissions
"
]),
...
mapGetters
([
"
project
"
,
"
permissions
"
]),
...
mapGetters
(
"
feature_type
"
,
[
"
feature_type
"
]),
...
mapGetters
(
"
feature_type
"
,
[
"
feature_type
"
]),
paginatedRes
s
ources
()
{
paginatedResources
()
{
return
this
.
res
s
ources
.
slice
(
this
.
pagination
.
start
,
this
.
pagination
.
end
);
return
this
.
resources
.
slice
(
this
.
pagination
.
start
,
this
.
pagination
.
end
);
},
},
nbPages
()
{
nbPages
()
{
let
N
=
Math
.
ceil
(
this
.
res
s
ources
.
length
/
this
.
pagination
.
pagesize
);
let
N
=
Math
.
ceil
(
this
.
resources
.
length
/
this
.
pagination
.
pagesize
);
const
arr
=
[...
Array
(
N
).
keys
()].
map
(
function
(
x
)
{
const
arr
=
[...
Array
(
N
).
keys
()].
map
(
function
(
x
)
{
++
x
;
++
x
;
return
x
;
return
x
;
...
@@ -133,8 +135,8 @@ export default {
...
@@ -133,8 +135,8 @@ export default {
},
},
displayedPageEnd
()
{
displayedPageEnd
()
{
return
this
.
res
s
ources
.
length
<=
this
.
pagination
.
end
return
this
.
resources
.
length
<=
this
.
pagination
.
end
?
this
.
res
s
ources
.
length
?
this
.
resources
.
length
:
this
.
pagination
.
end
;
:
this
.
pagination
.
end
;
},
},
},
},
...
@@ -160,7 +162,7 @@ export default {
...
@@ -160,7 +162,7 @@ export default {
},
},
toNextPage
()
{
toNextPage
()
{
if
(
this
.
pagination
.
end
<
this
.
res
s
ources
.
length
)
{
if
(
this
.
pagination
.
end
<
this
.
resources
.
length
)
{
this
.
pagination
.
start
+=
this
.
pagination
.
pagesize
;
this
.
pagination
.
start
+=
this
.
pagination
.
pagesize
;
this
.
pagination
.
end
+=
this
.
pagination
.
pagesize
;
this
.
pagination
.
end
+=
this
.
pagination
.
pagesize
;
this
.
pagination
.
currentPage
+=
1
;
this
.
pagination
.
currentPage
+=
1
;
...
@@ -192,9 +194,9 @@ export default {
...
@@ -192,9 +194,9 @@ export default {
mounted
()
{
mounted
()
{
this
.
$store
.
commit
(
"
DISPLAY_LOADER
"
,
"
Interrogation du catologue datasud.
"
);
this
.
$store
.
commit
(
"
DISPLAY_LOADER
"
,
"
Interrogation du catologue datasud.
"
);
this
.
$store
.
dispatch
(
"
GET_PROJECT_INFO
"
,
this
.
$route
.
params
.
slug
);
this
.
$store
.
dispatch
(
"
GET_PROJECT_INFO
"
,
this
.
$route
.
params
.
slug
);
miscAPI
.
getIdgoCatalog
().
then
((
data
)
=>
{
miscAPI
.
getIdgoCatalog
(
this
.
user
.
username
).
then
((
data
)
=>
{
if
(
data
&&
data
.
layers
)
this
.
resources
=
data
.
layers
;
this
.
$store
.
commit
(
"
DISCARD_LOADER
"
);
this
.
$store
.
commit
(
"
DISCARD_LOADER
"
);
this
.
ressources
=
data
.
layers
;
});
});
},
},
};
};
...
@@ -237,6 +239,12 @@ h1 {
...
@@ -237,6 +239,12 @@ h1 {
background-color
:
#e0e0e0
;
background-color
:
#e0e0e0
;
}
}
.no-response
{
padding
:
1rem
;
text-align
:
center
;
color
:
#585858
;
}
.import
{
.import
{
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
...
...
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