diff --git a/README.md b/README.md index 3fad143..28c6eab 100644 --- a/README.md +++ b/README.md @@ -31,15 +31,28 @@ Iframe can still be set with defining `legacy-url` attribute, style can also be Attributes available : -| Attribute | Description | Example | For host | For legacy | -|---------------|------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|----------|------------| -| lang | Used to force header language (default value : en) | `` | v | | -| active-app | Use this attribute to set the active class in menu | `` | v | v | -| logo-url | Use this attribute to set the logo for the new header (not legacy one). | `` | v | | -| legacy-header | Use this attribute to enable the legacy header `iframe` tag. Needs `legacy-url`. | `` | | v | -| legacy-url | Legacy URL: if set, activates iframe with src attribute pointing to this URL. Needs `legacy-header`. | `` | | v | -| style | adds this style to iframe or host tag (if legacy url is not used) | `` | v | v | +| Attribute | Description | Example | For host | For legacy | +|---------------|------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|----------|-----------| +| lang | Used to force header language (default value : en) | `` | v | | +| active-app | Use this attribute to set the active class in menu | `` | v | v | +| logo-url | Use this attribute to set the logo for the new header (not legacy one). | `` | v | | +| legacy-header | Use this attribute to enable the legacy header `iframe` tag. Needs `legacy-url`. | `` | | v | +| legacy-url | Legacy URL: if set, activates iframe with src attribute pointing to this URL. Needs `legacy-header`. | `` | | v | +| style | adds this style to iframe or host tag (if legacy url is not used) | `` | v | v | +| stylesheet | allow to add stylesheet for new header | `` | v | | +3. Optional : Override default colors with `stylesheet` attribute : + +```css +header { + --georchestra-primary: #124885; + --georchestra-secondary: #83532b; + --georchestra-primary-light: #12488540; + --georchestra-secondary-light: #83532b40; + } +``` + +Note: It's important to target the `header` tag here to override the css variables, because of the shadow DOM. ## Development diff --git a/index.html b/index.html index f8bd667..7bb500c 100644 --- a/index.html +++ b/index.html @@ -12,8 +12,11 @@ geOrchestra header - - + + diff --git a/src/auth.ts b/src/auth.ts index 607aa21..4923847 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -26,6 +26,7 @@ export interface User { } export interface AdminRoles { + superUser: boolean admin: boolean console: boolean catalog: boolean @@ -55,6 +56,7 @@ export function getAdminRoles(roles: KNOWN_ROLES[]): AdminRoles | null { console || catalog || viewer || roles.indexOf('ROLE_ADMINISTRATOR') > -1 if (!admin) return null return { + superUser, admin, console, catalog, diff --git a/src/header.ce.vue b/src/header.ce.vue index e8f243f..ac1a3ed 100644 --- a/src/header.ce.vue +++ b/src/header.ce.vue @@ -19,6 +19,7 @@ const props = defineProps<{ legacyHeader?: string legacyUrl?: string style?: string + stylesheet?: string }>() const state = reactive({ @@ -50,7 +51,7 @@ onMounted(() => { getUserDetails().then(user => { state.user = user - if (user?.adminRoles?.admin) { + if (user?.adminRoles?.superUser) { getPlatformInfos().then( platformInfos => (state.platformInfos = platformInfos) ) @@ -68,12 +69,13 @@ onMounted(() => { v-bind:style="props.style" > -
+
+
+ +