From e58e50a8a7f5f04d25fb9d33da1323bfc6226126 Mon Sep 17 00:00:00 2001 From: Damien Coraboeuf Date: Mon, 2 Dec 2024 09:44:14 +0100 Subject: [PATCH] #1236 Displaying license features parameters --- .../extension/license/LicensedFeature.kt | 3 ++ .../control/LicenseControlServiceImpl.kt | 1 + .../graphql/extension-license.graphqls | 6 +++ ontrack-web-core/ontrack.graphql | 6 +++ .../pages/extension/license/info.js | 37 ++++++++++++++++--- 5 files changed, 47 insertions(+), 6 deletions(-) diff --git a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/LicensedFeature.kt b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/LicensedFeature.kt index 9d5fd9182a..9c1455321d 100644 --- a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/LicensedFeature.kt +++ b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/LicensedFeature.kt @@ -1,7 +1,10 @@ package net.nemerosa.ontrack.extension.license +import net.nemerosa.ontrack.model.support.NameValue + data class LicensedFeature( val id: String, val name: String, val enabled: Boolean, + val data: List, ) diff --git a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/control/LicenseControlServiceImpl.kt b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/control/LicenseControlServiceImpl.kt index 89d756d6b6..87bdb68661 100644 --- a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/control/LicenseControlServiceImpl.kt +++ b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/control/LicenseControlServiceImpl.kt @@ -41,6 +41,7 @@ class LicenseControlServiceImpl( id = it.id, name = it.name, enabled = it.alwaysEnabled || license.isFeatureEnabled(it.id), + data = license.findFeatureData(it.id)?.data ?: emptyList(), ) }.sortedBy { it.name } diff --git a/ontrack-extension-license/src/main/resources/graphql/extension-license.graphqls b/ontrack-extension-license/src/main/resources/graphql/extension-license.graphqls index 11faa4d393..cf63ac3c6a 100644 --- a/ontrack-extension-license/src/main/resources/graphql/extension-license.graphqls +++ b/ontrack-extension-license/src/main/resources/graphql/extension-license.graphqls @@ -17,10 +17,16 @@ type License { licensedFeatures: [LicensedFeature!]! } +type LicensedFeatureData { + name: String!, + value: String!, +} + type LicensedFeature { id: String! name: String! enabled: Boolean! + data: [LicensedFeatureData!]! } enum LicenseExpiration { diff --git a/ontrack-web-core/ontrack.graphql b/ontrack-web-core/ontrack.graphql index fbf89ef497..1e1f858b81 100644 --- a/ontrack-web-core/ontrack.graphql +++ b/ontrack-web-core/ontrack.graphql @@ -3213,11 +3213,17 @@ type LicenseResponse { } type LicensedFeature { + data: [LicensedFeatureData!]! enabled: Boolean! id: String! name: String! } +type LicensedFeatureData { + name: String! + value: String! +} + "Output type for the linkBuildById mutation." type LinkBuildByIdPayload implements Payload { "Build linked from" diff --git a/ontrack-web-core/pages/extension/license/info.js b/ontrack-web-core/pages/extension/license/info.js index 66e43b7605..a86f9be5bd 100644 --- a/ontrack-web-core/pages/extension/license/info.js +++ b/ontrack-web-core/pages/extension/license/info.js @@ -3,7 +3,7 @@ import StandardPage from "@components/layouts/StandardPage"; import {useGraphQLClient} from "@components/providers/ConnectionContextProvider"; import LoadingContainer from "@components/common/LoadingContainer"; import {gql} from "graphql-request"; -import {Alert, Card, Col, Descriptions, Row, Space, Tag, Typography} from "antd"; +import {Alert, Card, Col, Descriptions, Row, Space, Table, Tag, Typography} from "antd"; import PageSection from "@components/common/PageSection"; import LicenseActive from "@components/extension/license/LicenseActive"; import LicenseValidUntil from "@components/extension/license/LicenseValidUntil"; @@ -35,6 +35,10 @@ export default function LicenseInfoPage() { id name enabled + data { + name + value + } } } licenseControl { @@ -129,11 +133,32 @@ export default function LicenseInfoPage() { - { - feature.enabled ? - Enabled : - Disabled - } + + { + feature.enabled ? + Enabled : + Disabled + } + { + feature.data.length > 0 && + + + +
+ } +
))