Skip to content

Commit

Permalink
Merge pull request #1812 from gettakaro/bugfix/cards
Browse files Browse the repository at this point in the history
Fix: cards without body
  • Loading branch information
emielvanseveren authored Nov 9, 2024
2 parents 6492441 + 027eb6f commit 044a46c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const ToggleButtonGroup: FC<ToggleButtonGroupProps> & SubComponents = ({
const m = new Map<string, boolean>();
Children.forEach(children, (child) => {
if (isValidElement(child)) {
console.log(child.props.value, defaultValue);
if (child.props.value === defaultValue) {
m.set(child.props.value, true);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ export function ObjectFieldTemplate<T = any, S extends StrictRJSFSchema = RJSFSc
return idSchema['$id'] === 'root';
}

console.log(schema, uiSchema);

return (
<div>
{/* if parent title is commands/cronjobs/hooks then dont render */}
Expand Down
11 changes: 7 additions & 4 deletions packages/web-main/src/queries/module.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,13 @@ export const useCommandUpdate = () => {
commands: prev.commands.map((c) => (c.id === updatedCommand.id ? updatedCommand : c)),
};
});
return queryClient.setQueryData<CommandOutputDTO>(
moduleKeys.commands.detail(updatedCommand.id),
updatedCommand,
);
return queryClient.invalidateQueries({ queryKey: moduleKeys.commands.detail(updatedCommand.id) });
// TODO: Test this again when: https://github.com/gettakaro/takaro/issues/1811 is fixed.
// We probably also want to add a test to that.
//return queryClient.setQueryData<CommandOutputDTO>(
// moduleKeys.commands.detail(updatedCommand.id),
// updatedCommand,
//);
},
}),
defaultCommandErrorMessages,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const ModuleOnboarding: FC<ModuleOnboardingProps> = ({ moduleId }) => {
<InfoCard title="CronJobs" onClick={async () => await createComponent('cronjob')}>
Cronjobs are triggered based on time. This can be a simple repeating pattern like "Every 5 minutes" or "Every
day" or you can use raw Cron (opens in a new tab) syntax to define more complex patterns like "Every Monday,
Wednesday and Friday at 2 PM";
Wednesday and Friday at 2 PM".
</InfoCard>
</Grid>
</Wrapper>
Expand All @@ -118,19 +118,21 @@ export const InfoCard: FC<PropsWithChildren<InfoCardProps>> = ({ title, onClick,

return (
<Card onClick={onClick}>
<Flex>
<h2>{title}</h2>
{children}
<a
className="underline"
href={`https://docs.takaro.io/modules#${title.toLowerCase()}`}
target="_blank"
rel="noreferrer noopener"
onClick={handleClick}
>
Learn more
</a>
</Flex>
<Card.Title label={title}></Card.Title>
<Card.Body>
<Flex>
{children}
<a
className="underline"
href={`https://docs.takaro.io/advanced/modules#${title.toLowerCase()}`}
target="_blank"
rel="noreferrer noopener"
onClick={handleClick}
>
Learn more
</a>
</Flex>
</Card.Body>
</Card>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,20 @@ export const RoleForm: FC<CreateUpdateRoleFormProps> = ({
{}
{Object.values(groupedModulePermissions).map((group: any) => (
<Card key={group.module.id} variant="outline" style={{ marginBottom: theme.spacing['2'] }}>
<h3 style={{ marginBottom: theme.spacing['1'], textTransform: 'capitalize' }}>
{group.module.name}
</h3>
{}
{group.permissions.map((permission: any) => (
<PermissionField
key={permission.id}
permission={permission}
control={control}
readOnly={readOnly}
/>
))}
<Card.Body>
<h3 style={{ marginBottom: theme.spacing['1'], textTransform: 'capitalize' }}>
{group.module.name}
</h3>
{}
{group.permissions.map((permission: any) => (
<PermissionField
key={permission.id}
permission={permission}
control={control}
readOnly={readOnly}
/>
))}
</Card.Body>
</Card>
))}{' '}
</CollapseList.Item>
Expand Down

0 comments on commit 044a46c

Please sign in to comment.