@ -2,6 +2,7 @@ import { useMemo, useEffect } from 'react';
import { useCurrentUser } from '@/react/hooks/useUser' ;
import { useCurrentUser } from '@/react/hooks/useUser' ;
import helm from '@/assets/ico/vendor/helm.svg?c' ;
import helm from '@/assets/ico/vendor/helm.svg?c' ;
import { isPureAdmin } from '@/portainer/users/user.helpers' ;
import { Link } from '@@/Link' ;
import { Link } from '@@/Link' ;
import { Datatable } from '@@/datatables' ;
import { Datatable } from '@@/datatables' ;
@ -22,6 +23,8 @@ export function HelmRepositoryDatatable() {
const { user } = useCurrentUser ( ) ;
const { user } = useCurrentUser ( ) ;
const helmReposQuery = useHelmRepositories ( user . Id ) ;
const helmReposQuery = useHelmRepositories ( user . Id ) ;
const isAdminUser = isPureAdmin ( user ) ;
const tableState = useTableState ( settingsStore , storageKey ) ;
const tableState = useTableState ( settingsStore , storageKey ) ;
const helmRepos = useMemo ( ( ) = > {
const helmRepos = useMemo ( ( ) = > {
@ -58,7 +61,7 @@ export function HelmRepositoryDatatable() {
< Datatable
< Datatable
getRowId = { ( row ) = > String ( row . Id ) }
getRowId = { ( row ) = > String ( row . Id ) }
dataset = { helmRepos }
dataset = { helmRepos }
description = { < HelmDatatableDescription / > }
description = { < HelmDatatableDescription isAdmin = { isAdminUser } / > }
settingsManager = { tableState }
settingsManager = { tableState }
columns = { columns }
columns = { columns }
title = "Helm repositories"
title = "Helm repositories"
@ -74,15 +77,19 @@ export function HelmRepositoryDatatable() {
) ;
) ;
}
}
function HelmDatatableDescription () {
function HelmDatatableDescription ({ isAdmin } : { isAdmin : boolean } ) {
return (
return (
< TextTip color = "blue" className = "mb-3" >
< TextTip color = "blue" className = "mb-3" >
Adding a Helm repo here only makes it available in your own user
Adding a Helm repo here only makes it available in your own user
account & apos ; s Portainer UI . Helm charts are pulled down from these repos
account & apos ; s Portainer UI . Helm charts are pulled down from these repos
( plus the { ' ' }
( plus the { ' ' }
{ isAdmin ? (
< Link to = "portainer.settings" params = { { '#' : 'kubernetes-settings' } } >
< Link to = "portainer.settings" params = { { '#' : 'kubernetes-settings' } } >
< span > globally - set Helm repo < / span >
< span > globally - set Helm repo < / span >
< / Link >
< / Link >
) : (
< span > globally - set Helm repo < / span >
) }
) and shown in the Create from Manifest screen & apos ; s Helm charts list .
) and shown in the Create from Manifest screen & apos ; s Helm charts list .
< / TextTip >
< / TextTip >
) ;
) ;