Skip to content

Commit

Permalink
Bump agnosticv operator version & handle new prefix (#1027)
Browse files Browse the repository at this point in the history
* Bump agnosticv operator version & handle new prefix

* fixup! Bump agnosticv operator version & handle new prefix
  • Loading branch information
aleixhub authored Mar 22, 2023
1 parent 1d1a1e0 commit 4305336
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 14 deletions.
2 changes: 1 addition & 1 deletion catalog/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ui:
name: # default use chart name + '-ui'
image:
#override:
tag: v0.27.5
tag: v0.27.6
repository: quay.io/redhat-gpte/babylon-catalog-ui
pullPolicy: IfNotPresent
replicaCount: 1
Expand Down
20 changes: 19 additions & 1 deletion catalog/ui/src/app/Catalog/Catalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ import { apiPaths, fetcherItemsInAllPages } from '@app/api';
import { CatalogItem } from '@app/types';
import useSession from '@app/utils/useSession';
import SearchInputString from '@app/components/SearchInputString';
import { checkAccessControl, displayName, BABYLON_DOMAIN, FETCH_BATCH_LIMIT, stripTags } from '@app/util';
import {
checkAccessControl,
displayName,
BABYLON_DOMAIN,
FETCH_BATCH_LIMIT,
stripTags,
CATALOG_MANAGER_DOMAIN,
} from '@app/util';
import LoadingIcon from '@app/components/LoadingIcon';
import Footer from '@app/components/Footer';
import {
Expand Down Expand Up @@ -143,6 +150,17 @@ function filterCatalogItemByLabels(catalogItem: CatalogItem, labelFilter: { [att
.substring(BABYLON_DOMAIN.length + 1)
.replace(/-[0-9]+$/, '')
.toLowerCase();
if (matchAttr === ciAttr) {
if (matchValues.includes(ciValue.toLowerCase())) {
matched = true;
}
}
}
if (ciLabel.startsWith(`${CATALOG_MANAGER_DOMAIN}/`)) {
const ciAttr = ciLabel
.substring(CATALOG_MANAGER_DOMAIN.length + 1)
.replace(/-[0-9]+$/, '')
.toLowerCase();
if (matchAttr === ciAttr) {
if (ciAttr === CUSTOM_LABELS.RATING.key) {
if (parseInt(ciValue, 10) >= parseInt(matchValues[0], 10)) matched = true;
Expand Down
11 changes: 9 additions & 2 deletions catalog/ui/src/app/Catalog/CatalogItemDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
getHelpUrl,
isResourceClaimPartOfWorkshop,
compareK8sObjectsArr,
CATALOG_MANAGER_DOMAIN,
} from '@app/util';
import StarRating from '@app/components/StarRating';
import TimeInterval from '@app/components/TimeInterval';
Expand Down Expand Up @@ -163,14 +164,20 @@ const CatalogItemDetails: React.FC<{ catalogItem: CatalogItem; onClose: () => vo
const attributes: { [attr: string]: string } = {};
for (const [label, value] of Object.entries(labels || {})) {
if (label.startsWith(`${BABYLON_DOMAIN}/`)) {
const attr: string = label.substring(BABYLON_DOMAIN.length + 1);
const attr = label.substring(BABYLON_DOMAIN.length + 1);
if (!HIDDEN_LABELS_DETAIL_VIEW.includes(attr)) {
attributes[attr] = value;
}
}
if (label.startsWith(`${CATALOG_MANAGER_DOMAIN}/`)) {
const attr = label.substring(CATALOG_MANAGER_DOMAIN.length + 1);
if (!HIDDEN_LABELS_DETAIL_VIEW.includes(attr)) {
attributes[attr] = value;
}
}
}

async function orderCatalogItem(): Promise<void> {
async function orderCatalogItem() {
navigate(`/catalog/${namespace}/order/${name}`);
}

Expand Down
33 changes: 24 additions & 9 deletions catalog/ui/src/app/Catalog/CatalogLabelSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useCallback, useState } from 'react';
import { Button, Checkbox, ExpandableSection, Form, FormGroup, Tooltip } from '@patternfly/react-core';
import FilterAltIcon from '@patternfly/react-icons/dist/js/icons/filter-alt-icon';
import { CatalogItem } from '@app/types';
import { BABYLON_DOMAIN } from '@app/util';
import { BABYLON_DOMAIN, CATALOG_MANAGER_DOMAIN } from '@app/util';
import StarRating from '@app/components/StarRating';
import { formatString, HIDDEN_LABELS, CUSTOM_LABELS } from './catalog-utils';

Expand Down Expand Up @@ -32,11 +32,17 @@ const CatalogLabelSelector: React.FC<{
for (const catalogItem of catalogItems || []) {
if (!catalogItem.metadata.labels) continue;
for (const [label, value] of Object.entries(catalogItem.metadata.labels)) {
if (!label.startsWith(`${BABYLON_DOMAIN}/`)) continue;
let domain: string = null;
if (label.startsWith(`${BABYLON_DOMAIN}/`)) {
domain = BABYLON_DOMAIN;
} else if (label.startsWith(`${CATALOG_MANAGER_DOMAIN}/`)) {
domain = CATALOG_MANAGER_DOMAIN;
}
if (!domain) continue;
if (label.toLowerCase() === `${CUSTOM_LABELS.CATEGORY.domain}/${CUSTOM_LABELS.CATEGORY.key}`) continue;

// Allow multiple values for labels with numeric suffixes
const attr = label.substring(BABYLON_DOMAIN.length + 1).replace(/-[0-9]+$/, '');
const attr = label.substring(domain.length + 1).replace(/-[0-9]+$/, '');
const attrKey = attr.toLowerCase();
// Only non-hidden labels
if (!HIDDEN_LABELS.includes(attr)) {
Expand All @@ -60,14 +66,23 @@ const CatalogLabelSelector: React.FC<{
for (const catalogItem of filteredCatalogItems || []) {
if (!catalogItem.metadata.labels) continue;
for (const [label, value] of Object.entries(catalogItem.metadata.labels)) {
if (!label.startsWith(`${BABYLON_DOMAIN}/`)) continue;
if (label.toLowerCase() === `${CUSTOM_LABELS.CATEGORY.domain}/${CUSTOM_LABELS.CATEGORY.key}`) continue;
// Allow multiple values for labels with numeric suffixes
const attrKey = label.substring(BABYLON_DOMAIN.length + 1).replace(/-[0-9]+$/, '');
// Only non-hidden labels
if (!HIDDEN_LABELS.includes(attrKey)) {
const valueKey = value.toLowerCase();
labels[attrKey.toLowerCase()].values[valueKey].count++;
if (label.startsWith(`${BABYLON_DOMAIN}/`)) {
const attrKey = label.substring(BABYLON_DOMAIN.length + 1).replace(/-[0-9]+$/, '');
// Only non-hidden labels
if (!HIDDEN_LABELS.includes(attrKey)) {
const valueKey = value.toLowerCase();
labels[attrKey.toLowerCase()].values[valueKey].count++;
}
}
if (label.startsWith(`${CATALOG_MANAGER_DOMAIN}/`)) {
const attrKey = label.substring(CATALOG_MANAGER_DOMAIN.length + 1).replace(/-[0-9]+$/, '');
// Only non-hidden labels
if (!HIDDEN_LABELS.includes(attrKey)) {
const valueKey = value.toLowerCase();
labels[attrKey.toLowerCase()].values[valueKey].count++;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion openshift/config/common/vars.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Component Versions
agnosticv_operator_version: v0.31.9
agnosticv_operator_version: v0.31.10
babylon_anarchy_version: v0.23.1
babylon_anarchy_governor_version: v0.19.1
poolboy_version: v1.3.2
Expand Down

0 comments on commit 4305336

Please sign in to comment.