diff --git a/README.md b/README.md index 1e1910e..3fad143 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,17 @@ Iframe can still be set with defining `legacy-url` attribute, style can also be ```html ``` + +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 | ## Development diff --git a/index.html b/index.html index 63dc5ed..f8bd667 100644 --- a/index.html +++ b/index.html @@ -12,8 +12,8 @@ geOrchestra header - - + + diff --git a/package-lock.json b/package-lock.json index 404bb45..1eb6c6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,8 @@ "name": "header", "version": "0.0.0", "dependencies": { - "vue": "^3.2.45" + "vue": "^3.2.45", + "vue-i18n": "^9.7.0" }, "devDependencies": { "@rushstack/eslint-patch": "^1.1.4", @@ -23,10 +24,11 @@ "lint-staged": "^13.1.1", "npm-run-all": "^4.1.5", "postcss": "^8.4.21", + "postcss-rem-to-responsive-pixel": "^6.0.0", "prettier": "^2.7.1", "tailwindcss": "^3.2.4", "typescript": "~4.7.4", - "vite": "^4.0.0", + "vite": "4.1.5", "vue-tsc": "^1.0.12" } }, @@ -449,6 +451,47 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "node_modules/@intlify/core-base": { + "version": "9.7.0", + "resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-9.7.0.tgz", + "integrity": "sha512-1tBnfnCI23jXqGW15cagCjn2GgD487VST1dMG8P5LRzrSfx+kUzqFyTrjMNIwgq1tVaF4HnDpFMUuyrzTLKphw==", + "dependencies": { + "@intlify/message-compiler": "9.7.0", + "@intlify/shared": "9.7.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/kazupon" + } + }, + "node_modules/@intlify/message-compiler": { + "version": "9.7.0", + "resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-9.7.0.tgz", + "integrity": "sha512-/YdZCio2L2tCM5bZ2eMHbSEIQNPh1QqvZIOLI/yCVKXLscis7O0SsR2nmuU/DfCJ3iSeI8juw82C2wLvfsAeww==", + "dependencies": { + "@intlify/shared": "9.7.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/kazupon" + } + }, + "node_modules/@intlify/shared": { + "version": "9.7.0", + "resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-9.7.0.tgz", + "integrity": "sha512-PUkEuk//YKu4CHS5ah3mNa3XL/+TZj6rAY/6yYN+GCNFd2u+uWUkeuwE4Q6t8dydRWlErOePHHS0KyNoof/oBw==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/kazupon" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -846,6 +889,11 @@ "@vue/shared": "3.2.47" } }, + "node_modules/@vue/devtools-api": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.1.tgz", + "integrity": "sha512-+KpckaAQyfbvshdDW5xQylLni1asvNSGme1JFs8I1+/H5pHEhqUKMEQD/qn3Nx5+/nycBq11qAEi8lk+LXI2dA==" + }, "node_modules/@vue/eslint-config-prettier": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@vue/eslint-config-prettier/-/eslint-config-prettier-7.0.0.tgz", @@ -955,9 +1003,9 @@ } }, "node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -3854,6 +3902,12 @@ "postcss": "^8.2.14" } }, + "node_modules/postcss-rem-to-responsive-pixel": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-rem-to-responsive-pixel/-/postcss-rem-to-responsive-pixel-6.0.0.tgz", + "integrity": "sha512-Nhzc6IDAq5pCkbNdo/3p3+UXh+xSshypDTYpcjIjoHe+XJAC5wd3U+T6IgwkcVueuUkUHJiTmf09mTtAuHzWqg==", + "dev": true + }, "node_modules/postcss-selector-parser": { "version": "6.0.11", "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.11.tgz", @@ -4741,9 +4795,9 @@ } }, "node_modules/vite": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.1.1.tgz", - "integrity": "sha512-LM9WWea8vsxhr782r9ntg+bhSFS06FJgCvvB0+8hf8UWtvaiDagKYWXndjfX6kGl74keHJUcpzrQliDXZlF5yg==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.1.5.tgz", + "integrity": "sha512-zJ0RiVkf61kpd7O+VtU6r766xgnTaIknP/lR6sJTZq3HtVJ3HGnTo5DaJhTUtYoTyS/CQwZ6yEVdc/lrmQT7dQ==", "dev": true, "dependencies": { "esbuild": "^0.16.14", @@ -4825,6 +4879,25 @@ "eslint": ">=6.0.0" } }, + "node_modules/vue-i18n": { + "version": "9.7.0", + "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.7.0.tgz", + "integrity": "sha512-8Z8kSz9U2juzuAf+6mjW1HTd5pIlYuFJZkC+HvYOglFdpzwc2rTUGjxKwN8xGdtGur1MFnyJ44TSr+TksJtY8A==", + "dependencies": { + "@intlify/core-base": "9.7.0", + "@intlify/shared": "9.7.0", + "@vue/devtools-api": "^6.5.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/kazupon" + }, + "peerDependencies": { + "vue": "^3.0.0" + } + }, "node_modules/vue-template-compiler": { "version": "2.7.14", "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.7.14.tgz", @@ -5209,6 +5282,29 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "@intlify/core-base": { + "version": "9.7.0", + "resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-9.7.0.tgz", + "integrity": "sha512-1tBnfnCI23jXqGW15cagCjn2GgD487VST1dMG8P5LRzrSfx+kUzqFyTrjMNIwgq1tVaF4HnDpFMUuyrzTLKphw==", + "requires": { + "@intlify/message-compiler": "9.7.0", + "@intlify/shared": "9.7.0" + } + }, + "@intlify/message-compiler": { + "version": "9.7.0", + "resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-9.7.0.tgz", + "integrity": "sha512-/YdZCio2L2tCM5bZ2eMHbSEIQNPh1QqvZIOLI/yCVKXLscis7O0SsR2nmuU/DfCJ3iSeI8juw82C2wLvfsAeww==", + "requires": { + "@intlify/shared": "9.7.0", + "source-map-js": "^1.0.2" + } + }, + "@intlify/shared": { + "version": "9.7.0", + "resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-9.7.0.tgz", + "integrity": "sha512-PUkEuk//YKu4CHS5ah3mNa3XL/+TZj6rAY/6yYN+GCNFd2u+uWUkeuwE4Q6t8dydRWlErOePHHS0KyNoof/oBw==" + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -5497,6 +5593,11 @@ "@vue/shared": "3.2.47" } }, + "@vue/devtools-api": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.1.tgz", + "integrity": "sha512-+KpckaAQyfbvshdDW5xQylLni1asvNSGme1JFs8I1+/H5pHEhqUKMEQD/qn3Nx5+/nycBq11qAEi8lk+LXI2dA==" + }, "@vue/eslint-config-prettier": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@vue/eslint-config-prettier/-/eslint-config-prettier-7.0.0.tgz", @@ -5579,9 +5680,9 @@ "requires": {} }, "acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", "dev": true }, "acorn-jsx": { @@ -7632,6 +7733,12 @@ "postcss-selector-parser": "^6.0.10" } }, + "postcss-rem-to-responsive-pixel": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-rem-to-responsive-pixel/-/postcss-rem-to-responsive-pixel-6.0.0.tgz", + "integrity": "sha512-Nhzc6IDAq5pCkbNdo/3p3+UXh+xSshypDTYpcjIjoHe+XJAC5wd3U+T6IgwkcVueuUkUHJiTmf09mTtAuHzWqg==", + "dev": true + }, "postcss-selector-parser": { "version": "6.0.11", "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.11.tgz", @@ -8246,9 +8353,9 @@ } }, "vite": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.1.1.tgz", - "integrity": "sha512-LM9WWea8vsxhr782r9ntg+bhSFS06FJgCvvB0+8hf8UWtvaiDagKYWXndjfX6kGl74keHJUcpzrQliDXZlF5yg==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.1.5.tgz", + "integrity": "sha512-zJ0RiVkf61kpd7O+VtU6r766xgnTaIknP/lR6sJTZq3HtVJ3HGnTo5DaJhTUtYoTyS/CQwZ6yEVdc/lrmQT7dQ==", "dev": true, "requires": { "esbuild": "^0.16.14", @@ -8285,6 +8392,16 @@ "semver": "^7.3.6" } }, + "vue-i18n": { + "version": "9.7.0", + "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.7.0.tgz", + "integrity": "sha512-8Z8kSz9U2juzuAf+6mjW1HTd5pIlYuFJZkC+HvYOglFdpzwc2rTUGjxKwN8xGdtGur1MFnyJ44TSr+TksJtY8A==", + "requires": { + "@intlify/core-base": "9.7.0", + "@intlify/shared": "9.7.0", + "@vue/devtools-api": "^6.5.0" + } + }, "vue-template-compiler": { "version": "2.7.14", "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.7.14.tgz", diff --git a/package.json b/package.json index 77936a2..a31a8b7 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "prepare": "husky install" }, "dependencies": { - "vue": "^3.2.45" + "vue": "^3.2.45", + "vue-i18n": "^9.7.0" }, "devDependencies": { "@rushstack/eslint-patch": "^1.1.4", @@ -31,10 +32,11 @@ "lint-staged": "^13.1.1", "npm-run-all": "^4.1.5", "postcss": "^8.4.21", + "postcss-rem-to-responsive-pixel": "^6.0.0", "prettier": "^2.7.1", "tailwindcss": "^3.2.4", "typescript": "~4.7.4", - "vite": "^4.0.0", + "vite": "4.1.5", "vue-tsc": "^1.0.12" }, "lint-staged": { diff --git a/postcss.config.js b/postcss.config.js index 33ad091..79132dd 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -2,5 +2,10 @@ module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, + 'postcss-rem-to-responsive-pixel': { + rootValue: 16, + propList: ['*'], + transformUnit: 'px', + }, }, } diff --git a/src/auth.ts b/src/auth.ts index c2a3b73..607aa21 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -1,4 +1,5 @@ const AUTH_API_URL = '/whoami' +const CONSOLE_PLATFORM_API_URL = '/console/private/platform/infos' type KNOWN_ROLES = | 'ROLE_SUPERUSER' @@ -60,3 +61,21 @@ export function getAdminRoles(roles: KNOWN_ROLES[]): AdminRoles | null { viewer, } } + +export interface PlatformInfos { + analyticsEnabled: boolean + extractorappEnabled: boolean + saslEnabled: boolean +} + +export async function getPlatformInfos(): Promise { + return fetch(CONSOLE_PLATFORM_API_URL) + .then(response => response.json()) + .then((json: PlatformInfos) => { + return { + analyticsEnabled: json.analyticsEnabled, + extractorappEnabled: json.extractorappEnabled, + saslEnabled: json.saslEnabled, + } + }) +} diff --git a/src/header.ce.vue b/src/header.ce.vue index 5cf5e6a..ada3a78 100644 --- a/src/header.ce.vue +++ b/src/header.ce.vue @@ -1,19 +1,31 @@