Skip to content

Commit

Permalink
fix: Move white glove to labels (#2294)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleixhub authored Dec 4, 2024
1 parent 34c12d2 commit fa54968
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion catalog/ui/src/app/Services/ServicesItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ const ServicesItemComponent: React.FC<{
mutate(
await patchResourceClaim(resourceClaim.metadata.namespace, resourceClaim.metadata.name, {
metadata: {
annotations: {
labels: {
[`${DEMO_DOMAIN}/white-glove`]: String(isChecked),
},
},
Expand Down
2 changes: 1 addition & 1 deletion catalog/ui/src/app/Workshops/WorkshopsItemDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const WorkshopsItemDetails: React.FC<{
async function handleWhiteGloveChange(_: any, isChecked: boolean) {
const patchObj = {
metadata: {
annotations: {
labels: {
[`${DEMO_DOMAIN}/white-glove`]: String(isChecked),
},
},
Expand Down
4 changes: 2 additions & 2 deletions catalog/ui/src/app/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ export async function createServiceRequest({
...(catalogItem.spec.multiuser && catalogItem.spec.messageTemplates?.user
? { [`${DEMO_DOMAIN}/user-message-template`]: JSON.stringify(catalogItem.spec.messageTemplates.user) }
: {}),
[`${DEMO_DOMAIN}/white-glove`]: String(whiteGloved),
},
labels: {
[`${BABYLON_DOMAIN}/catalogItemName`]: catalogItem.metadata.name,
Expand All @@ -398,6 +397,7 @@ export async function createServiceRequest({
? { 'gpte.redhat.com/asset-uuid': catalogItem.metadata.labels['gpte.redhat.com/asset-uuid'] }
: {}),
...(catalogItem.spec.bookbag ? { [`${BABYLON_DOMAIN}/labUserInterface`]: 'bookbag' } : {}),
[`${DEMO_DOMAIN}/white-glove`]: String(whiteGloved),
},
name: `${catalogItem.metadata.name}-${suffix}`,
namespace: serviceNamespace.name,
Expand Down Expand Up @@ -523,6 +523,7 @@ export async function createWorkshop({
...(catalogItem.metadata.labels?.['gpte.redhat.com/asset-uuid']
? { 'gpte.redhat.com/asset-uuid': catalogItem.metadata.labels['gpte.redhat.com/asset-uuid'] }
: {}),
[`${DEMO_DOMAIN}/white-glove`]: String(whiteGloved),
},
annotations: {
[`${BABYLON_DOMAIN}/category`]: catalogItem.spec.category,
Expand All @@ -535,7 +536,6 @@ export async function createWorkshop({
startDate && startDate.getTime() + parseDuration('6h') > Date.now() ? 'true' : 'false',
[`${DEMO_DOMAIN}/requester`]: serviceNamespace.requester || email,
[`${DEMO_DOMAIN}/orderedBy`]: session.user,
[`${DEMO_DOMAIN}/white-glove`]: String(whiteGloved),
},
},
spec: {
Expand Down
4 changes: 2 additions & 2 deletions catalog/ui/src/app/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ export function getCostTracker(resourceClaim?: ResourceClaim): CostTracker {
}

export function getWhiteGloved(d?: ResourceClaim | Workshop): boolean {
if (!d || !d.metadata?.annotations?.[`${DEMO_DOMAIN}/white-glove`]) return false;
return d.metadata?.annotations?.[`${DEMO_DOMAIN}/white-glove`] === 'true';
if (!d || !d.metadata?.labels?.[`${DEMO_DOMAIN}/white-glove`]) return false;
return d.metadata?.labels?.[`${DEMO_DOMAIN}/white-glove`] === 'true';
}

export function compareStringDates(stringDate1: string, stringDate2: string): number {
Expand Down
2 changes: 1 addition & 1 deletion workshop-manager/operator/babylon.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Babylon():
lab_ui_urls_annotation = f"{babylon_domain}/labUserInterfaceUrls"
notifier_annotation = f"{babylon_domain}/notifier"
ordered_by_annotation = f"{demo_domain}/orderedBy"
white_glove_annotation = f"{demo_domain}/white-glove"
white_glove_label = f"{demo_domain}/white-glove"
purpose_annotation = f"{demo_domain}/purpose"
purpose_activity_annotation = f"{demo_domain}/purpose-activity"
requester_annotation = f"{demo_domain}/requester"
Expand Down
2 changes: 1 addition & 1 deletion workshop-manager/operator/workshop.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def ordered_by(self):

@property
def white_gloved(self):
return self.annotations.get(Babylon.white_glove_annotation)
return self.labels.get(Babylon.white_glove_label)

@property
def service_url(self):
Expand Down
2 changes: 1 addition & 1 deletion workshop-manager/operator/workshopprovision.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ async def create_resource_claim(self, logger, workshop):
resource_claim_definition['metadata']['annotations'][Babylon.ordered_by_annotation] = workshop.ordered_by

if workshop.white_gloved:
resource_claim_definition['metadata']['annotations'][Babylon.white_glove_annotation] = workshop.white_gloved
resource_claim_definition['metadata']['labels'][Babylon.white_glove_label] = workshop.white_gloved

if catalog_item.lab_ui_type:
resource_claim_definition['metadata']['labels'][Babylon.lab_ui_label] = catalog_item.lab_ui_type
Expand Down

0 comments on commit fa54968

Please sign in to comment.