1- import React , { useState } from "react" ;
1+ import React , { useState , useEffect } from "react" ;
22import {
33 Spin ,
44 Typography ,
@@ -9,13 +9,18 @@ import {
99 Menu ,
1010 Button ,
1111 Tag ,
12+ Result ,
1213} from "antd" ;
1314import {
1415 LinkOutlined ,
1516 HomeOutlined ,
1617 AppstoreOutlined ,
1718 UsergroupAddOutlined ,
1819 EditOutlined ,
20+ CheckCircleOutlined ,
21+ CloseCircleOutlined ,
22+ ExclamationCircleOutlined ,
23+ SyncOutlined ,
1924} from "@ant-design/icons" ;
2025
2126import { useSingleEnvironmentContext } from "./context/SingleEnvironmentContext" ;
@@ -95,6 +100,56 @@ const EnvironmentDetail: React.FC = () => {
95100 ) ;
96101 }
97102
103+ // Check if environment is not licensed and show restriction message
104+ if ( environment . isLicensed === false ) {
105+ const getLicenseIcon = ( ) => {
106+ switch ( environment . licenseStatus ) {
107+ case 'unlicensed' :
108+ return < CloseCircleOutlined style = { { color : '#ff4d4f' } } /> ;
109+ case 'error' :
110+ return < ExclamationCircleOutlined style = { { color : '#faad14' } } /> ;
111+ default :
112+ return < CloseCircleOutlined style = { { color : '#ff4d4f' } } /> ;
113+ }
114+ } ;
115+
116+ return (
117+ < div style = { { padding : "24px" , flex : 1 } } >
118+ < Result
119+ icon = { getLicenseIcon ( ) }
120+ title = "Environment Access Restricted"
121+ subTitle = { `This environment is not licensed. ${ environment . licenseError || 'Please check the license configuration.' } ` }
122+ extra = { [
123+ < Button
124+ type = "primary"
125+ key = "back"
126+ onClick = { ( ) => history . push ( "/setting/environments" ) }
127+ >
128+ Back to Environments
129+ </ Button > ,
130+ < Button
131+ key = "edit"
132+ onClick = { handleEditClick }
133+ >
134+ Edit Environment
135+ </ Button >
136+ ] }
137+ />
138+
139+ { /* Still allow editing the environment to fix license issues */ }
140+ { environment && (
141+ < EditEnvironmentModal
142+ visible = { isEditModalVisible }
143+ environment = { environment }
144+ onClose = { handleCloseModal }
145+ onSave = { handleSaveEnvironment }
146+ loading = { isUpdating }
147+ />
148+ ) }
149+ </ div >
150+ ) ;
151+ }
152+
98153 const breadcrumbItems = [
99154 {
100155 key : 'environments' ,
@@ -157,6 +212,22 @@ const EnvironmentDetail: React.FC = () => {
157212 { environment . environmentType }
158213 </ Tag >
159214 </ Descriptions . Item >
215+ < Descriptions . Item label = "License Status" >
216+ { ( ( ) => {
217+ switch ( environment . licenseStatus ) {
218+ case 'checking' :
219+ return < Tag icon = { < SyncOutlined spin /> } color = "blue" style = { { borderRadius : '12px' } } > Checking...</ Tag > ;
220+ case 'licensed' :
221+ return < Tag icon = { < CheckCircleOutlined /> } color = "green" style = { { borderRadius : '12px' } } > Licensed</ Tag > ;
222+ case 'unlicensed' :
223+ return < Tag icon = { < CloseCircleOutlined /> } color = "red" style = { { borderRadius : '12px' } } > Not Licensed</ Tag > ;
224+ case 'error' :
225+ return < Tag icon = { < ExclamationCircleOutlined /> } color = "orange" style = { { borderRadius : '12px' } } > License Error</ Tag > ;
226+ default :
227+ return < Tag color = "default" style = { { borderRadius : '12px' } } > Unknown</ Tag > ;
228+ }
229+ } ) ( ) }
230+ </ Descriptions . Item >
160231 < Descriptions . Item label = "API Key Status" >
161232 { environment . environmentApikey ? (
162233 < Tag color = "green" style = { { borderRadius : '12px' } } > Configured</ Tag >
0 commit comments