Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions ...enComponents/pages/ApplicationsPage/ApplicationDetails/ApiGateways/apiGatewaysColumns.jsx
100644 β†’ 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import { buildGatewayEndpoint } from './applicationApiGateways.util'
import {
API_GATEWAY_STATE_CLASS,
API_GATEWAY_STATE_LABEL,
FORCE_SSL_REDIRECT_ANNOTATION,
NUCLIO_OWNER_LABEL
FORCE_SSL_REDIRECT_ANNOTATION
} from '../applicationDetails.constants'
import { buildNuclioOwner } from '../../../../../utils/nuclioEnrichment.util'

export const apiGatewaysColumns = [
{
Expand Down Expand Up @@ -136,11 +136,7 @@ export const apiGatewaysColumns = [
id: 'owner',
header: 'Owner',
size: 10,
accessorFn: row => row.metadata?.labels?.[NUCLIO_OWNER_LABEL] ?? '',
cell: ({ row }) => (
<span className="text-igz-secondary">
{row.original.metadata?.labels?.[NUCLIO_OWNER_LABEL] || ''}
</span>
)
accessorFn: ({ metadata }) => buildNuclioOwner(metadata?.labels),
cell: ({ getValue }) => <span className="text-igz-secondary">{getValue()}</span>
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ illegal under applicable law, and the grant of the foregoing license
under the Apache 2.0 license is conditioned upon your compliance with
such restriction.
*/
import { NUCLIO_OWNER_LABEL } from '../applicationDetails.constants'
import { buildNuclioOwner } from '../../../../../utils/nuclioEnrichment.util'

export {
buildGatewayEndpoint,
Expand All @@ -39,7 +39,7 @@ export const filterApiGatewaysBySearchFields = (gateways, filters) => {

if (
ownerFilter &&
!gateway.metadata?.labels?.[NUCLIO_OWNER_LABEL]?.toLowerCase().includes(ownerFilter)
!buildNuclioOwner(gateway.metadata?.labels).toLowerCase().includes(ownerFilter)
) {
return false
}
Expand Down
2 changes: 0 additions & 2 deletions ...xtGenComponents/pages/ApplicationsPage/ApplicationDetails/applicationDetails.constants.js
100644 β†’ 100755
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ export const API_GATEWAY_STATE_CLASS = {

export { GATEWAY_RELATIONSHIP } from '../../../../utils/apiGateway.util'

export const NUCLIO_OWNER_LABEL = 'iguazio.com/username'

export const FORCE_SSL_REDIRECT_ANNOTATION = 'nginx.ingress.kubernetes.io/force-ssl-redirect'

export const API_GATEWAYS_FILTER_CONFIG = {
Expand Down
13 changes: 10 additions & 3 deletions src/utils/nuclioEnrichment.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ import {
FUNCTIONS_PAGE,
UNHEALTHY_STATE
} from '../constants'

const NUCLIO_FUNCTIONS_STATE_KIND = 'nuclioFunctions'
const NUCLIO_OWNER_LABEL = 'iguazio.com/username'
const NUCLIO_USERNAME_LABEL = 'iguazio.com/username'
const NUCLIO_DOMAIN_LABEL = 'iguazio.com/domain'

export const buildNuclioOwner = labels => {
const username = labels?.[NUCLIO_USERNAME_LABEL]
const domain = labels?.[NUCLIO_DOMAIN_LABEL]

return domain ? `${username}@${domain}` : (username ?? '')
}

const buildEndpointsCountMap = modelEndpoints => {
const countMap = {}
Expand Down Expand Up @@ -67,7 +74,7 @@ export const enrichFunctionsWithNuclio = (
: ''

const state = nuclioFuncState || func.state?.value || ''
const owner = nuclioFunc?.metadata?.labels?.[NUCLIO_OWNER_LABEL] ?? ''
const owner = buildNuclioOwner(nuclioFunc?.metadata?.labels)

const applicationGateways = filterGatewaysByFunction(
projectApiGateways,
Expand Down
Loading