Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5a5830b
move components into more specific directories
jq-ln Apr 16, 2025
daa97f1
move alarms components
jq-ln Apr 16, 2025
621db43
merge in main
jq-ln Apr 16, 2025
6b2e555
add CreateNewInstanceButton
jq-ln Apr 17, 2025
94118f6
extract instance table
jq-ln Apr 17, 2025
9343b8c
change font loading from swap to optional to appease Chrome
jq-ln Apr 17, 2025
88edb00
change type file names to match convention
jq-ln Apr 17, 2025
9c83fd1
extract delete instance modal
jq-ln Apr 17, 2025
88b20e9
extract each field from the new instance page
jq-ln Apr 17, 2025
f5bc82a
remove unnecessary file
jq-ln Apr 17, 2025
30f82e4
extract info components from [name] page
jq-ln Apr 17, 2025
f243787
extract components from alarms page
jq-ln Apr 18, 2025
98bd7e7
fix import statements
jq-ln Apr 18, 2025
c10ad5c
extract components from backups page
jq-ln Apr 18, 2025
4cbd560
extract components from config page
jq-ln Apr 18, 2025
aeaab6f
extract components from firewalls page
jq-ln Apr 18, 2025
464dda2
extract components from logs page
jq-ln Apr 18, 2025
9cc53c9
extract components from plugins page
jq-ln Apr 18, 2025
360fd09
extract components from plugins page
jq-ln Apr 18, 2025
71041e4
Merge branch 'main' into jimqueline/FrontendRefactor
jq-ln Apr 18, 2025
55d4d7d
fix alarms route import
jq-ln Apr 18, 2025
ee030dc
fix another import
jq-ln Apr 18, 2025
92bdf27
and another
jq-ln Apr 19, 2025
78bff5c
...
jq-ln Apr 19, 2025
34a454e
...
jq-ln Apr 19, 2025
4afa888
...
jq-ln Apr 19, 2025
2a0cf04
change config button color
jq-ln Apr 21, 2025
437ca5d
merge main
jq-ln Apr 21, 2025
7fa7181
fix lint error
jq-ln Apr 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/api/instances/[name]/alarms/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EC2Client } from "@aws-sdk/client-ec2";
import { NextRequest, NextResponse } from "next/server";
import { fetchInstance } from "@/utils/AWS/EC2/fetchInstance";
import { Alarm } from "@/types/alarms";
import Alarm from "@/app/instances/[name]/alarms/types/alarm";
import { startMetricsMonitoring } from "@/utils/RabbitMQ/monitorMetrics";
import { decrypt } from "@/utils/encrypt";
import { stopMetricsMonitoring } from "@/utils/RabbitMQ/monitorMetrics";
Expand Down
15 changes: 15 additions & 0 deletions src/app/instances/[name]/alarms/components/CreateAlarmButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export default function CreateAlarmButton({ onClick }: { onClick: () => void }) {
return (
<div className="font-heading1 text-sm flex justify-end gap-4 mt-6">
<button
className="px-4 py-2 bg-btn1 hover:bg-btnhover1 text-sm text-mainbg1 font-semibold rounded-sm flex items-center justify-center hover:shadow-[0_0_10px_#87d9da] transition-all duration-200"
onClick={(e) => {
e.preventDefault();
onClick();
}}
>
Create Alarm
</button>
</div>
)
}
14 changes: 14 additions & 0 deletions src/app/instances/[name]/alarms/components/LoadingSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default function LoadingSkeleton() {
return (
<div className="animate-pulse">
<div className="space-y-4">
<div className="flex items-center gap-4">
<div className="w-full h-6 bg-gray-600 rounded-sm"></div>
</div>
<div className="flex items-center gap-4">
<div className="w-full h-6 bg-gray-600 rounded-sm"></div>
</div>
</div>
</div>
)
}
68 changes: 68 additions & 0 deletions src/app/instances/[name]/alarms/components/MemoryAlarmsSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import Dropdown from "./Dropdown"
import Alarm from "../types/alarm";

interface Props {
memoryAlarms: Alarm[];
onDelete: (type: "storage" | "memory", id: string) => void;
onTrigger: (type: "storage" | "memory", alarm: Alarm) => void;
}

export default function MemoryAlarmsSection({
memoryAlarms,
onDelete,
onTrigger,
}: Props) {
return (
<div className="mb-15">
<h2 className="text-md font-heading1 text-headertext1 mb-2">
Memory Alarms
</h2>
<div className="overflow-visible">
<table className="font-heading1 text-sm w-full border-collapse">
<thead>
<tr>
<th className="p-2 text-left border-b">
Reminder Interval
</th>
<th className="p-2 text-left border-b">
Memory Threshold
</th>
<th className="p-2 text-left border-b">
Actions
</th>
</tr>
</thead>
<tbody className="font-text1 text-sm text-pagetext1">
{memoryAlarms.length === 0 ? (
<tr>
<td colSpan={4} className="p-2 text-center text-gray-600">
No memory alarms yet.
</td>
</tr>
) : (
memoryAlarms.map((alarm) => (
<tr key={alarm.id}>
<td className="p-2 border-b">
{alarm.data.reminderInterval}
</td>
<td className="p-2 border-b">
{alarm.data.memoryThreshold}
</td>
<td className="p-2 border-b">
<Dropdown
label="Actions"
options={{
Delete: () => onDelete("memory", alarm.id),
Trigger: () => onTrigger("memory", alarm),
}}
/>
</td>
</tr>
))
)}
</tbody>
</table>
</div>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useInstanceContext } from "../instances/[name]/InstanceContext";
import { useInstanceContext } from "../../InstanceContext";
import { useState } from "react";
import ErrorBanner from "@/app/components/ErrorBanner";
import ErrorBanner from "@/app/instances/components/ErrorBanner";
import axios from "axios";

interface Props {
Expand Down
45 changes: 45 additions & 0 deletions src/app/instances/[name]/alarms/components/SlackEndpointCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
interface Props {
webhookUrl: string;
onClick: () => void;
}

export default function SlackEndpointCard({
webhookUrl,
onClick,
}: Props) {
return (
<div className="max-w-4xl mx-auto p-6 bg-card text-pagetext1 rounded-sm shadow-md mt-8">
<h1 className="font-heading1 text-headertext1 text-2xl mb-10">Slack Endpoint</h1>
{webhookUrl ? (
<table className="text-sm w-full table-auto mb-6">
<colgroup>
<col className="w-1/5" />
<col />
</colgroup>
<tbody className="font-text1">
<tr>
<td className="py-2">Webhook URL:</td>
<td className="py-2">{webhookUrl}</td>
</tr>
</tbody>
</table>
) : (
<p className="font-text1 text-sm mb-6">
You must set up a slack endpoint before creating alarms.
</p>
)}
<div className="font-heading1 text-sm flex justify-end gap-4 mt-6">
<button
className="px-4 py-2 bg-card border-1 border-btn1 text-btn1 rounded-sm text-center hover:shadow-[0_0_8px_#87d9da] transition-all duration-200 hover:bg-card"
onClick={(e) => {
e.preventDefault();
onClick();
}}
>
Setup Slack
</button>
</div>
</div>

)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useInstanceContext } from "../instances/[name]/InstanceContext";
import { useInstanceContext } from "../../InstanceContext";
import { useState } from "react";
import axios from "axios";
import ErrorBanner from "@/app/components/ErrorBanner";
import ErrorBanner from "@/app/instances/components/ErrorBanner";

interface Props {
url: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import Dropdown from "./Dropdown"
import Alarm from "../types/alarm";

interface Props {
storageAlarms: Alarm[];
onDelete: (type: "storage" | "memory", id: string) => void;
onTrigger: (type: "storage" | "memory", alarm: Alarm) => void;
}

export default function StorageAlarmsSection({
storageAlarms,
onDelete,
onTrigger,
}: Props) {
return (
<div className="mb-15">
<h2 className="text-md font-heading1 text-headertext1 mb-2">
Storage Alarms
</h2>
<div className="overflow-visible">
<table className="font-heading1 text-sm w-full border-collapse">
<thead>
<tr>
<th className="p-2 text-left border-b">
Storage Threshold
</th>
<th className="p-2 text-left border-b">
Reminder Interval
</th>
<th className="p-2 text-left border-b">
Actions
</th>
</tr>
</thead>
<tbody className="font-text1 text-sm text-pagetext1">
{storageAlarms.length === 0 ? (
<tr>
<td colSpan={4} className="p-2 text-md text-center text-gray-600">
No storage alarms yet.
</td>
</tr>
) : (
storageAlarms.map((alarm) => (
<tr key={alarm.id}>
<td className="p-2 border-b">
{alarm.data.storageThreshold}
</td>
<td className="p-2 border-b">
{alarm.data.reminderInterval}
</td>
<td className="p-2 border-b">
<Dropdown
label="Actions"
options={{
Delete: () => onDelete("storage", alarm.id),
Trigger: () => onTrigger("storage", alarm),
}}
/>
</td>
</tr>
))
)}
</tbody>
</table>
</div>
</div>
)
}
Loading