From b9d143dc407b0b50536ce9685ddd3aacdae878c5 Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Mon, 21 May 2018 11:32:09 +0200
Subject: [PATCH] FEAT #7730 Front

---
 ...sions-update-administration.component.html | 14 ++--
 .../actions-administration.component.ts       |  9 ---
 .../parameters-administration.component.ts    |  7 --
 .../reports-administration.component.ts       |  7 --
 ...ersions-update-administration.component.ts | 74 +++----------------
 5 files changed, 19 insertions(+), 92 deletions(-)

diff --git a/apps/maarch_entreprise/Views/versions-update-administration.component.html b/apps/maarch_entreprise/Views/versions-update-administration.component.html
index 0a0c0fc3b06..5111446a88d 100644
--- a/apps/maarch_entreprise/Views/versions-update-administration.component.html
+++ b/apps/maarch_entreprise/Views/versions-update-administration.component.html
@@ -16,14 +16,14 @@
         </mat-sidenav>
         <mat-sidenav-content>
             <div>
+                Votre version : {{versions.currentVersion}}
                 <mat-form-field>
-                        <mat-select id="entity_type" name="minorVersions" title="{{lang.availableMinorVersions}}" placeholder="{{lang.entityType}}"
-                                                            maxlength="32" required>
-                            <mat-option *ngFor="let minorVersion of versionsList.currentMinorVersions" [value]="minorVersion.name">
-                                {{minorVersion.name}}
-                            </mat-option>
-                        </mat-select>
-                    </mat-form-field>
+                    <mat-select id="entity_type" name="minorVersions" title="{{lang.availableMinorVersions}}" placeholder="{{lang.entityType}}" maxlength="32" required>
+                        <mat-option *ngFor="let minorVersion of versions.currentMinorVersions" [value]="minorVersion.name">
+                            {{minorVersion.name}}
+                        </mat-option>
+                    </mat-select>
+                </mat-form-field>
             </div>
         </mat-sidenav-content>
     </mat-sidenav-container>   
diff --git a/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.ts
index 8ffdb8b7355..3f571f5513b 100644
--- a/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.ts
+++ b/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.ts
@@ -49,20 +49,11 @@ export class ActionsAdministrationComponent implements OnInit {
         this.mobileQuery.removeListener(this._mobileQueryListener);
     }
 
