Skip to content

Commit

Permalink
chore(menu): add query params on some routes
Browse files Browse the repository at this point in the history
To avoid redirection if the default settings are not present,
they are added directly to the menu items.

Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
Garfield-fr committed Mar 13, 2024
1 parent 69423cc commit e0e0357
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 16 deletions.
6 changes: 0 additions & 6 deletions projects/admin/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,6 @@ export function appInitFactory(appInitializerService: AppInitializerService): ()
BsDropdownModule.forRoot(),
NgxChartsModule,
CollapseModule.forRoot(),
FormlyPrimeNGModule,
FormlySelectModule,
FormsModule,
HttpClientModule,
ReactiveFormsModule,
Expand All @@ -380,10 +378,6 @@ export function appInitFactory(appInitializerService: AppInitializerService): ()
TooltipModule.forRoot(),
PopoverModule.forRoot(),
FormlyModule.forRoot({
extras: {
checkExpressionOn: 'changeDetectionCheck',
resetFieldOnHide: true
},
types: [
{ name: "cipo-pt-it", component: CipoPatronTypeItemTypeComponent },
{ name: "account-select", component: SelectAccountEditorWidgetComponent },
Expand Down
130 changes: 122 additions & 8 deletions projects/admin/src/app/menu/menu-definition/menu-app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* RERO ILS UI
* Copyright (C) 2019-2023 RERO
* Copyright (C) 2019-2024 RERO
* Copyright (C) 2019-2023 UCLouvain
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -46,7 +46,13 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'ILL requests',
router_link: ['/', 'records', 'ill_requests'],
query_params: { library: '$currentLibrary' },
query_params: {
q: '',
page: '1',
size: '10',
simple: '1',
library: '$currentLibrary'
},
attributes: { id: 'ill-requests-menu' },
extras: { iconClass: 'fa fa-truck' },
access: {
Expand All @@ -56,6 +62,12 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Users',
router_link: ['/', 'records', 'patrons'],
query_params: {
q: '',
page: '1',
size: '10',
simple: '1'
},
attributes: { id: 'users-menu' },
extras: { iconClass: 'fa fa-users' },
access: {
Expand All @@ -65,7 +77,14 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Exhibition/course',
router_link: ['/', 'records', 'collections'],
query_params: { library: '$currentLibrary' },
query_params: {
q: '',
page: '1',
size: '10',
sort: 'title',
simple: '1',
library: '$currentLibrary'
},
attributes: { id: 'collections-menu' },
extras: { iconClass: 'fa fa-graduation-cap' },
access: {
Expand All @@ -75,7 +94,13 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Current loans',
router_link: ['/', 'records', 'loans'],
query_params: { owner_library: '$currentLibrary' },
query_params: {
q: '',
page: '1',
size: '10',
simple: '1',
owner_library: '$currentLibrary'
},
attributes: { id: 'current-loans-menu' },
extras: { iconClass: 'fa fa-list-ul' },
access: {
Expand All @@ -93,6 +118,13 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Documents',
router_link: ['/', 'records', 'documents'],
query_params: {
q: '',
page: '1',
size: '10',
simple: '1',
organisation: '$currentOrganisation'
},
attributes: { id: 'documents-menu' },
extras: { iconClass: 'fa fa-file-o' },
access: {
Expand All @@ -115,6 +147,11 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Import from the web',
router_link: ['/', 'records', 'import_bnf'],
query_params: {
q: '',
page: '1',
size: '10'
},
attributes: { id: 'import-menu' },
extras: { iconClass: 'fa fa-cloud-download' },
access: {
Expand All @@ -124,6 +161,11 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Entities',
router_link: ['/', 'records', 'entities'],
query_params: {
q: '',
page: '1',
size: '10'
},
attributes: { id: 'entities-menu' },
extras: { iconClass: 'fa fa-cubes' }
}
Expand All @@ -138,6 +180,13 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Vendors',
router_link: ['/', 'records', 'vendors'],
query_params: {
q: '',
page: '1',
size: '10',
sort: 'name_asc',
simple: '1'
},
attributes: { id: 'vendors-menu' },
extras: { iconClass: 'fa fa-briefcase' },
access: {
Expand All @@ -148,8 +197,12 @@ export const MENU_APP: IMenuParent[] = [
name: 'Orders',
router_link: ['/', 'records', 'acq_orders'],
query_params: {
q: '',
page: '1',
size: '10',
library: '$currentLibrary',
budget: '$currentBudget'
budget: '$currentBudget',
simple: '1',
},
attributes: { id: 'orders-menu' },
extras: { iconClass: 'fa fa-shopping-cart' },
Expand All @@ -160,6 +213,12 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Budgets',
router_link: ['/', 'records', 'budgets'],
query_params: {
q: '',
page: '1',
size: '10',
simple: '1',
},
attributes: { id: 'budgets-menu' },
extras: { iconClass: 'fa fa-money' },
access: {
Expand All @@ -178,7 +237,13 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Late issues',
router_link: ['/', 'records', 'issues'],
query_params: { library: '$currentLibrary' },
query_params: {
q: '',
page: '1',
size: '10',
library: '$currentLibrary',
simple: '1',
},
attributes: { id: 'late-issues-menu' },
extras: { iconClass: 'fa fa-envelope-open-o' },
access: {
Expand All @@ -196,7 +261,13 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Inventory list',
router_link: ['/', 'records', 'items'],
query_params: { library: '$currentLibrary' },
query_params: {
q: '',
page: '1',
size: '10',
library: '$currentLibrary',
simple: '1',
},
attributes: { id: 'inventory-list-menu' },
extras: { iconClass: 'fa fa-list' },
access: {
Expand All @@ -207,8 +278,12 @@ export const MENU_APP: IMenuParent[] = [
name: 'Fees',
router_link: ['/', 'records', 'patron_transaction_events'],
query_params: {
q: '',
page: '1',
size: '10',
transaction_library: '$currentLibrary',
transaction_date: '$currentDayRange'
transaction_date: '$currentDayRange',
simple: '1'
},
attributes: { id: 'fees-list-menu' },
extras: { iconClass: 'fa fa-money' },
Expand All @@ -222,8 +297,12 @@ export const MENU_APP: IMenuParent[] = [
attributes: { id: "stats-cfg-menu" },
extras: { iconClass: "fa fa-cog" },
query_params: {
q: '',
page: '1',
size: '10',
library: "$currentLibrary",
active: "true",
simple: '1'
},
access: {
permissions: [PERMISSIONS.STAT_CFG_ACCESS],
Expand All @@ -240,6 +319,13 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Circulation policies',
router_link: ['/', 'records', 'circ_policies'],
query_params: {
q: '',
page: '1',
size: '10',
sort: 'name',
simple: '1',
},
attributes: { id: 'circulation-policies-menu' },
extras: { iconClass: 'fa fa-exchange' },
access: {
Expand All @@ -249,6 +335,13 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Item types',
router_link: ['/', 'records', 'item_types'],
query_params: {
q: '',
page: '1',
size: '10',
sort: 'name',
simple: '1',
},
attributes: { id: 'item-types-menu' },
extras: { iconClass: 'fa fa-file-o' },
access: {
Expand All @@ -258,6 +351,13 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Patron types',
router_link: ['/', 'records', 'patron_types'],
query_params: {
q: '',
page: '1',
size: '10',
sort: 'name',
simple: '1',
},
attributes: { id: 'patron-types-menu' },
extras: { iconClass: 'fa fa-users' },
access: {
Expand Down Expand Up @@ -285,6 +385,13 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Libraries',
router_link: ['/', 'records', 'libraries'],
query_params: {
q: '',
page: '1',
size: '10',
sort: 'name',
simple: '1',
},
attributes: { id: 'libraries-menu' },
extras: { iconClass: 'fa fa-users' },
access: {
Expand All @@ -294,6 +401,13 @@ export const MENU_APP: IMenuParent[] = [
{
name: 'Templates',
router_link: ['/', 'records', 'templates'],
query_params: {
q: '',
page: '1',
size: '10',
sort: 'name',
simple: '1',
},
attributes: { id: 'templates-menu' },
extras: { iconClass: 'fa fa-file-code-o' },
access: {
Expand Down
4 changes: 2 additions & 2 deletions projects/admin/src/app/menu/menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class MenuComponent implements OnInit {
/** Max length suggestion */
maxLengthSuggestion = 100;

/** Autocomplte query params */
/** Autocomplete query params */
autocompleteQueryParams: any = { page: '1', size: '10' };

/** Is document url */
Expand All @@ -46,7 +46,7 @@ export class MenuComponent implements OnInit {
private hideSearchResources = ['documents'];

/**
* Get Typehead option limit
* Get Typeahead option limit
* @return number
*/
get typeaheadOptionsLimit(): number {
Expand Down

0 comments on commit e0e0357

Please sign in to comment.