From f7b8b05d780af69e6e96012e315aeedaf72b524b Mon Sep 17 00:00:00 2001 From: cnouguier Date: Sat, 7 Dec 2024 12:55:13 +0100 Subject: [PATCH] wip: Provide additional information about the browser capabilities #1005 --- core/client/components/app/KPlatform.vue | 10 +++++----- core/client/platform.js | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/core/client/components/app/KPlatform.vue b/core/client/components/app/KPlatform.vue index c3a8cbaf3..8fc259d76 100644 --- a/core/client/components/app/KPlatform.vue +++ b/core/client/components/app/KPlatform.vue @@ -10,9 +10,9 @@ id="copy-clipboard" icon="las la-copy" :handler="copy" - tooltip="KPlatform.COPY_INFO" + label="KPlatform.COPY_INFO" renderer="fab" - color="primary" + color="grey-7" />
{{ Platform.getData().userAgent }}
@@ -116,13 +116,13 @@ import KAction from '../action/KAction.vue' // Functions function applicationProperties () { - return _.pick(Platform.getData().application, ['mode', 'iframe']) + return _.pick(Platform.getData('application') ['mode', 'iframe']) } function browserProperties () { - return _.pick(Platform.getData().browser, ['name', 'version']) + return _.pick(Platform.getData('browser'), ['name', 'version']) } function systemProperties () { - return Platform.getData().system + return Platform.getData('system') } async function copy () { try { diff --git a/core/client/platform.js b/core/client/platform.js index f1ffa8a4d..25c59062f 100644 --- a/core/client/platform.js +++ b/core/client/platform.js @@ -18,8 +18,8 @@ export const Platform = { this.is.pwa = _.get(config, 'buildMode', 'spa') === 'pwa' logger.debug('[KDK] Platform initialized with:', this) }, - getData () { - return { + getData (scope) { + const data = { userAgent: this.userAgent, application: { mode: this.is.pwa ? 'PWA' : 'SPA', @@ -38,5 +38,7 @@ export const Platform = { touch: this.is.touch || false } } + if (_.isEmpty(scope)) return data + return _.get(data, scope) } }