-    updateBreadcrumb(applicationName: string) {
-        if ($j('#ariane')[0]) {
-            $j('#ariane')[0].innerHTML = "<a href='index.php?reinit=true'>" + applicationName + "</a> > <a onclick='location.hash = \"/administration\"' style='cursor: pointer'>" + this.lang.administration + "</a> > " + this.lang.actions;
-        }
-    }
-
     ngOnInit(): void {
         this.coreUrl = angularGlobals.coreUrl;
 
         this.loading = true;
 
-        this.updateBreadcrumb(angularGlobals.applicationName);
-        $j('#inner_content').remove();
-
         this.http.get(this.coreUrl + 'rest/actions')
             .subscribe((data) => {
                 this.actions = data['actions'];
diff --git a/apps/maarch_entreprise/js/angular/app/administration/parameters-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/parameters-administration.component.ts
index 5f6fb04e844..af1baa1441f 100644
--- a/apps/maarch_entreprise/js/angular/app/administration/parameters-administration.component.ts
+++ b/apps/maarch_entreprise/js/angular/app/administration/parameters-administration.component.ts
@@ -41,12 +41,6 @@ export class ParametersAdministrationComponent implements OnInit {
         this.mobileQuery.removeListener(this._mobileQueryListener);
     }
 
-    updateBreadcrumb(applicationName: string) {
-        if ($j('#ariane')[0]) {
-            $j('#ariane')[0].innerHTML = "<a href='index.php?reinit=true'>" + applicationName + "</a> > <a onclick='location.hash = \"/administration\"' style='cursor: pointer'>" + this.lang.administration + "</a> > " + this.lang.parameters;
-        }
-    }
-
     applyFilter(filterValue: string) {
         filterValue = filterValue.trim(); // Remove whitespace
         filterValue = filterValue.toLowerCase(); // MatTableDataSource defaults to lowercase matches
@@ -54,7 +48,6 @@ export class ParametersAdministrationComponent implements OnInit {
     }
 
     ngOnInit(): void {
-        this.updateBreadcrumb(angularGlobals.applicationName);
         this.coreUrl = angularGlobals.coreUrl;
 
         this.loading = true;
diff --git a/apps/maarch_entreprise/js/angular/app/administration/reports-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/reports-administration.component.ts
index 4243a2aff9f..758685691ed 100644
--- a/apps/maarch_entreprise/js/angular/app/administration/reports-administration.component.ts
+++ b/apps/maarch_entreprise/js/angular/app/administration/reports-administration.component.ts
@@ -38,14 +38,7 @@ export class ReportsAdministrationComponent implements OnInit {
         this.mobileQuery.removeListener(this._mobileQueryListener);
     }
 
-    updateBreadcrumb(applicationName: string) {
-        if ($j('#ariane')[0]) {
-            $j('#ariane')[0].innerHTML = "<a href='index.php?reinit=true'>" + applicationName + "</a> > <a onclick='location.hash = \"/administration\"' style='cursor: pointer'>Administration</a> > " + this.lang.reports;
-        }
-    }
-
     ngOnInit(): void {
-        this.updateBreadcrumb(angularGlobals.applicationName);
         this.coreUrl = angularGlobals.coreUrl;
 
         this.loading = true;
diff --git a/apps/maarch_entreprise/js/angular/app/administration/versions-update-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/versions-update-administration.component.ts
index 4b5336768dc..f0fb87674f0 100644
--- a/apps/maarch_entreprise/js/angular/app/administration/versions-update-administration.component.ts
+++ b/apps/maarch_entreprise/js/angular/app/administration/versions-update-administration.component.ts
@@ -1,9 +1,7 @@
-import { ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
+import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
 import { MediaMatcher } from '@angular/cdk/layout';
 import { HttpClient } from '@angular/common/http';
 import { LANG } from '../translate.component';
-import { NotificationService } from '../notification.service';
-import { MatPaginator, MatTableDataSource, MatSort } from '@angular/material';
 
 declare function $j(selector: any): any;
 
@@ -11,27 +9,21 @@ declare var angularGlobals: any;
 
 
 @Component({
-    templateUrl: "../../../../Views/versions-update-administration.component.html",
-    providers: [NotificationService]
+    templateUrl: "../../../../Views/versions-update-administration.component.html"
 })
 export class VersionsUpdateAdministrationComponent implements OnInit {
-    mobileQuery: MediaQueryList;
-    private _mobileQueryListener: () => void;
-    coreUrl: string;
-    lang: any = LANG;
-    versionsList: any = {}
-    availableMajorVersions: any = [];
-    currentMinorVersions: any = [];
-    currentVersion: any ;
-    loading: boolean = false;
 
-    displayedColumns = ['id', 'description', 'value', 'actions'];
-    dataSource: any;
-    @ViewChild(MatPaginator) paginator: MatPaginator;
-    @ViewChild(MatSort) sort: MatSort;
+    mobileQuery                     : MediaQueryList;
+    private _mobileQueryListener    : () => void;
 
+    coreUrl     : string;
+    lang        : any = LANG;
+    loading     : boolean = false;
 
-    constructor(changeDetectorRef: ChangeDetectorRef, media: MediaMatcher, public http: HttpClient, private notify: NotificationService) {
+    versions    : any = {};
+
+
+    constructor(changeDetectorRef: ChangeDetectorRef, media: MediaMatcher, public http: HttpClient) {
         $j("link[href='merged_css.php']").remove();
         this.mobileQuery = media.matchMedia('(max-width: 768px)');
         this._mobileQueryListener = () => changeDetectorRef.detectChanges();
@@ -42,58 +34,16 @@ export class VersionsUpdateAdministrationComponent implements OnInit {
         this.mobileQuery.removeListener(this._mobileQueryListener);
     }
 
-    updateBreadcrumb(applicationName: string) {
-        if ($j('#ariane')[0]) {
-            $j('#ariane')[0].innerHTML = "<a href='index.php?reinit=true'>" + applicationName + "</a> > <a onclick='location.hash = \"/administration\"' style='cursor: pointer'>" + this.lang.administration + "</a> > " + this.lang.updateVersionControl;
-        }
-    }
-
-    applyFilter(filterValue: string) {
-        filterValue = filterValue.trim(); // Remove whitespace
-        filterValue = filterValue.toLowerCase(); // MatTableDataSource defaults to lowercase matches
-        this.dataSource.filter = filterValue;
-    }
-
     ngOnInit(): void {
-        this.updateBreadcrumb(angularGlobals.applicationName);
         this.coreUrl = angularGlobals.coreUrl;
 
         this.loading = true;
 
         this.http.get(this.coreUrl + 'rest/versionsUpdate')
             .subscribe((data: any) => {
-                console.log(data);
-                this.versionsList = data;
-                console.log(this.versionsList);
-                // this.availableMajorVersions = data.availableMajorVersions;
-                // this.currentMinorVersions = data.currentMinorVersions;
-                // this.currentVersion = data.currentVersion;
-                /*this.parameters = data.parameters;
-
-                setTimeout(() => {
-                    this.dataSource = new MatTableDataSource(this.parameters);
-                    this.dataSource.paginator = this.paginator;
-                    this.dataSource.sort = this.sort;
-                }, 0);*/
+                this.versions = data;
 
                 this.loading = false;
             });
     }
-
-    /*deleteParameter(paramId: string) {
-        let r = confirm(this.lang.deleteMsg);
-
-        if (r) {
-            this.http.delete(this.coreUrl + 'rest/parameters/' + paramId)
-                .subscribe((data: any) => {
-                    this.parameters = data.parameters;
-                    this.dataSource = new MatTableDataSource(this.parameters);
-                    this.dataSource.paginator = this.paginator;
-                    this.dataSource.sort = this.sort;
-                    this.notify.success(this.lang.parameterDeleted);
-                }, (err) => {
-                    this.notify.error(err.error.errors);
-                });
-        }
-    }*/
 }
-- 
GitLab