Skip to content

Commit

Permalink
#1236 Displaying license features parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoraboeuf committed Dec 2, 2024
1 parent 003eaef commit e58e50a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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<NameValue>,
)
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions ontrack-web-core/ontrack.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
37 changes: 31 additions & 6 deletions ontrack-web-core/pages/extension/license/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -35,6 +35,10 @@ export default function LicenseInfoPage() {
id
name
enabled
data {
name
value
}
}
}
licenseControl {
Expand Down Expand Up @@ -129,11 +133,32 @@ export default function LicenseInfoPage() {
<Card
title={feature.name}
>
{
feature.enabled ?
<Tag color="success">Enabled</Tag> :
<Tag color="error">Disabled</Tag>
}
<Space direction="vertical" className="ot-line">
{
feature.enabled ?
<Tag color="success">Enabled</Tag> :
<Tag color="error">Disabled</Tag>
}
{
feature.data.length > 0 &&
<Table
dataSource={feature.data}
size="small"
pagination={false}
>
<Table.Column
key="name"
title="Name"
dataIndex="name"
/>
<Table.Column
key="value"
title="Value"
dataIndex="value"
/>
</Table>
}
</Space>
</Card>
</Col>
))
Expand Down

0 comments on commit e58e50a

Please sign in to comment.