Skip to content

Commit

Permalink
id views - implement Applied to tab
Browse files Browse the repository at this point in the history
Also expanded alerts to accept react nodes for the alert title

Fixes: freeipa#585

Signed-off-by: Mark Reynolds <[email protected]>
  • Loading branch information
mreynolds389 committed Nov 15, 2024
1 parent c375511 commit e471b93
Show file tree
Hide file tree
Showing 19 changed files with 1,116 additions and 110 deletions.
8 changes: 6 additions & 2 deletions src/hooks/useAlerts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type AlertVariant = "custom" | "danger" | "warning" | "success" | "info";

export interface AlertInfo {
name: string;
title: string;
title: string | React.ReactNode;
variant: AlertVariant;
}

Expand All @@ -22,7 +22,11 @@ export function useAlerts() {
return alerts.filter((alert) => alert.name !== name);
};

const addAlert = (name: string, title: string, variant: AlertVariant) => {
const addAlert = (
name: string,
title: string | React.ReactNode,
variant: AlertVariant
) => {
const alert: AlertInfo = {
name: name,
title: title,
Expand Down
4 changes: 4 additions & 0 deletions src/navigation/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ export const AppRoutes = ({ isInitialDataLoaded }): React.ReactElement => {
path="override-groups"
element={<IDViewsTabs section="override-groups" />}
/>
<Route
path="appliedto"
element={<IDViewsTabs section="appliedto" />}
/>
</Route>
</Route>
<Route path="user-group-rules">
Expand Down
8 changes: 6 additions & 2 deletions src/pages/IDViews/IDViews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,9 @@ const IDViews = () => {
if (response.data.result) {
alerts.addAlert(
"unapply-id-views-hosts-success",
"ID views unapplied from hosts",
"ID views unapplied from " +
response.data.result["completed"] +
" hosts",
"success"
);
// Refresh data
Expand Down Expand Up @@ -406,7 +408,9 @@ const IDViews = () => {
if (response.data.result) {
alerts.addAlert(
"unapply-id-views-hosts-success",
"ID views unapplied from host groups",
"ID views unapplied from " +
response.data.result["completed"] +
" hosts",
"success"
);
// Refresh data
Expand Down
Loading

0 comments on commit e471b93

Please sign in to comment.