-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement first step of modular (#25)
* feat: implement first step of modular * feat: first step of condition * feat: set menu config file and block account * feat: add i18n, config file, improve repsonsive * feat: add active app url * feat: add types and update active app scoring * feat: remove activeApp * feat: format * feat: this should work * feat: remove getActiveTab * feat: better naming * feat: ugly but working * feat: cleaning * feat: add icons * feat: format and readme * feat: add documentation * feat: add documentation * feat: better example * feat: use object assign to keep default values * fix: build * fix: reset height * feat: set leagcy header back to props to avoid import config file * feat: set leagcy header back to props to avoid import config file * feat: and logo either * feat: added logo url doc back * feat: avoid icons to get on top of text
- Loading branch information
Showing
12 changed files
with
579 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{ | ||
"recommendations": [ | ||
"Vue.volar""] | ||
"recommendations": ["Vue.volar"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Configuration file | ||
|
||
A configuration file can be set to customize the header. | ||
|
||
Inside it, you can set the following properties: | ||
```json | ||
{ | ||
"config": {}, | ||
"menu": [], | ||
"i18n": {} | ||
} | ||
``` | ||
|
||
## Config | ||
|
||
Config can contains old tag attributes : | ||
```json | ||
"config": { | ||
"stylesheet": "https://data.lillemetropole.fr/public/georchestra.css", | ||
"logoUrl": "https://data.lillemetropole.fr/public/logo-mel.jpg", | ||
"hideLogin": false, | ||
"lang": "es" | ||
} | ||
``` | ||
|
||
Full configuration [is here](./src/config-interfaces.ts#L32-L53). | ||
|
||
:warning: You can also define stylesheet in the datadir (`default.properties`) because this file can be used in other georchestra's apps. It will take precedence over the one set in the config file of the header. | ||
|
||
## Menu | ||
|
||
Menu can contain three type of objects : `link` (by default), `separator` or `dropdown` | ||
|
||
There's actually just one level of dropdowns. You cannot have a dropdown inside a dropdown. | ||
|
||
To see the actual structure of the menu, you can check the [menu interface](./src/default-config.json) | ||
|
||
### Active tab matching | ||
|
||
A decision has been made in order to have the best match between the active tab and the current page. | ||
|
||
If two conditions can be resolved for a link to be active, the longest one will be used. | ||
|
||
URL of tab : /mapstore/#/home | ||
|
||
- Condition 1 : activeAppUrl /mapstore | ||
- Condition 2 : activeAppUrl /mapstore/#/home | ||
|
||
Condition 2 will be used because /mapstore/#/home = 16 characters. | ||
|
||
|
||
## i18n | ||
|
||
In addition to translations set in [./src/i18n/](./src/i18n/), you can add custom translations : | ||
```json | ||
{ | ||
"i18n": { | ||
"en": { | ||
"customi18nkey": "WMS/WFS service" | ||
}, | ||
"fr": { | ||
"customi18nkey": "Service WMS/WFS" | ||
}, | ||
"es": { | ||
"customi18nkey": "Servicio WMS/WFS" | ||
} | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"config": { | ||
"stylesheet": "/public/georchestra.css", | ||
"logoUrl": "/public/logo-mel.jpg", | ||
"hideLogin": false, | ||
"iconsUrl": "https://cdn.jsdelivr.net/gh/iconoir-icons/iconoir@main/css/iconoir.css", | ||
"lang": "es" | ||
}, | ||
"menu": [ | ||
{ | ||
"label": "Catalogue", | ||
"i18n": "datahub", | ||
"url": "/datahub/", | ||
"activeAppUrl": "/datahub" | ||
}, | ||
{ | ||
"label": "WMS/WFS", | ||
"i18n": "customi18n", | ||
"url": "/geoserver/web", | ||
"activeAppUrl": "includes:/geoserver", | ||
"icon": "iconoir-map" | ||
}, | ||
{ | ||
"type": "separator" | ||
}, | ||
{ | ||
"type": "dropdown", | ||
"label": "A dropdown", | ||
"items": [ | ||
{ | ||
"label": "Console", | ||
"i18n": "users", | ||
"url": "/console/manager/home", | ||
"activeAppUrl": "/console", | ||
"icon": "iconoir-globe" | ||
}, | ||
{ | ||
"label": "Geonetwork", | ||
"i18n": "catalogue", | ||
"url": "/geonetwork/srv/:lang3/catalog.edit#/board", | ||
"activeAppUrl": "/geonetwork", | ||
"hasRole": "ROLE_GN_EDITOR", | ||
"blockedRole": "ROLE_SUPERUSER,ROLE_GN_REVIEWER,ROLE_GN_ADMIN" | ||
} | ||
] | ||
} | ||
], | ||
"i18n": { | ||
"en": { | ||
"customi18n": "WMS/WFS service" | ||
}, | ||
"fr": { | ||
"customi18n": "Service WMS/WFS" | ||
}, | ||
"es": { | ||
"customi18n": "Servicio WMS/WFS" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
interface MenuItem { | ||
type?: string | ||
//Role required to display the item | ||
hasRole?: string | ||
//Role which hides the item | ||
blockedRole?: string | ||
} | ||
|
||
export interface Link extends MenuItem { | ||
label: string | ||
//URL to redirect to | ||
url: string | ||
//i18n key to display the label | ||
i18n?: string | ||
//to trigger the active tab (underline). By default, it triggers on start with e.g /console (start:/console) will trigger on /console** pages | ||
// Values can be 'start', 'exact', 'includes', 'end' | ||
activeAppUrl?: string | ||
//Icon to display next to the label | ||
icon?: string | ||
} | ||
|
||
export interface Dropdown extends MenuItem { | ||
label: string | ||
//i18n key to display the label | ||
i18n?: string | ||
//List of items to display in the dropdown | ||
items?: Array<Link> | ||
} | ||
|
||
export interface Separator extends MenuItem {} | ||
|
||
export interface Config { | ||
//Logo url to display in the header | ||
logoUrl?: string | ||
//Title to the logo displayed in the header | ||
logoTitle?: string | ||
//Whether to hide the login button | ||
hideLogin?: boolean | ||
//Custom stylesheet to apply to the header | ||
stylesheet?: string | ||
//Link to icons url. Tested with https://cdn.jsdelivr.net/gh/iconoir-icons/iconoir@main/css/iconoir.css | ||
iconsUrl?: string | ||
//Force header's language | ||
lang?: string | ||
//List of roles considered as admin roles, if admin, triggers a request to /console/private/platform/infos | ||
adminRoles: string[] | ||
} |
Oops, something went wrong.