@@ -27,10 +27,6 @@ import { Query, QueryResult } from '@material-table/core';
2727import { useQuery } from '@tanstack/react-query' ;
2828
2929import Box from '@mui/material/Box' ;
30- import Typography from '@mui/material/Typography' ;
31- import AlertTitle from '@mui/material/AlertTitle' ;
32- import Link from '@mui/material/Link' ;
33- import Alert from '@mui/material/Alert' ;
3430import {
3531 MarketplacePackage ,
3632 MarketplacePackageInstallStatus ,
@@ -53,9 +49,16 @@ import {
5349import { useInstallationContext } from '../InstallationContext' ;
5450import { useNodeEnvironment } from '../../hooks/useNodeEnvironment' ;
5551import { InstalledPluginsDialog } from '../InstalledPluginsDialog' ;
52+ import { useExtensionsConfiguration } from '../../hooks/useExtensionsConfiguration' ;
53+ import {
54+ ProductionEnvironmentAlert ,
55+ ExtensionsConfigurationAlert ,
56+ BackendRestartAlert ,
57+ } from '../SharedAlerts' ;
5658
5759export const InstalledPackagesTable = ( ) => {
5860 const { t } = useTranslation ( ) ;
61+ const extensionsConfig = useExtensionsConfiguration ( ) ;
5962 const { installedPackages } = useInstallationContext ( ) ;
6063 const nodeEnvironment = useNodeEnvironment ( ) ;
6164 const [ error , setError ] = useState < Error | undefined > ( undefined ) ;
@@ -174,7 +177,11 @@ export const InstalledPackagesTable = () => {
174177 render : ( row : InstalledPackageRow ) => {
175178 return (
176179 < Box display = "flex" gap = { 1 } >
177- < EditPackage pkg = { row } isProductionEnv = { isProductionEnvironment } />
180+ < EditPackage
181+ pkg = { row }
182+ isProductionEnv = { isProductionEnvironment }
183+ isInstallationEnabled = { extensionsConfig . data ?. enabled ?? false }
184+ />
178185 { /* Show it when uninstall functionality is implemented */ }
179186 { showUninstall && < UninstallPackage pkg = { row } /> }
180187 < DownloadPackageYaml
@@ -184,6 +191,7 @@ export const InstalledPackagesTable = () => {
184191 < TogglePackage
185192 pkg = { row }
186193 isProductionEnv = { isProductionEnvironment }
194+ isInstallationEnabled = { extensionsConfig . data ?. enabled ?? false }
187195 />
188196 </ Box >
189197 ) ;
@@ -247,6 +255,7 @@ export const InstalledPackagesTable = () => {
247255 ( entity ?. spec ?. version as string | undefined ) ??
248256 undefined ,
249257 hasEntity : ! ! entity ,
258+ missingDynamicArtifact : ! entity ?. spec ?. dynamicArtifact ,
250259 namespace : entity ?. metadata ?. namespace ?? 'default' ,
251260 name : entity ?. metadata ?. name ,
252261 } as InstalledPackageRow ;
@@ -298,32 +307,19 @@ export const InstalledPackagesTable = () => {
298307 ? t ( 'installedPackages.table.emptyMessages.noResults' )
299308 : t ( 'installedPackages.table.emptyMessages.noRecords' ) ;
300309
310+ const showExtensionsConfigurationAlert =
311+ ! isProductionEnvironment && ! extensionsConfig . data ?. enabled ;
312+
301313 return (
302314 < >
303- { isProductionEnvironment && (
304- < Alert severity = "info" sx = { { mb : '1rem' } } >
305- < AlertTitle > { t ( 'alert.productionDisabled' ) } </ AlertTitle >
306- </ Alert >
307- ) }
308- { installedPackagesCount > 0 && (
309- < Alert severity = "info" sx = { { mb : '1rem' } } >
310- < AlertTitle > { t ( 'alert.backendRestartRequired' ) } </ AlertTitle >
311- { packageInfo ( ) }
312- { installedPackagesCount > 1 && (
313- < Typography component = "div" sx = { { pt : '8px' } } >
314- < Link
315- component = "button"
316- underline = "none"
317- onClick = { ( ) => {
318- setOpenInstalledPackagesDialog ( true ) ;
319- } }
320- >
321- { t ( 'alert.viewPackages' ) }
322- </ Link >
323- </ Typography >
324- ) }
325- </ Alert >
326- ) }
315+ { isProductionEnvironment && < ProductionEnvironmentAlert /> }
316+ { showExtensionsConfigurationAlert && < ExtensionsConfigurationAlert /> }
317+ < BackendRestartAlert
318+ count = { installedPackagesCount }
319+ itemInfo = { packageInfo ( ) }
320+ viewItemsLabel = { t ( 'alert.viewPackages' ) }
321+ onViewItems = { ( ) => setOpenInstalledPackagesDialog ( true ) }
322+ />
327323
328324 < div
329325 style = { { display : 'flex' , justifyContent : 'flex-end' , marginBottom : 8 } }
0 commit comments