@@ -49,13 +49,41 @@ export type InstalledPackageRow = {
4949 name ?: string ;
5050} ;
5151
52- export const DownloadPackageYaml = ( { pkg } : { pkg : InstalledPackageRow } ) => {
52+ export const DownloadPackageYaml = ( {
53+ pkg,
54+ isProductionEnv,
55+ } : {
56+ pkg : InstalledPackageRow ;
57+ isProductionEnv : boolean ;
58+ } ) => {
5359 const { t } = useTranslation ( ) ;
5460 const pkgConfig = usePackageConfig ( pkg . namespace ! , pkg . name ! ) ;
5561 const packageConfigPermission = usePluginConfigurationPermissions (
5662 pkg . namespace ! ,
5763 pkg . parentPlugin ?? '' ,
5864 ) ;
65+
66+ const disabledIcon = (
67+ < Box component = "span" display = "inline-flex" >
68+ < IconButton
69+ size = "small"
70+ disabled
71+ sx = { { color : theme => theme . palette . action . disabled } }
72+ >
73+ < FileDownloadOutlinedIcon />
74+ </ IconButton >
75+ </ Box >
76+ ) ;
77+
78+ if ( isProductionEnv ) {
79+ return (
80+ < Tooltip
81+ title = { t ( 'installedPackages.table.tooltips.packageProductionDisabled' ) }
82+ >
83+ { disabledIcon }
84+ </ Tooltip >
85+ ) ;
86+ }
5987 const disabled =
6088 ! pkg . hasEntity || packageConfigPermission . data ?. read !== 'ALLOW' ;
6189
@@ -68,15 +96,7 @@ export const DownloadPackageYaml = ({ pkg }: { pkg: InstalledPackageRow }) => {
6896 : t ( 'installedPackages.table.tooltips.enableActions' )
6997 }
7098 >
71- < Box component = "span" display = "inline-flex" >
72- < IconButton
73- size = "small"
74- disabled
75- sx = { { color : theme => theme . palette . action . disabled } }
76- >
77- < FileDownloadOutlinedIcon />
78- </ IconButton >
79- </ Box >
99+ { disabledIcon }
80100 </ Tooltip >
81101 ) ;
82102 }
@@ -99,7 +119,13 @@ export const DownloadPackageYaml = ({ pkg }: { pkg: InstalledPackageRow }) => {
99119 ) ;
100120} ;
101121
102- export const EditPackage = ( { pkg } : { pkg : InstalledPackageRow } ) => {
122+ export const EditPackage = ( {
123+ pkg,
124+ isProductionEnv,
125+ } : {
126+ pkg : InstalledPackageRow ;
127+ isProductionEnv : boolean ;
128+ } ) => {
103129 const { t } = useTranslation ( ) ;
104130 const navigate = useNavigate ( ) ;
105131 const getPackagePath = useRouteRef ( packageInstallRouteRef ) ;
@@ -121,6 +147,16 @@ export const EditPackage = ({ pkg }: { pkg: InstalledPackageRow }) => {
121147 </ Box >
122148 ) ;
123149
150+ if ( isProductionEnv ) {
151+ return (
152+ < Tooltip
153+ title = { t ( 'installedPackages.table.tooltips.packageProductionDisabled' ) }
154+ >
155+ { disabledEditIcon }
156+ </ Tooltip >
157+ ) ;
158+ }
159+
124160 if ( ! pkg . hasEntity ) {
125161 return (
126162 < Tooltip title = { t ( 'installedPackages.table.tooltips.enableActions' ) } >
@@ -158,7 +194,13 @@ export const EditPackage = ({ pkg }: { pkg: InstalledPackageRow }) => {
158194 ) ;
159195} ;
160196
161- export const TogglePackage = ( { pkg } : { pkg : InstalledPackageRow } ) => {
197+ export const TogglePackage = ( {
198+ pkg,
199+ isProductionEnv,
200+ } : {
201+ pkg : InstalledPackageRow ;
202+ isProductionEnv : boolean ;
203+ } ) => {
162204 const { t } = useTranslation ( ) ;
163205 const { installedPackages, setInstalledPackages } = useInstallationContext ( ) ;
164206 const { mutateAsync : enablePlugin } = useEnablePlugin ( true ) ;
@@ -170,6 +212,23 @@ export const TogglePackage = ({ pkg }: { pkg: InstalledPackageRow }) => {
170212 pkg . installStatus === MarketplacePackageInstallStatus . Installed ||
171213 pkg . installStatus === MarketplacePackageInstallStatus . UpdateAvailable ,
172214 ) ;
215+ const disabledIcon = (
216+ < Box component = "span" display = "inline-flex" >
217+ < IconButton size = "small" disabled >
218+ { isPackageEnabled ? < Switch checked disabled /> : < Switch disabled /> }
219+ </ IconButton >
220+ </ Box >
221+ ) ;
222+
223+ if ( isProductionEnv ) {
224+ return (
225+ < Tooltip
226+ title = { t ( 'installedPackages.table.tooltips.packageProductionDisabled' ) }
227+ >
228+ { disabledIcon }
229+ </ Tooltip >
230+ ) ;
231+ }
173232
174233 if ( ! pkg . hasEntity || packageConfigPermission . data ?. write !== 'ALLOW' ) {
175234 return (
@@ -180,15 +239,7 @@ export const TogglePackage = ({ pkg }: { pkg: InstalledPackageRow }) => {
180239 : t ( 'installedPackages.table.tooltips.enableActions' )
181240 }
182241 >
183- < Box component = "span" display = "inline-flex" >
184- < IconButton size = "small" disabled >
185- { isPackageEnabled ? (
186- < Switch checked disabled />
187- ) : (
188- < Switch disabled />
189- ) }
190- </ IconButton >
191- </ Box >
242+ { disabledIcon }
192243 </ Tooltip >
193244 ) ;
194245 }
0 commit comments