aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/core/server/server.service.ts15
1 files changed, 12 insertions, 3 deletions
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts
index 553ad8af6..f54e63efd 100644
--- a/client/src/app/core/server/server.service.ts
+++ b/client/src/app/core/server/server.service.ts
@@ -60,7 +60,7 @@ export class ServerService {
60 } 60 }
61 61
62 loadVideoCategories () { 62 loadVideoCategories () {
63 return this.loadVideoAttributeEnum('categories', this.videoCategories, this.videoCategoriesLoaded) 63 return this.loadVideoAttributeEnum('categories', this.videoCategories, this.videoCategoriesLoaded, true)
64 } 64 }
65 65
66 loadVideoLicences () { 66 loadVideoLicences () {
@@ -68,7 +68,7 @@ export class ServerService {
68 } 68 }
69 69
70 loadVideoLanguages () { 70 loadVideoLanguages () {
71 return this.loadVideoAttributeEnum('languages', this.videoLanguages, this.videoLanguagesLoaded) 71 return this.loadVideoAttributeEnum('languages', this.videoLanguages, this.videoLanguagesLoaded, true)
72 } 72 }
73 73
74 loadVideoPrivacies () { 74 loadVideoPrivacies () {
@@ -102,7 +102,8 @@ export class ServerService {
102 private loadVideoAttributeEnum ( 102 private loadVideoAttributeEnum (
103 attributeName: 'categories' | 'licences' | 'languages' | 'privacies', 103 attributeName: 'categories' | 'licences' | 'languages' | 'privacies',
104 hashToPopulate: { id: number, label: string }[], 104 hashToPopulate: { id: number, label: string }[],
105 notifier: ReplaySubject<boolean> 105 notifier: ReplaySubject<boolean>,
106 sort = false
106 ) { 107 ) {
107 return this.http.get(ServerService.BASE_VIDEO_URL + attributeName) 108 return this.http.get(ServerService.BASE_VIDEO_URL + attributeName)
108 .subscribe(data => { 109 .subscribe(data => {
@@ -114,6 +115,14 @@ export class ServerService {
114 }) 115 })
115 }) 116 })
116 117
118 if (sort === true) {
119 hashToPopulate.sort((a, b) => {
120 if (a.label < b.label) return -1
121 if (a.label === b.label) return 0
122 return 1
123 })
124 }
125
117 notifier.next(true) 126 notifier.next(true)
118 }) 127 })
119 } 128 }