Denys Vuika 2854c17cd9
[ADF-5183] Upgrade to Angular 10 (#1506)
* upgrade preparation fixes

* remove fdescribe

* update browserlist config

* ng8

* ngrx 8

* ng9

* ngrx 9

* remove entryComponents

* unit tests

* ng 10

* latest ADF

* fix unit tests

* fix lint

* update deps and travis

* code fixes

* upgrade webdriver

* cleanup libs

* fix test

* update test

* Use browserTarget as target for lite-serve

* Use the update webdriver with CI condition

* Use version console.log('load', path

* Fix path sh

* Try to use remote env

* Add the . to export variabled

* Use hardcoded chrome version

* Remove the run remote

* Avoid to use the escape

* Skip flaky e2e and raise issue ACA-3615

* SKip failing e2e

* Skip flaky e2e and raise issue ACA-3615

* Fix close app toolbar menu and preconditions + tests of  mark-favorite.test.ts  Personal Files section

* Fix mark-favorite tests

* Fix ext-header test

* Fix new-menu tests

* Fix lint

* no message

* Fix viewer tests

Co-authored-by: maurizio vitale <maurizio.vitale@alfresco.com>
Co-authored-by: Cristina Jalba <cristina.jalba@ness.com>
2020-07-09 09:37:06 +01:00

4.6 KiB

Title
Title
Navigation

Navigation

The Alfresco Content Application provides the following navigation links:

  • Personal Files
  • File Libraries
  • Shared
  • Recent Files
  • Favorites
  • Trash

The side navigation provides support to customize the appearance of the links by editing the app.config.json.

Customization

Navigation configuration supports array and object like schema. Defining an object helps navigation to render visual delimiters between different groups of links.

{
  "navigation": {
     "main": [
      ...
     ],
   "secondary": [
     ...
    ]
  }
}

{
  "navigation": [
    { ... },
    { ... },
    ...
  ]
}

Customize icons and text

icon - supported value can be anything from Material Design icons library. If not defined, the link will render just the label value.

title - instructs the link to render a native browser tooltip with the given value. It can be a string or a i18n defined reference. If not defined, the link will not show a tooltip.

label - represents the visual name of the link. It can be a string or a i18n defined reference.

Caution: Changing "route": { "url": "/..." } value will affect the navigation since these are mapped to application routing system.

Custom text (i18n)

To change the title and label of navigation links edit the values under BROWSE entry found at /src/assets/i18n/en.json

"APP" : {
  ...
  "BROWSE": {
    "PERSONAL": {
    "TITLE": "Personal Files",
    "SIDENAV_LINK": {
        "LABEL": "Personal Files",
        "TOOLTIP": "View your Personal Files"
      }
    },
    ...
  }
}

For more information about internationalization see Internationalization (i18n) section.

User-defined navigation

To add custom navigation link for the application, first we need to create a component.

src/app/components/custom-page/custom-page.component.ts

import { Component } from '@angular/core';

@Component({
template: `
    <h4>{{ title }}</h4>
    `
})
export class CustomPage {
    title = 'My Custom Page'
}

Register the component in app.module.ts


  ...
  import { CustomPage } from './components/custom-page/custom-page.component';

  @NgModule({
    ...
    declarations: [
        ...,
        CustomPage
    ],
    ...
})

In the app.config.json define a link entry which will point to the custom page

{
  ...,
  "navigation": [
      "main": [ ... ],
      "secondary": [ ... ],
      "custom": [
        {
          "icon": "work",
          "label": "Link",
          "title": "My custom link",
          "route": {
              "url": "/custom-route"
          }
        }
      ]
  ]
}

This can also be declared using ngrx store action:

{
  ...,
  "navigation": [
      "main": [ ... ],
      "secondary": [ ... ],
      "custom": [
        {
          "icon": "work",
          "label": "Link",
          "title": "My custom link",
          "click": {
              "action": "NAVIGATE_ROUTE",
              "payload": "custom-route"
          }
        }
      ]
  ]
}

Map the /custom-route in app.routes.ts as a child of LayoutComponent definition.


  import { CustomPage } from './components/custom-page/custom-page.component.ts';

  ...
  {
    path: '',
    component: LayoutComponent,
    children: [
     ...,
     {
        path: 'custom-route',
        component: CustomPage
      }
    ]
  }
  ...,

Rendering custom components

Navigation definition also supports custom components to be dynamically render. The schema for this is as follows:

"navbar": [
  {
      "id": "app.navbar.primary",
      "items": [
            ...

          {
              "id": "custom-component",
              "component": "custom-menu-item"
          }

          ...
      ]
  }
]

Navigation items or group of navigation items can be conditional render based on defined rules.

"navbar": [
  {
    "id": "custom-group-1",
    "rules": {
      "visible": "rule-reference-id"
    },
    "items": [ ... ]
  },
  {
    "id": "custom-group-2",
    "items": [
        {
          "id": "itemId",
          "rules": {
            "visible": "rule-reference-id"
          },
          ...
        }
    ]
  }
]

For more informations about rules checkout Rules section.

For more information about the content of a custom page see Document List Layout section.