Skip to content
Snippets Groups Projects
Verified Commit ff112d3b authored by Damien's avatar Damien
Browse files

FEAT #8345 Shortcut service

parent bd816e57
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,7 @@ export const myCustomTooltipDefaults: MatTooltipDefaultOptions = { ...@@ -12,6 +12,7 @@ export const myCustomTooltipDefaults: MatTooltipDefaultOptions = {
declare const angularGlobals: any; declare const angularGlobals: any;
declare function $j(selector: any): any; declare function $j(selector: any): any;
@Component({ @Component({
selector: 'my-app', selector: 'my-app',
template: `<main-header></main-header><router-outlet></router-outlet>`, template: `<main-header></main-header><router-outlet></router-outlet>`,
...@@ -22,7 +23,6 @@ declare function $j(selector: any): any; ...@@ -22,7 +23,6 @@ declare function $j(selector: any): any;
'../css/engine.css', '../css/engine.css',
'../css/jstree-custom.min.css', //treejs module '../css/jstree-custom.min.css', //treejs module
'../../../node_modules/ng2-dnd/bundles/style.css' '../../../node_modules/ng2-dnd/bundles/style.css'
], ],
viewProviders: [MatIconRegistry], viewProviders: [MatIconRegistry],
providers: [ providers: [
...@@ -30,6 +30,7 @@ declare function $j(selector: any): any; ...@@ -30,6 +30,7 @@ declare function $j(selector: any): any;
], ],
}) })
export class AppComponent { export class AppComponent {
constructor(iconReg: MatIconRegistry, sanitizer: DomSanitizer) { constructor(iconReg: MatIconRegistry, sanitizer: DomSanitizer) {
iconReg.addSvgIcon('maarchLogo', sanitizer.bypassSecurityTrustResourceUrl('static.php?filename=logo_white.svg')).addSvgIcon('maarchLogoOnly', sanitizer.bypassSecurityTrustResourceUrl('img/logo_only_white.svg')); iconReg.addSvgIcon('maarchLogo', sanitizer.bypassSecurityTrustResourceUrl('static.php?filename=logo_white.svg')).addSvgIcon('maarchLogoOnly', sanitizer.bypassSecurityTrustResourceUrl('img/logo_only_white.svg'));
......
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { SharedModule } from './app-common.module'; import { SharedModule } from './app-common.module';
import { CustomSnackbarComponent } from './notification.service'; import { CustomSnackbarComponent } from './notification.service';
import { ConfirmModalComponent } from './confirmModal.component'; import { ConfirmModalComponent } from './confirmModal.component';
import { ShortcutMenuService } from '../service/shortcut-menu.service';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
...@@ -50,6 +51,7 @@ import { ActivateUserComponent } from './activate-user.component' ...@@ -50,6 +51,7 @@ import { ActivateUserComponent } from './activate-user.component'
BottomSheetAttachmentList, BottomSheetAttachmentList,
BottomSheetDiffusionList BottomSheetDiffusionList
], ],
bootstrap: [AppComponent] providers: [ ShortcutMenuService ],
bootstrap: [ AppComponent ]
}) })
export class AppModule { } export class AppModule { }
...@@ -108,5 +108,4 @@ export class HomeComponent extends AutoCompletePlugin implements OnInit { ...@@ -108,5 +108,4 @@ export class HomeComponent extends AutoCompletePlugin implements OnInit {
goToDetail(row:any){ goToDetail(row:any){
location.href = "index.php?page=details&dir=indexing_searching&id="+row.res_id; location.href = "index.php?page=details&dir=indexing_searching&id="+row.res_id;
} }
}
}
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</h1> </h1>
<span style="flex: 1 1 auto;"></span> <span style="flex: 1 1 auto;"></span>
<search-home></search-home> <search-home></search-home>
<button mat-button [matMenuTriggerFor]="applications" *ngIf="!mobileMode" style="min-width: unset" matTooltip="{{lang.menu}}"> <button mat-button [matMenuTriggerFor]="applications" *ngIf="!mobileMode" style="min-width: unset; margin-left: 10px" matTooltip="{{lang.menu}}">
<mat-icon mat-list-icon class="fa fa-th fa-lg" style="color:white; margin:0px 0px -11px 0px;"></mat-icon> <mat-icon mat-list-icon class="fa fa-th fa-lg" style="color:white; margin:0px 0px -11px 0px;"></mat-icon>
</button> </button>
<mat-menu #applications="matMenu" class="headerMaarchShortcut"> <mat-menu #applications="matMenu" class="headerMaarchShortcut">
......
import { Component, OnInit, Input, NgZone, ViewChild } from '@angular/core'; import { Component, OnInit, NgZone } from '@angular/core';
import { LANG } from '../translate.component'; import { LANG } from '../translate.component';
import { MatSidenav } from '@angular/material'; import { MatSidenav } from '@angular/material';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { ShortcutMenuService } from '../../service/shortcut-menu.service';
declare function $j(selector: any) : any; declare function $j(selector: any) : any;
declare var angularGlobals : any; declare var angularGlobals : any;
...@@ -10,22 +12,22 @@ declare var angularGlobals : any; ...@@ -10,22 +12,22 @@ declare var angularGlobals : any;
@Component({ @Component({
selector : "main-header", selector : "main-header",
templateUrl : "main-header.component.html", templateUrl : "main-header.component.html"
}) })
export class MainHeaderComponent implements OnInit { export class MainHeaderComponent implements OnInit {
coreUrl : string; coreUrl : string;
lang : any = LANG; lang : any = LANG;
user : any = {firstname : "",lastname : ""}; user : any = {firstname : "",lastname : ""};
mobileMode : boolean = false; mobileMode : boolean = false;
titleHeader: string; titleHeader : string;
titleSubHeader: string; router : any;
router :any;
snav : MatSidenav;
snav2 : MatSidenav;
snav : MatSidenav;
snav2 : MatSidenav;
constructor(public http: HttpClient, private zone: NgZone, private _router: Router) { constructor(public http: HttpClient, private zone: NgZone, private _router: Router, private shortcut: ShortcutMenuService) {
this.router = _router; this.router = _router;
this.mobileMode = angularGlobals.mobileMode; this.mobileMode = angularGlobals.mobileMode;
window['MainHeaderComponent'] = { window['MainHeaderComponent'] = {
...@@ -41,6 +43,9 @@ export class MainHeaderComponent implements OnInit { ...@@ -41,6 +43,9 @@ export class MainHeaderComponent implements OnInit {
.subscribe((data: any) => { .subscribe((data: any) => {
this.user = data.user; this.user = data.user;
this.user.menu = data.menu; this.user.menu = data.menu;
this.shortcut.shortcutsData.user = data.user;
this.shortcut.shortcutsData.menu = data.menu;
}, (err) => { }, (err) => {
console.log(err.error.errors); console.log(err.error.errors);
}); });
......
...@@ -5,22 +5,22 @@ ...@@ -5,22 +5,22 @@
<mat-expansion-panel style="margin-top:-7px;"> <mat-expansion-panel style="margin-top:-7px;">
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title style="justify-content: center;"> <mat-panel-title style="justify-content: center;">
{{user.firstname}} {{user.lastname | uppercase}} {{shortcut.shortcutsData.user.firstname}} {{shortcut.shortcutsData.user.lastname | uppercase}}
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<mat-list> <mat-list>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<mat-list-item *ngFor="let group of user.groups"> <mat-list-item *ngFor="let group of shortcut.shortcutsData.user.groups">
<p mat-line style="color:#666;opacity:0.5;"> {{group.group_desc}} </p> <p mat-line style="color:#666;opacity:0.5;"> {{group.group_desc}} </p>
</mat-list-item> </mat-list-item>
<h3 mat-subheader style="color:#666;">{{lang.groups}}</h3> <h3 mat-subheader style="color:#666;">{{lang.groups}}</h3>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<mat-list-item *ngFor="let group of user.groups"> <mat-list-item *ngFor="let group of shortcut.shortcutsData.user.groups">
<p mat-line style="color:#666;opacity:0.5;"> {{group.group_desc}} </p> <p mat-line style="color:#666;opacity:0.5;"> {{group.group_desc}} </p>
</mat-list-item> </mat-list-item>
<h3 mat-subheader style="color:#666;">{{lang.entities}}</h3> <h3 mat-subheader style="color:#666;">{{lang.entities}}</h3>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<mat-list-item *ngFor="let entity of user.entities"> <mat-list-item *ngFor="let entity of shortcut.shortcutsData.user.entities">
<p mat-line style="color:#666;opacity:0.5;"> {{entity.entity_label}} </p> <p mat-line style="color:#666;opacity:0.5;"> {{entity.entity_label}} </p>
</mat-list-item> </mat-list-item>
</mat-list> </mat-list>
...@@ -35,9 +35,9 @@ ...@@ -35,9 +35,9 @@
<mat-icon class="fa fa-home" style="height:auto;"></mat-icon> <mat-icon class="fa fa-home" style="height:auto;"></mat-icon>
</button> </button>
</span> </span>
<ng-container *ngFor="let shortcut of user.menu"> <ng-container *ngFor="let shortcut of shortcut.shortcutsData.menu">
<span style="flex:1;text-align: left;padding: 5px;" *ngIf="shortcut.shortcut == 'true'"> <span style="flex:1;text-align: left;padding: 5px;" *ngIf="shortcut.shortcut == 'true'">
<button color="primary" mat-icon-button (click)="gotToMenu(shortcut.servicepage,shortcut.angular);" matTooltip="{{shortcut.name}}"> <button color="primary" mat-icon-button (click)="gotToMenu(shortcut.servicepage, shortcut.angular);" matTooltip="{{shortcut.name}}">
<mat-icon class="fa {{shortcut.style}}" style="height:auto;"></mat-icon> <mat-icon class="fa {{shortcut.style}}" style="height:auto;"></mat-icon>
</button> </button>
</span> </span>
...@@ -52,4 +52,4 @@ ...@@ -52,4 +52,4 @@
</p> </p>
</a> </a>
</mat-nav-list> </mat-nav-list>
<mat-divider></mat-divider> <mat-divider></mat-divider>
\ No newline at end of file
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router'; import { Router } from '@angular/router';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import {Location} from '@angular/common'; import { Location } from '@angular/common';
import { LANG } from '../translate.component'; import { LANG } from '../translate.component';
import { ShortcutMenuService } from '../../service/shortcut-menu.service';
declare function $j(selector: any) : any; declare function $j(selector: any) : any;
...@@ -11,41 +12,29 @@ declare var angularGlobals : any; ...@@ -11,41 +12,29 @@ declare var angularGlobals : any;
@Component({ @Component({
selector: 'menu-shortcut', selector: 'menu-shortcut',
templateUrl : "menuShortcut.component.html", templateUrl : "menu-shortcut.component.html",
}) })
export class MenuShortcutComponent implements OnInit { export class MenuShortcutComponent implements OnInit {
lang: any = LANG; coreUrl : string;
mobileMode : boolean = false; lang : any = LANG;
coreUrl : string; mobileMode : boolean = false;
router :any; router : any;
user : any = {};
constructor(public http: HttpClient, private _location: Location, private _router: Router, private activatedRoute:ActivatedRoute) { constructor(public http: HttpClient, private _location: Location, private _router: Router, public shortcut: ShortcutMenuService) {
this.mobileMode = angularGlobals.mobileMode; this.mobileMode = angularGlobals.mobileMode;
this.router = _router; this.router = _router;
this.coreUrl = angularGlobals.coreUrl;
this.http.get(this.coreUrl + 'rest/header')
.subscribe((data: any) => {
this.user = data.user;
this.user.menu = data.menu;
}, (err) => {
console.log(err.error.errors);
});
} }
ngOnInit(): void { ngOnInit(): void {
this.coreUrl = angularGlobals.coreUrl; this.coreUrl = angularGlobals.coreUrl;
} }
gotToMenu(link:string, angularMode:string) { gotToMenu(link: string, angularMode: string) {
if (angularMode == 'true') { if (angularMode == 'true') {
this.router.navigate([link]); this.router.navigate([link]);
} else{ } else{
location.href = link; location.href = link;
} }
} }
} }
This diff is collapsed.
import { Injectable } from '@angular/core';
@Injectable()
export class ShortcutMenuService {
shortcutsData : any = {
user : [],
menu : []
};
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment