Skip to content

Commit db1fb34

Browse files
authored
Merge pull request #98 from projectsveltos/empty-profiles
add empty display when profiles are empty
2 parents db43446 + be641ad commit db1fb34

File tree

16 files changed

+91
-59
lines changed

16 files changed

+91
-59
lines changed

SECURITY.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,26 @@
44

55
The following table outlines the versions of the project that are currently supported with security updates:
66

7-
| Version | Supported |
8-
|---------|--------------------|
9-
| All | |
7+
| Version | Supported |
8+
| ------- | --------- |
9+
| All ||
1010

1111
## Reporting a Vulnerability
1212

1313
If you discover a security vulnerability, please follow the steps below to report it responsibly:
1414

1515
1. **Do not disclose publicly**: Avoid sharing the vulnerability in public forums, issues, or pull requests.
1616
2. **Contact us**: Send an email to [support@projectsveltos.io](mailto:support@projectsveltos.io) with the details of the vulnerability, including:
17-
- A description of the issue.
18-
- Steps to reproduce the vulnerability.
19-
- Any potential impact or exploit scenarios.
17+
- A description of the issue.
18+
- Steps to reproduce the vulnerability.
19+
- Any potential impact or exploit scenarios.
2020
3. **Response time**: We will acknowledge receipt of your report within 48 hours and provide a timeline for addressing the issue.
2121
4. **Credit**: If you wish, we will credit you for the discovery once the issue is resolved.
2222

2323
## Security Best Practices
2424

2525
To ensure the security of your deployment, follow these best practices:
26+
2627
- Always use the latest stable version of the project.
2728
- Regularly review and update dependencies.
2829
- Restrict access to sensitive resources and configurations.
@@ -32,4 +33,4 @@ To ensure the security of your deployment, follow these best practices:
3233

3334
We are committed to transparency and will publicly disclose vulnerabilities after they have been resolved and patches have been made available. Details will be shared in the release notes or security advisories.
3435

