1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

fallback and message if openlab server not available

This commit is contained in:
Nicolas Florentin 2016-04-25 10:06:35 +02:00
parent 1a446bf646
commit 5403386c75
4 changed files with 6 additions and 4 deletions

View File

@ -144,8 +144,8 @@ class ProjectsController
##
# Controller used on projects listing page
##
Application.Controllers.controller "ProjectsController", ["$scope", "$state", 'Project', 'machinesPromise', 'themesPromise', 'componentsPromise', 'paginationService', 'OpenlabProject', '$window', 'growl'
, ($scope, $state, Project, machinesPromise, themesPromise, componentsPromise, paginationService, OpenlabProject, $window, growl) ->
Application.Controllers.controller "ProjectsController", ["$scope", "$state", 'Project', 'machinesPromise', 'themesPromise', 'componentsPromise', 'paginationService', 'OpenlabProject', '$window', 'growl', '_t'
, ($scope, $state, Project, machinesPromise, themesPromise, componentsPromise, paginationService, OpenlabProject, $window, growl, _t) ->
### PRIVATE STATIC CONSTANTS ###
@ -209,7 +209,7 @@ Application.Controllers.controller "ProjectsController", ["$scope", "$state", 'P
$scope.projectsPagination = new paginationService.Instance(OpenlabProject, 1, PROJECTS_PER_PAGE, null, { }, loadMoreOpenlabCallback)
OpenlabProject.query { q: $scope.search.q, page: 1, per_page: PROJECTS_PER_PAGE }, (projectsPromise)->
if projectsPromise.errors?
# AJOUTER UN MESSAGE GROWL INTERNATIONALISER
growl.error(_t('openlab_search_not_available_at_the_moment'))
$scope.openlab.searchOverWholeNetwork = false
$scope.triggerSearch()
else

View File

@ -5,7 +5,7 @@ class API::OpenlabProjectsController < API::ApiController
begin
render json: PROJECTS.search(params[:q], page: params[:page], per_page: params[:per_page]).response.body
rescue Errno::ECONNREFUSED
render json: { errors: ['service unavailable'] } and return
render json: { errors: ['service unavailable'] }
end
end
end

View File

@ -119,6 +119,7 @@ en:
# projects gallery
the_fablab_projects: "The Fab Lab projects"
search_over_the_whole_network: "Search over the whole network"
openlab_search_not_available_at_the_moment: "Search over the whole network is not available at the moment. You still can search over the projects of this platform."
add_a_project: "Add a project"
filter_projects: "Filter projects:"
reset_all_filters: "Reset all filters"

View File

@ -119,6 +119,7 @@ fr:
# galerie des projets
the_fablab_projects: "Les projets du FabLab"
search_over_the_whole_network: "Chercher sur tout le réseau"
openlab_search_not_available_at_the_moment: "La recherche sur tout le réseau n'est pas disponible pour le moment. Vous ne pouvez cependant effectuer une recherche parmis les projets de cette plateforme."
add_a_project: "Ajouter un projet"
filter_projects: "Filtrer les projets :"
reset_all_filters: "Réinitialiser tous les filtres"