Skip to content

Commit

Permalink
feat: Forward white-glove into RC
Browse files Browse the repository at this point in the history
  • Loading branch information
aleixhub committed Nov 21, 2024
1 parent c13137b commit 3114ca4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 16 deletions.
37 changes: 21 additions & 16 deletions catalog/ui/src/app/Workshops/WorkshopsItemDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
DescriptionListDescription,
Tooltip,
Switch,
Button,
TextInput,
Radio,
} from '@patternfly/react-core';
Expand Down Expand Up @@ -181,6 +180,26 @@ const WorkshopsItemDetails: React.FC<{
}
}

async function handleWhiteGloveChange(_: any, isChecked: boolean) {
const patchObj = {
metadata: {
annotations: {
[`${DEMO_DOMAIN}/white-glove`]: String(isChecked),
},
},
};
onWorkshopUpdate(
await patchWorkshop({
name: workshop.metadata.name,
namespace: workshop.metadata.namespace,
patch: patchObj,
})
);
for (let resourceClaim of resourceClaims) {
patchResourceClaim(resourceClaim.metadata.namespace, resourceClaim.metadata.name, patchObj);
}
}

return (
<DescriptionList isHorizontal className="workshops-item-details">
<DescriptionListGroup>
Expand Down Expand Up @@ -500,21 +519,7 @@ const WorkshopsItemDetails: React.FC<{
label="White-Glove Support (for admins to tick when giving a white gloved experience)"
isChecked={whiteGloved}
hasCheckIcon
onChange={async (_event, isChecked) => {
onWorkshopUpdate(
await patchWorkshop({
name: workshop.metadata.name,
namespace: workshop.metadata.namespace,
patch: {
metadata: {
annotations: {
[`${DEMO_DOMAIN}/white-glove`]: String(isChecked),
},
},
},
})
);
}}
onChange={handleWhiteGloveChange}
/>
</DescriptionListDescription>
</DescriptionListGroup>
Expand Down
1 change: 1 addition & 0 deletions workshop-manager/operator/babylon.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +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"
purpose_annotation = f"{demo_domain}/purpose"
purpose_activity_annotation = f"{demo_domain}/purpose-activity"
requester_annotation = f"{demo_domain}/requester"
Expand Down
4 changes: 4 additions & 0 deletions workshop-manager/operator/workshop.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ def requester(self):
def ordered_by(self):
return self.annotations.get(Babylon.ordered_by_annotation)

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

@property
def service_url(self):
return self.annotations.get(Babylon.url_annotation)
Expand Down
3 changes: 3 additions & 0 deletions workshop-manager/operator/workshopprovision.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ async def create_resource_claim(self, logger, workshop):

if workshop.ordered_by:
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

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 3114ca4

Please sign in to comment.