Skip to content

Commit bc33f58

Browse files
jleveuglejleveugle
authored andcommitted
fix(sidebar): add translations and right state in list of projects
1 parent 7eca479 commit bc33f58

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

packages/manager/apps/public-cloud/src/sidebar/project-list/project-list.controller.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
export default class ProjectListController {
22
/* @ngInject */
3-
constructor(publicCloud, iceberg) {
3+
constructor($injector, $q, $translate, publicCloud, iceberg) {
4+
this.$injector = $injector;
5+
this.$q = $q;
6+
this.$translate = $translate;
47
this.publicCloud = publicCloud;
58
this.iceberg = iceberg;
69
}
710

811
$onInit() {
912
this.getProjects();
13+
this.getTranslations();
14+
}
15+
16+
getTranslations() {
17+
this.isLoadingTranslations = true;
18+
19+
return this.$injector.invoke(/* @ngTranslationsInject:json ./translations */)
20+
.then(() => this.$translate.refresh())
21+
.finally(() => {
22+
this.isLoadingTranslations = false;
23+
});
1024
}
1125

1226
getProjects() {

packages/manager/apps/public-cloud/src/sidebar/project-list/project-list.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
<div>
1+
<div data-ng-if="!$ctrl.isLoadingTranslations">
22
<a class="btn btn-primary py-1 px-2"
33
data-ui-sref="pci.projects.new"
4-
style="background-color: rgb(40, 89, 192); color: #fff;">
5-
Create new project
4+
style="background-color: rgb(40, 89, 192); color: #fff;"
5+
data-translate="cloud_sidebar_projectlist_create_project"
6+
>
67
</a>
78
<div data-ng-if="$ctrl.isLoading" class="d-flex mt-4">
8-
<span class="mr-3" style="font-size: 0.8rem;">Chargement de la liste de vos&nbsp;projets</span>
9+
<span class="mr-3" style="font-size: 0.8rem;" data-translate="cloud_sidebar_projectlist_loading_projects"></span>
910
<oui-spinner class="my-auto ml-auto" size="s"></oui-spinner>
1011
</div>
1112
<div data-ng-if="!$ctrl.isLoading">
1213
<div class="d-flex" data-ng-if="$ctrl.err">
13-
<span class="mr-3" style="font-size: 0.8rem;">Une erreur est survenue lors de la récupération de la liste de projets ({{ ::$ctrl.err.statusText }})</span>
14+
<span class="mr-3" style="font-size: 0.8rem;" data-translate="cloud_sidebar_projectlist_error" data-translate-params="{ err: $ctrl.err.statusText }"></span>
1415
<button type="button" class="p-0 my-auto">
1516
<i class="fas fa-sync"></i>
1617
</button>
1718
</div>
1819
<div class="mt-3" data-ng-if="$ctrl.projects && $ctrl.projects.length > 0">
19-
<strong class="text-white">Mes projets&nbsp;:</strong>
20+
<strong class="text-white" data-translate="cloud_sidebar_projectlist_title"></strong>
2021
<ul class="list-unstyled mt-2 mb-5">
2122
<li data-ng-repeat="project in $ctrl.projects track by $index">
2223
<a ui-sref="pci.projects.project({ projectId: project.project_id })" class="d-flex text-white">
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cloud_sidebar_projectlist_create_project": "Créer un nouveau projet",
3+
"cloud_sidebar_projectlist_loading_projects": "Chargement de la liste de vos projets",
4+
"cloud_sidebar_projectlist_error": "Une erreur est survenue lors de la récupération de la liste de projets ({{ err }})",
5+
"cloud_sidebar_projectlist_title": "Mes projets :"
6+
}

0 commit comments

Comments
 (0)