@@ -32,13 +32,29 @@ const cardTitleGroup = css({
3232 display : 'flex' ,
3333 alignItems : 'center' ,
3434 gap : spacing [ 3 ] ,
35- marginBottom : spacing [ 2 ] ,
3635} ) ;
3736
3837const CardTitleGroup : React . FunctionComponent = ( { children } ) => {
3938 return < div className = { cardTitleGroup } > { children } </ div > ;
4039} ;
4140
41+ const inactiveLightStyles = css ( {
42+ color : palette . gray . dark1 ,
43+ } ) ;
44+
45+ const inactiveDarkStyles = css ( {
46+ color : palette . gray . light1 ,
47+ } ) ;
48+
49+ const inactiveCardStyles = css ( {
50+ borderStyle : 'dashed' ,
51+ borderWidth : 2 ,
52+ } ) ;
53+
54+ const tooltipTriggerStyles = css ( {
55+ display : 'flex' ,
56+ } ) ;
57+
4258const cardNameWrapper = css ( {
4359 // Workaround for uncollapsible text in flex children
4460 minWidth : 0 ,
@@ -64,15 +80,21 @@ const cardName = css({
6480 fontWeight : '600 !important' as unknown as number ,
6581} ) ;
6682
67- const CardName : React . FunctionComponent < { children : string } > = ( {
68- children,
69- } ) => {
83+ const CardName : React . FunctionComponent < {
84+ children : string ;
85+ isProvisioned : boolean ;
86+ } > = ( { children, isProvisioned } ) => {
7087 const darkMode = useDarkMode ( ) ;
7188 return (
7289 < div title = { children } className = { cardNameWrapper } >
7390 < Subtitle
7491 as = "div"
75- className = { cx ( cardName , darkMode ? cardNameDark : cardNameLight ) }
92+ className = { cx (
93+ cardName ,
94+ darkMode ? cardNameDark : cardNameLight ,
95+ ! isProvisioned && ! darkMode && inactiveLightStyles ,
96+ ! isProvisioned && darkMode && inactiveDarkStyles
97+ ) }
7698 >
7799 { children }
78100 </ Subtitle >
@@ -163,6 +185,7 @@ export type NamespaceItemCardProps = {
163185 status : 'initial' | 'fetching' | 'refreshing' | 'ready' | 'error' ;
164186 data : DataProp [ ] ;
165187 badges ?: BadgeProp [ ] | null ;
188+ isProvisioned : boolean ;
166189 onItemClick ( id : string ) : void ;
167190 onItemDeleteClick ?: ( id : string ) => void ;
168191} ;
@@ -195,9 +218,11 @@ export const NamespaceItemCard: React.FunctionComponent<
195218 onItemDeleteClick,
196219 badges = null ,
197220 viewType,
221+ isProvisioned,
198222 ...props
199223} ) => {
200224 const readOnly = usePreference ( 'readOnly' ) ;
225+ const darkMode = useDarkMode ( ) ;
201226 const [ hoverProps , isHovered ] = useHoverState ( ) ;
202227 const [ focusProps , focusState ] = useFocusState ( ) ;
203228
@@ -207,7 +232,7 @@ export const NamespaceItemCard: React.FunctionComponent<
207232
208233 const hasDeleteHandler = ! ! onItemDeleteClick ;
209234 const cardActions : ItemAction < NamespaceAction > [ ] = useMemo ( ( ) => {
210- return readOnly || ! hasDeleteHandler
235+ return readOnly || ! hasDeleteHandler || ! isProvisioned
211236 ? [ ]
212237 : [
213238 {
@@ -216,7 +241,7 @@ export const NamespaceItemCard: React.FunctionComponent<
216241 icon : 'Trash' ,
217242 } ,
218243 ] ;
219- } , [ type , readOnly , hasDeleteHandler ] ) ;
244+ } , [ type , readOnly , isProvisioned , hasDeleteHandler ] ) ;
220245
221246 const defaultActionProps = useDefaultAction ( onDefaultAction ) ;
222247
@@ -238,7 +263,16 @@ export const NamespaceItemCard: React.FunctionComponent<
238263 ) ;
239264
240265 const cardProps = mergeProps (
241- { className : card } ,
266+ {
267+ className : cx (
268+ card ,
269+ ! isProvisioned && [
270+ ! darkMode && inactiveLightStyles ,
271+ darkMode && inactiveDarkStyles ,
272+ inactiveCardStyles ,
273+ ]
274+ ) ,
275+ } ,
242276 defaultActionProps ,
243277 hoverProps ,
244278 focusProps ,
@@ -262,7 +296,22 @@ export const NamespaceItemCard: React.FunctionComponent<
262296 { ...cardProps }
263297 >
264298 < CardTitleGroup >
265- < CardName > { name } </ CardName >
299+ < CardName isProvisioned = { isProvisioned } > { name } </ CardName >
300+
301+ { ! isProvisioned && (
302+ < Tooltip
303+ align = "bottom"
304+ justify = "start"
305+ trigger = {
306+ < div className = { tooltipTriggerStyles } >
307+ < Icon glyph = { 'InfoWithCircle' } />
308+ </ div >
309+ }
310+ >
311+ You have privileges to this namespace, but it is not in your list of
312+ current namespaces
313+ </ Tooltip >
314+ ) }
266315
267316 { viewType === 'list' && badgesGroup }
268317
@@ -283,7 +332,7 @@ export const NamespaceItemCard: React.FunctionComponent<
283332 < NamespaceParam
284333 key = { idx }
285334 label = { label }
286- hint = { hint }
335+ hint = { isProvisioned && hint }
287336 value = { value }
288337 status = { status }
289338 viewType = { viewType }
0 commit comments