1
- import React , { useState } from "react" ;
1
+ import React , { useState , useEffect } from "react" ;
2
2
import {
3
3
Spin ,
4
4
Typography ,
@@ -9,13 +9,18 @@ import {
9
9
Menu ,
10
10
Button ,
11
11
Tag ,
12
+ Result ,
12
13
} from "antd" ;
13
14
import {
14
15
LinkOutlined ,
15
16
HomeOutlined ,
16
17
AppstoreOutlined ,
17
18
UsergroupAddOutlined ,
18
19
EditOutlined ,
20
+ CheckCircleOutlined ,
21
+ CloseCircleOutlined ,
22
+ ExclamationCircleOutlined ,
23
+ SyncOutlined ,
19
24
} from "@ant-design/icons" ;
20
25
21
26
import { useSingleEnvironmentContext } from "./context/SingleEnvironmentContext" ;
@@ -95,6 +100,56 @@ const EnvironmentDetail: React.FC = () => {
95
100
) ;
96
101
}
97
102
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
+
98
153
const breadcrumbItems = [
99
154
{
100
155
key : 'environments' ,
@@ -157,6 +212,22 @@ const EnvironmentDetail: React.FC = () => {
157
212
{ environment . environmentType }
158
213
</ Tag >
159
214
</ 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 >
160
231
< Descriptions . Item label = "API Key Status" >
161
232
{ environment . environmentApikey ? (
162
233
< Tag color = "green" style = { { borderRadius : '12px' } } > Configured</ Tag >
0 commit comments