35-
For more information, refer to the [documentation](https://projectsveltos.github.io/sveltos/).
36+
For more information, refer to the [documentation](https://projectsveltos.github.io/sveltos/).

src/hooks/NavigateWithParams.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
21
import { Navigate, useLocation } from "react-router-dom";
32
const PreserveSearchNavigate = ({ to }: { to: string }) => {
43
const location = useLocation();
54
const searchParams = location.search; // Get current search params
65

7-
86
return <Navigate to={`${to}${searchParams}`} />;
97
};
108

11-
export default PreserveSearchNavigate;
9+
export default PreserveSearchNavigate;

src/lib/components/ui/emptyData.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ export const EmptyData = ({
2424
<h2 className="text-center text-base font-semibold leading-relaxed pb-1">
2525
There’s no {name} found.
2626
</h2>
27-
<p className="text-base text-xs font-normal leading-snug pb-4">
27+
<div className="text-base font-normal leading-snug pb-4">
2828
<ul>
29+
{isFiltered && (
2930
<li>Try changing the filter criteria or clear the filter</li>
31+
)}
3032
<li>Try refreshing the page or check back later</li>
3133
</ul>
32-
</p>
34+
</div>
3335
<div className="flex gap-3">
3436
{isFiltered && (
3537
<Button onClick={clearFilter}>

src/lib/components/ui/failed-flag.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import {
1010
TooltipTrigger,
1111
} from "@/lib/components/ui/tooltip";
1212

13-
14-
export const FailedFlag = ({ msg }: { msg?: string | undefined | null}) => {
13+
export const FailedFlag = ({ msg }: { msg?: string | undefined | null }) => {
1514
return (
1615
<>
1716
<Tooltip>
@@ -21,7 +20,6 @@ export const FailedFlag = ({ msg }: { msg?: string | undefined | null}) => {
2120
<Icons.k8s className={"h-6 w-6 animate-pulse"} />
2221
</AvatarRectFallback>
2322
</AvatarRectangle>
24-
2523
</TooltipTrigger>
2624
<TooltipContent>
2725
<div className={"inline-flex items-baseline"}>
@@ -36,4 +34,4 @@ export const FailedFlag = ({ msg }: { msg?: string | undefined | null}) => {
3634
</Tooltip>
3735
</>
3836
);
39-
};
37+
};

src/modules/clusters/cluster-information/ClusterInfoById.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ export function ClusterInfoById() {
4444
<ClusterHeading
4545
name={InfoQuery.data.managedClusters[0].name}
4646
ready={InfoQuery.data.managedClusters[0]?.clusterInfo.ready}
47-
failureMsg={InfoQuery.data.managedClusters[0]?.clusterInfo.failureMessage}
47+
failureMsg={
48+
InfoQuery.data.managedClusters[0]?.clusterInfo.failureMessage
49+
}
4850
namespace={InfoQuery.data.managedClusters[0].namespace}
4951
version={InfoQuery.data.managedClusters[0]?.clusterInfo.version}
5052
/>

src/modules/clusters/cluster-information/components/clusterHeading.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const ClusterHeading = ({
2020
ready,
2121
hideDetails,
2222
namespace,
23-
failureMsg
23+
failureMsg,
2424
}: ClusterHeadingProps) => {
2525
const navigate = useNavigate();
2626
return (
@@ -55,13 +55,11 @@ export const ClusterHeading = ({
5555
{!hideDetails && (
5656
<Badge
5757
variant="outline"
58-
className={`ml-auto sm:ml-0 ${failureMsg ?"bg-red-500": "bg-main-500" } flex items-center text-white`}
58+
className={`ml-auto sm:ml-0 ${failureMsg ? "bg-red-500" : "bg-main-500"} flex items-center text-white`}
5959
>
6060
<Icons.k8s className="w-4 h-4 mr-1" />
61-
{failureMsg ?"Unhealthy": "Healthy" }
61+
{failureMsg ? "Unhealthy" : "Healthy"}
6262
</Badge>
63-
64-
6563
)}
6664
{!hideDetails && (
6765
<Badge

src/modules/clusters/clusters-list/components/ClusterCard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export const ClusterCard = ({
2929
labels,
3030
onClick,
3131
failureMsg,
32-
3332
}: ClusterCardProps) => {
3433
const labelEntries = Object.entries(labels || {});
3534
const displayEntries = labelEntries.slice(0, appConfig.maxBadges);
@@ -43,7 +42,7 @@ export const ClusterCard = ({
4342
onClick={onClick}
4443
>
4544
<div className=" flex items-center space-x-4 rounded-md p-4">
46-
{failureMsg ?<FailedFlag msg={failureMsg} />: <ReadyFlag /> }
45+
{failureMsg ? <FailedFlag msg={failureMsg} /> : <ReadyFlag />}
4746
<div className="flex-1 space-y-1">
4847
<p className="text-sm font-medium leading-none">
4948
{name}

src/modules/profiles/profile-information/ProfileInformation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { useParams } from "react-router-dom";
77
import { LoadingProfile } from "@/modules/profiles/profile-information/components/ProfileInfo/LoadingProfile";
88

99
export function ProfileInformation() {
10-
const { namespace= "", name = "", kind = "" } = useParams();
10+
const { namespace = "", name = "", kind = "" } = useParams();
1111

1212
const { data, isLoading, isSuccess } = useProfileInfo(namespace, name, kind);
1313
return (
@@ -27,7 +27,7 @@ export function ProfileInformation() {
2727
</div>
2828
<div className="col-span-6">
2929
<ProfileSpecCard spec={data.spec} />
30-
<MatchingClusterTable data={data?.matchingClusters??[]} />
30+
<MatchingClusterTable data={data?.matchingClusters ?? []} />
3131
</div>
3232
</div>
3333
</div>

src/modules/profiles/profile-information/components/ClusterTable/MatchingClusterTable.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import { MatchingCluster } from "@/types/profile.types";
2222
import { FailureMessage } from "@/lib/components/ui/failureMessage";
2323

2424
export default function MatchingClusterTable({
25-
data,
26-
}: {
25+
data,
26+
}: {
2727
data: MatchingCluster[];
2828
}) {
2929
const [openAccordions, setOpenAccordions] = useState<number[]>([]);
@@ -47,14 +47,21 @@ export default function MatchingClusterTable({
4747
</CardDescription>
4848
</CardHeader>
4949
<CardContent>
50-
<ScrollArea className={data.length === 0?"":" h-96"+"rounded-md border p-4"}>
50+
<ScrollArea
51+
className={data.length === 0 ? "" : " h-96" + "rounded-md border p-4"}
52+
>
5153
{data.length === 0 ? (
52-
<span className={"flex flex-col items-center justify-center h-full mt-4"}>
54+
<span
55+
className={
56+
"flex flex-col items-center justify-center h-full mt-4"
57+
}
58+
>
5359
<Archive className="h-12 w-12 text-muted-foreground" />
54-
<div className="flex justify-center items-center h-full">
55-
56-
<p className="text-muted-foreground mt-2">No matching clusters found.</p>
57-
</div>
60+
<div className="flex justify-center items-center h-full">
61+
<p className="text-muted-foreground mt-2">
62+
No matching clusters found.
63+
</p>
64+
</div>
5865
</span>
5966
) : (
6067
<Table>
@@ -166,4 +173,4 @@ export default function MatchingClusterTable({
166173
</CardContent>
167174
</Card>
168175
);
169-
}
176+
}

src/modules/profiles/profile-information/components/ProfileRelations/ProfileRelations.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export function ProfileRelations({
3535
profile,
3636
}: {
3737
profile: {
38-
kind: string,
39-
namespace: string,
38+
kind: string;
39+
namespace: string;
4040
name: string;
4141
apiVersion?: string;
4242
dependencies: Dependency[];

0 commit comments

Comments
 (0)