Skip to content

Commit

Permalink
admin: Implementing a factory to generate menus
Browse files Browse the repository at this point in the history
* Adds menu definitions.
* Adds the factory to generate the menus.
* Updates the components to use the new menus.
* Updates some tests.
* Improves js dependencies build.

Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Co-Authored-by: Renaud Michotte <renaud.michotte@gmail.com>
  • Loading branch information
Garfield-fr and zannkukai committed Jan 20, 2023
1 parent 227a53a commit aa368c7
Show file tree
Hide file tree
Showing 30 changed files with 1,226 additions and 1,535 deletions.
46 changes: 39 additions & 7 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": ["crypto-js"],
"allowedCommonJsDependencies": [
"crypto-js",
"easymde",
"issn",
"moment",
"simple-isbn"
],
"preserveSymlinks": true,
"outputPath": "build/dist/admin",
"index": "projects/admin/src/index.html",
Expand Down Expand Up @@ -129,7 +135,11 @@
"build": {
"builder": "ngx-build-plus:build",
"options": {
"allowedCommonJsDependencies": ["crypto-js"],
"allowedCommonJsDependencies": [
"crypto-js",
"easymde",
"moment"
],
"outputPath": "build/dist/public-holdings-items",
"index": "projects/public-holdings-items/src/index.html",
"main": "projects/public-holdings-items/src/main.ts",
Expand Down Expand Up @@ -217,7 +227,12 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": ["crypto-js", "zone.js"],
"allowedCommonJsDependencies": [
"crypto-js",
"easymde",
"moment",
"zone.js"
],
"preserveSymlinks": true,
"outputPath": "build/dist/public-search",
"index": "projects/public-search/src/index.html",
Expand Down Expand Up @@ -330,17 +345,19 @@
"prefix": "app",
"architect": {
"build": {
"builder": "ngx-build-plus:build",
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": [
"crypto-js"
"crypto-js",
"easymde",
"moment"
],
"outputPath": "build/dist/search-bar",
"index": "projects/search-bar/src/index.html",
"main": "projects/search-bar/src/main.ts",
"polyfills": "projects/search-bar/src/polyfills.ts",
"tsConfig": "projects/search-bar/tsconfig.app.json",
"aot": false,
"aot": true,
"assets": [],
"styles": [],
"scripts": []
Expand Down Expand Up @@ -459,7 +476,12 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": ["crypto-js", "zone.js"],
"allowedCommonJsDependencies": [
"crypto-js",
"easymde",
"moment",
"zone.js"
],
"preserveSymlinks": true,
"outputPath": "build/dist/public-patron-profile",
"index": "projects/public-patron-profile/src/index.html",
Expand Down Expand Up @@ -559,6 +581,11 @@
"build": {
"builder": "ngx-build-plus:build",
"options": {
"allowedCommonJsDependencies": [
"crypto-js",
"easymde",
"moment"
],
"outputPath": "build/dist/public-user-profile-edit",
"index": "projects/public-user-profile-edit/src/index.html",
"main": "projects/public-user-profile-edit/src/main.ts",
Expand Down Expand Up @@ -650,6 +677,11 @@
"build": {
"builder": "ngx-build-plus:build",
"options": {
"allowedCommonJsDependencies": [
"crypto-js",
"easymde",
"moment"
],
"outputPath": "build/dist/public-user-password-change",
"index": "projects/public-user-password-change/src/index.html",
"main": "projects/public-user-password-change/src/main.ts",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"start-public-user-profile-edit-proxy": "ng serve public-user-profile-edit --proxy-config proxy.conf.json",
"start-search-bar-proxy": "ng serve search-bar --proxy-config proxy.conf.json",
"build-shared": "ng build --configuration production shared",
"build": "npm run build-shared && ng build admin --configuration production && ng build public-patron-profile --configuration production && ng build public-user-password-change --configuration production && ng build public-user-profile-edit --configuration production && ng build public-search --configuration production && ng build public-holdings-items --configuration production && ng build search-bar --single-bundle --configuration production",
"build": "npm run build-shared && ng build admin --configuration production && ng build public-patron-profile --configuration production && ng build public-user-password-change --configuration production && ng build public-user-profile-edit --configuration production && ng build public-search --configuration production && ng build public-holdings-items --configuration production && ng build search-bar --configuration production",
"pack": "npm run build && ./scripts/dist_pkg.js -o build && cd build && npm pack",
"test": "ng test",
"lint": "ng lint --cache",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* RERO ILS UI
* Copyright (C) 2020 RERO
* Copyright (C) 2020-2022 RERO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
Expand All @@ -17,36 +17,28 @@

import { Component, OnInit } from '@angular/core';
import { MenuItemInterface } from '@rero/ng-core';
import { MenuUserServicesService } from '../service/menu-user-services.service';
import { MenuService } from '../service/menu.service';

@Component({
selector: 'admin-menu-dashboard',
templateUrl: './menu-dashboard.component.html'
})
export class MenuDashboardComponent implements OnInit {

/** User menu */
private _menu: MenuItemInterface;

/**
* User services menu
* @return MenuItemInterface
*/
get menu(): MenuItemInterface {
return this._menu;
}
/** Application menu */
menu: MenuItemInterface;

/**
* Constructor
* @param _menuUserService - MenuUserService
* @param _menuService - MenuService
*/
constructor(private _menuUserServicesService: MenuUserServicesService) { }
constructor(private _menuService: MenuService) { }

/** Init */
ngOnInit() {
if (!(this._menuUserServicesService.menu)) {
this._menuUserServicesService.generate();
this._menuService.appMenu$.subscribe((menu: MenuItemInterface) => this.menu = menu);
if (!this.menu) {
this._menuService.generateMenus();
}
this._menu = this._menuUserServicesService.menu;
}
}
Loading

0 comments on commit aa368c7

Please sign in to comment.