Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotiKube 1.0.0 Launch #37

Merged
merged 165 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
dfc3b55
fixed: route for login page from home page
apiraam96 Jan 3, 2024
b4337ce
fixed: routing for signup page with nextjs
apiraam96 Jan 4, 2024
3bbd57a
Merge branch 'dev' into NOT22-23/Login-Signup-Page-Typescript-migrati…
apiraam96 Jan 4, 2024
48e4c60
Merge branch 'dev' into NOT-18/Homepage/DC
derekcoughlan Jan 4, 2024
3cd2fca
feature: added error, loading, and other next functionality for the h…
derekcoughlan Jan 6, 2024
b7c21ff
Merge branch 'dev' into NOT-18/Homepage/DC
derekcoughlan Jan 6, 2024
7674b36
added working data table - no CRUD functionality - table and incident…
danealexandersmith Jan 6, 2024
8546654
Started initial server routes for register page
apiraam96 Jan 6, 2024
92a1e0b
Merge branch 'dev' into NOT22-23/Login-Signup-Page-Typescript-migrati…
apiraam96 Jan 6, 2024
02ee606
added routing files - api folder and subfolders with route.ts files
danealexandersmith Jan 6, 2024
7a8a19b
fixed: SignUp page fully functional
apiraam96 Jan 6, 2024
ef4a634
connected server router to database and loaded response into MUI table
danealexandersmith Jan 6, 2024
2ae1f7a
feature: added react context, global error file, and refactored dashb…
derekcoughlan Jan 7, 2024
8d21924
Local auth successfully works
apiraam96 Jan 7, 2024
3085aaa
attempted to fix hook error by removing context and error files. adde…
derekcoughlan Jan 8, 2024
b29b83a
Merge branch 'dev' into NOT-18/Homepage/DC
derekcoughlan Jan 8, 2024
351ad24
refactor: made adjustments to library functions, homepage dashboard f…
derekcoughlan Jan 8, 2024
b2f2b9b
refactor: added clusterhealth components and refactored homepage with…
derekcoughlan Jan 10, 2024
b3c6d76
client side can retrieve userid, and users cannot go to login/signup …
apiraam96 Jan 11, 2024
e289c2d
Merge pull request #18 from oslabs-beta/DS/NOT-19/incidents
apiraam96 Jan 16, 2024
595626e
Merge branch 'dev' into NOT22-23/Login-Signup-Page-Typescript-migrati…
apiraam96 Jan 16, 2024
c46b670
Fixed up merge conflicts with incident page
apiraam96 Jan 16, 2024
7f9cea3
refactor: added loading spinners and refactored dashboard components
derekcoughlan Jan 16, 2024
4377647
Merge branch 'dev' into NOT-18/Homepage/DC
derekcoughlan Jan 16, 2024
fb6cc9c
Fix: images render on page with <Image /> component
apiraam96 Jan 16, 2024
ccc86da
Merge pull request #20 from oslabs-beta/NOT22-23/Login-Signup-Page-Ty…
derekcoughlan Jan 17, 2024
df32a98
no major changes were made
derekcoughlan Jan 17, 2024
e19fea3
Merge branch 'dev' into NOT-18/Homepage/DC
derekcoughlan Jan 17, 2024
40d90c9
EI-PAGES
DeveloperIkhalea Jan 18, 2024
602d244
checkout to pull recent mergers from Dev
danealexandersmith Jan 18, 2024
fdd3035
Merge branch 'dev' into EI-NextjsPages
DeveloperIkhalea Jan 18, 2024
1263da6
Merge branch 'dev' into DS/NOT-19/incidents
danealexandersmith Jan 18, 2024
b1207bd
table working with basic CRUD funcitonality and no errors
danealexandersmith Jan 18, 2024
f8cf5b6
EI-PAGES
DeveloperIkhalea Jan 18, 2024
112e669
added notes
danealexandersmith Jan 18, 2024
17a7e30
refactor: added promql query folder with first function inside. Also,…
derekcoughlan Jan 18, 2024
f3b38d2
set up Nodemailer to send email's - currently hard coded from button …
danealexandersmith Jan 19, 2024
649545a
feature: added promql queries, refactored dashboard visualization wit…
derekcoughlan Jan 20, 2024
6d99d93
EI-Nextjs-pages
DeveloperIkhalea Jan 20, 2024
1aebab3
Delete app/dashboard/page.tsx
jesse-chou Jan 20, 2024
1aee99a
Merge pull request #21 from oslabs-beta/EI-NextjsPages
jesse-chou Jan 20, 2024
706a208
started connect-cluster page functionality
jesse-chou Jan 20, 2024
ab9a939
Merge branch 'dev' into NOT-24/connect-cluster-migration/JC
jesse-chou Jan 21, 2024
83e9cc0
refactor: formatted components and sidebar
jesse-chou Jan 21, 2024
5b28b66
Delete app/dashboard/page.tsx
jesse-chou Jan 21, 2024
a2f2b34
Merge pull request #22 from oslabs-beta/NOT-24/connect-cluster-migrat…
jesse-chou Jan 21, 2024
ec45fc3
refactor: resdesigned dashboard and relevant functionality
derekcoughlan Jan 21, 2024
3dd48c2
Merge branch 'dev' into NOT-18/Homepage/DC
derekcoughlan Jan 21, 2024
70c2744
refactor: changed all component drilling so that the queries could gr…
derekcoughlan Jan 21, 2024
91ac6d1
updated: reformated files and adjusted some CSS
derekcoughlan Jan 21, 2024
5395d2b
fix: changed sql queries to accommadate db change
apiraam96 Jan 23, 2024
48e8e9e
fix: added maxAge to auth session
apiraam96 Jan 23, 2024
58d304c
Merge branch 'dev' into NOT22-23/Login-Signup-Page-Typescript-migrati…
apiraam96 Jan 23, 2024
4d09d82
Merge pull request #23 from oslabs-beta/NOT22-23/Login-Signup-Page-Ty…
apiraam96 Jan 23, 2024
f3abd30
refactor: added functionality to grab userid
derekcoughlan Jan 23, 2024
b5eb175
Merge branch 'dev' into NOT-18/Homepage/DC
derekcoughlan Jan 23, 2024
780a292
refactor: added metric visual error capabilities
derekcoughlan Jan 23, 2024
1cb594e
Delete .env
derekcoughlan Jan 23, 2024
74114bf
Delete app/__tests__/Dashboard.test.tsx
derekcoughlan Jan 23, 2024
0550c5e
refactor: made slight css changes to metric error handler
derekcoughlan Jan 23, 2024
4138e74
fully functional incidents table with CRUD functionality -- additiona…
danealexandersmith Jan 23, 2024
f112f59
fixed minor bug after pulling latest changes -- filepath for images d…
danealexandersmith Jan 23, 2024
442047e
working through new bugs -- getting new 'React' refers to a UMD globa…
danealexandersmith Jan 23, 2024
e7139f6
added color coded rows based on priority classes
danealexandersmith Jan 23, 2024
0529342
removed console logs and updated Assigned To column to display name r…
danealexandersmith Jan 23, 2024
9e673d6
Merge pull request #24 from oslabs-beta/NOT-18/Homepage/DC
jesse-chou Jan 24, 2024
ff0de2a
Merge branch 'dev' into NOT-18/Homepage/DC
derekcoughlan Jan 24, 2024
ebf3f0f
feature: added activeCluster query
derekcoughlan Jan 24, 2024
8b594de
style: added new Sidebar page and refactored icons
jesse-chou Jan 24, 2024
9c9d351
data table complete -- connected rows to incident details page and ad…
danealexandersmith Jan 24, 2024
47e2d97
"committing dev to pull new changes from shared repo"Merge branch 'de…
danealexandersmith Jan 24, 2024
80b09f1
updated with data fetching for incident details page
danealexandersmith Jan 24, 2024
24ae491
feature: added simple backend functionality for alertmanager webhook
apiraam96 Jan 24, 2024
8b7ce51
Merge pull request #25 from oslabs-beta/DS/NOT-19/incidents
derekcoughlan Jan 24, 2024
d4fb8b6
Merge branch 'dev' into NOT22-23/Login-Signup-Page-Typescript-migrati…
apiraam96 Jan 25, 2024
52b4d29
other: wip to pull latest code from dev branch
jesse-chou Jan 25, 2024
043ee4e
Merge branch 'dev' into NOT-35/connect-cluster-cleanup/JC
jesse-chou Jan 25, 2024
0a71995
added incident details page with full CRUD functionality
danealexandersmith Jan 25, 2024
b95c299
committing changes to merge new devMerge branch 'dev' into DS/NOT-19/…
danealexandersmith Jan 25, 2024
64744fb
added bold font to incident details page
danealexandersmith Jan 25, 2024
3873340
added cancel button to incident details edit component
danealexandersmith Jan 25, 2024
3ef2b4b
increased shadow on incident details text display
danealexandersmith Jan 25, 2024
94812db
Merge pull request #26 from oslabs-beta/DS/NOT-19/incidents
jesse-chou Jan 25, 2024
7af684d
feature: completed connect-cluster-page without edit functionality
jesse-chou Jan 25, 2024
98e4195
wip: alert from prometheus alertmanager successfully gets stored in db
apiraam96 Jan 26, 2024
0e40e7a
changed styling to table and incident details
danealexandersmith Jan 26, 2024
f2973d2
Merge pull request #27 from oslabs-beta/NOT-35/connect-cluster-cleanu…
danealexandersmith Jan 26, 2024
ee05caa
Merge branch 'dev' into DS/NOT-19/incidents
danealexandersmith Jan 26, 2024
6d3b145
wip: Metric snapshot successfully retrieved and added to db
apiraam96 Jan 26, 2024
6dec8cb
chore: added relevant comments to queries
apiraam96 Jan 26, 2024
6586a04
Merge branch 'dev' into NOT22-23/Login-Signup-Page-Typescript-migrati…
apiraam96 Jan 26, 2024
6734b3d
Merge branch 'dev' into NOT-18/Homepage/DC
derekcoughlan Jan 27, 2024
b7d050a
feat: snapshot data added to incident details
apiraam96 Jan 27, 2024
107ecb8
style: fixed positioning of snapshot
apiraam96 Jan 27, 2024
d5aa2d7
Merge pull request #28 from oslabs-beta/DS/NOT-19/incidents
apiraam96 Jan 27, 2024
05842bc
feat: making sure dummy data without metrics can still load
apiraam96 Jan 27, 2024
6d82fcc
Merge branch 'dev' into NOT22-23/Login-Signup-Page-Typescript-migrati…
apiraam96 Jan 27, 2024
f659e74
style: added github logo, stylized submit buttons
apiraam96 Jan 27, 2024
de32ff4
added cypress testing and made minor component tweaks in login and da…
derekcoughlan Jan 27, 2024
c873f9a
style: sidebar icon fix
jesse-chou Jan 27, 2024
5394856
Merge branch 'dev' into NOT-18/Homepage/DC
derekcoughlan Jan 27, 2024
76fd6c9
Merge branch 'dev' into NOT-36/UI-Fix/JC
jesse-chou Jan 27, 2024
3db98ae
Merge branch 'dev' into NOT-36/UI-Fix/JC
jesse-chou Jan 27, 2024
2baf3cb
Merge pull request #29 from oslabs-beta/NOT22-23/Login-Signup-Page-Ty…
derekcoughlan Jan 27, 2024
5db8813
Merge branch 'dev' into NOT-18/Homepage/DC
derekcoughlan Jan 27, 2024
c0269f3
added new tremor visuals to dashboard and tweaked dashboard cypress test
derekcoughlan Jan 28, 2024
f14d4e9
style: finished sidebar revision without profile pic conditional rend…
jesse-chou Jan 28, 2024
9172749
refactored some code in the incident table and incident details pages…
danealexandersmith Jan 28, 2024
9ace58b
added default sorting by Timestamp column to incident table
danealexandersmith Jan 28, 2024
7645ffa
customized page size and options
danealexandersmith Jan 28, 2024
8588c20
final style changes 01/27/2024
danealexandersmith Jan 28, 2024
c92251b
Merge pull request #30 from oslabs-beta/NOT-18/Homepage/DC
danealexandersmith Jan 28, 2024
0832dc3
merging with dev
danealexandersmith Jan 28, 2024
b08375f
style: changed dashboard pic on landing page
jesse-chou Jan 28, 2024
fcf6757
Merge branch 'dev' into NOT-36/UI-Fix/JC
jesse-chou Jan 28, 2024
63d81b6
added link and route for non-owner members to remove themselves from …
danealexandersmith Jan 29, 2024
7b4c677
added types to snapshot data and snapshot visualization components pr…
danealexandersmith Jan 29, 2024
5d4b33a
cleaned up indents on some pages
danealexandersmith Jan 29, 2024
53707fb
cleaned up some type errors from new snapshot details components
danealexandersmith Jan 29, 2024
d8c2cb7
added db query in remove cluster route to remove user from assigned_t…
danealexandersmith Jan 30, 2024
9c2163f
minor change to warning that appears when user clicks delete cluster …
danealexandersmith Jan 30, 2024
d75126c
fixed problem with width of the incident details page to make text co…
danealexandersmith Jan 30, 2024
ee8d8ea
removed cluster name from incident details - it is already displayed …
danealexandersmith Jan 30, 2024
3f64ee3
email notification toggle switch and delete account button added as n…
danealexandersmith Jan 30, 2024
87a9dee
moved data fetching to top level of profile page --- added loading sp…
danealexandersmith Jan 31, 2024
f611c08
added loading spinner to connect cluster page
danealexandersmith Jan 31, 2024
0d8524c
refactored addMember component to be client side, moved it to the con…
danealexandersmith Jan 31, 2024
222af63
minor bug fixes, style changes
danealexandersmith Jan 31, 2024
0a53905
committing changes before refactoring Incident type definition to cor…
danealexandersmith Jan 31, 2024
c1ac92d
updated types to correct type error when iterating through state obje…
danealexandersmith Jan 31, 2024
e8a162a
added checkbox to toggle row colors on and off in incidents table
danealexandersmith Feb 1, 2024
c49941a
minor bug fixes -- added instructions for editing table and moved che…
danealexandersmith Feb 1, 2024
dcbe431
Merge pull request #31 from oslabs-beta/DS/NOT-19/incidents
derekcoughlan Feb 10, 2024
e07e8a5
final commit before PR
danealexandersmith Feb 10, 2024
520a586
"merging with dev"Merge branch 'dev' into DS/NOT-55/user_preferences
danealexandersmith Feb 10, 2024
07eadb5
added a test additional tests
derekcoughlan Feb 10, 2024
c475d9e
Merge branch 'dev' into NOT-18/Homepage/DC
derekcoughlan Feb 10, 2024
d8cf847
merged with latest dev - changed incident details page borders to black
danealexandersmith Feb 10, 2024
e84d877
testing: added new tests for dashboard layout
derekcoughlan Feb 11, 2024
4b264a8
Merge branch 'dev' into NOT-36/UI-Fix/JC
jesse-chou Feb 13, 2024
e455d18
feat: Added Github OAuth functionality
apiraam96 Feb 13, 2024
38f9447
added error handling to api routes, cleaned up profile page and added…
danealexandersmith Feb 13, 2024
5b1fadc
Merge pull request #32 from oslabs-beta/DS/NOT-55/user_preferences
danealexandersmith Feb 14, 2024
1bff7da
style: toast notifications added to signup page
apiraam96 Feb 14, 2024
569ba77
style: toast notifications added to login page
apiraam96 Feb 14, 2024
d94b571
fix: fixed typescript error in signup page
apiraam96 Feb 14, 2024
30e09df
Merge branch 'dev' into NOT34/GitHubOAuth/AS
apiraam96 Feb 14, 2024
cb08cea
Merge branch 'dev' into NOT-36/UI-Fix/JC
jesse-chou Feb 14, 2024
e71c018
feature: completed landing page refresh + code cleanup
jesse-chou Feb 14, 2024
eb7debb
refactor: added notes, removed console logs, and reformated documents
derekcoughlan Feb 14, 2024
4b5d24c
Merge branch 'dev' into NOT-18/Homepage/DC
derekcoughlan Feb 14, 2024
b8f47e6
added onclick function to profile pic and logic to load photo from DB
danealexandersmith Feb 15, 2024
2bdb9eb
Merge pull request #33 from oslabs-beta/NOT-36/UI-Fix/JC
apiraam96 Feb 15, 2024
3d20985
Merge branch 'dev' into NOT-18/Homepage/DC
derekcoughlan Feb 15, 2024
ebe0c16
minor change to event handler function
danealexandersmith Feb 15, 2024
cc41f75
minor change to photo style
danealexandersmith Feb 15, 2024
9302ce5
Merge pull request #34 from oslabs-beta/NOT-18/Homepage/DC
danealexandersmith Feb 15, 2024
df7f7bd
final commit before checkout
danealexandersmith Feb 15, 2024
376f35a
"merging dev before making pull request" Merge branch 'dev' into DS/N…
danealexandersmith Feb 15, 2024
49b770c
Merge pull request #35 from oslabs-beta/DS/NOT-55/user_preferences
jesse-chou Feb 15, 2024
07af091
fix: Fixed typescript errors in nextauth route
apiraam96 Feb 15, 2024
70f9bfe
Merge branch 'dev' into NOT34/GitHubOAuth/AS
apiraam96 Feb 15, 2024
088f90e
fix: commented out line 25 in profile/page.tsx to prevent re-renders,…
apiraam96 Feb 15, 2024
c44add7
Merge pull request #36 from oslabs-beta/NOT34/GitHubOAuth/AS
jesse-chou Feb 15, 2024
34115c8
refactor: fixed auth + commented out code
jesse-chou Feb 15, 2024
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

# testing
/coverage
cypress.env.json

# next.js
/.next/
Expand Down Expand Up @@ -39,4 +40,5 @@ next-env.d.ts
package-lock.json

#
.env
.env.local
.env
8 changes: 8 additions & 0 deletions app/Providers.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"use client"

import React from 'react'
import { SessionProvider } from "next-auth/react"

export function AuthProvider({children}: {children: React.ReactNode}) {
return <SessionProvider>{children}</SessionProvider>
}
39 changes: 39 additions & 0 deletions app/_components/AddMemberClient.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"use client"
import { FormEvent } from 'react';
import { useRouter } from 'next/navigation';
import React from 'react';



export default function AddMemberClient() {

const router = useRouter();

async function addMember(event: FormEvent<HTMLFormElement>) {
event?.preventDefault();
const formData = new FormData(event.currentTarget);
let body:{email?: string} = {}

body.email = formData.get('email')?.toString();

const response = await fetch('/api/addMember/send-invite', {
method: 'POST',
body: JSON.stringify(body),
})
const res = await response.json();
console.log(res);
alert(`Invitation sent to ${body.email}`);
window.location.reload();
}


return (
<div className='AddMember'>
<h3 className='font-semibold text-sm'>Invite other users to join this cluster:</h3>
<form className="space-x-1" onSubmit={addMember}>
<input className="h-10 shadow-sm max-w-64 align-middle inline-flex items-center" name='email' type='email' required placeholder='[email protected]' style={{width: 350}} ></input>
<button className="text-black bg-slate-200 border-black hover:border-black hover:bg-slate-500 hover:text-white focus:ring-white focus:outline-none font-medium rounded-md text-sm px-5 text-center dark:bg-slate-600 dark:hover:bg-slate-700 dark:focus:ring-slate-800 shadow-lg max-w-18 h-10 align-middle inline-flex items-center" type="submit">Submit</button>
</form>
</div>
)
}
156 changes: 156 additions & 0 deletions app/_components/ConnectClusterPage/ConnectClusterModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
import { useRouter } from "next/navigation";
import { useState } from "react";
import React from 'react';

export default function ConnectClusterModal({
isModalVisible,
toggleModal,
}: any) {
const router = useRouter();
const [clusterName, setClusterName] = useState("");
const [clusterIp, setClusterIp] = useState("");
const [error, setError] = useState("");

const resetFields = () => {
setClusterName("");
setClusterIp("");
setError("");
};

// This function takes the passed in form data and sends it to the server
async function newCluster(e: React.FormEvent) {
e.preventDefault();

// Prepare the data to be sent
const clusterData = {
clusterName,
clusterIp,
};

// POST REQUEST TO ADD CLUSTER NAME AND CLUSTER IP TO DATABASE
try {
let res = await fetch("/api/connect-cluster", {
method: "POST",
body: JSON.stringify(clusterData),
headers: { "Content-Type": "application/json" },
});
const data = await res.json();
if (!data.newCluster) {
setError(data.error);
} else {
router.push("/dashboard");
toggleModal();
resetFields();
}
} catch (error) {
setError("An error occurred while adding your cluster. Please try again");
console.error("Error sending data:", error);
}
}

const handleClose = () => {
toggleModal();
resetFields();
};

return (
<div className={`modal ${isModalVisible ? "is-active" : ""}`}>
<div className="modal-background" onClick={toggleModal}></div>
{/* Modal content here */}
<div
id="defaultModal"
tabIndex={-1}
aria-hidden="true"
className={`${
isModalVisible
? "fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"
: "hidden"
} overflow-y-auto overflow-x-hidden z-50 w-full max-w-2xl`}
>
<div className="relative p-4 w-full max-w-2xl h-full md:h-auto">
{/* Modal content */}
<div className="relative p-4 bg-white rounded-lg shadow dark:bg-gray-800 sm:p-5">
{/* Modal header */}
<div className="flex justify-between items-center pb-4 mb-4 rounded-t border-b sm:mb-5 dark:border-gray-600">
<h3 className="text-lg font-semibold text-gray-900 dark:text-white">
Connect a Cluster
</h3>
<button
type="button"
className="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"
onClick={handleClose}
>
<svg
aria-hidden="true"
className="w-5 h-5"
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clipRule="evenodd"
></path>
</svg>
<span className="sr-only">Close modal</span>
</button>
</div>
{/* <!-- Modal body --> */}
<form onSubmit={newCluster}>
<div className="grid gap-4 mb-4 sm:grid-cols-2">
{/* Cluster Name Input Field */}
<div className="sm:col-span-2">
<label
htmlFor="clusterName"
className="block mb-2 text-sm text-left font-medium text-gray-900 dark:text-white"
>
Cluster Name
</label>
<input
type="text"
id="clusterName"
value={clusterName}
onChange={(e) => setClusterName(e.target.value)}
className="block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500"
placeholder="required"
/>
</div>
{/* IP Address Input Field */}
<div className="sm:col-span-2">
<label
htmlFor="clusterIp"
className="block mb-2 text-sm text-left font-medium text-gray-900 dark:text-white"
>
IP Address
</label>
<input
type="text"
id="clusterIp"
value={clusterIp}
onChange={(e) => setClusterIp(e.target.value)}
className="block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500"
placeholder="required"
/>
</div>
</div>

{/* This error populates when the fetch request sends back an error */}
{error && (
<p className="text-NotikubeRed text-xs pb-4">{error}</p>
)}

{/* Save Button */}
<button
type="submit"
className="text-white inline-flex items-center bg-primary-500 hover:bg-primary-800 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-500 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
>
Save
</button>
</form>
</div>
</div>
</div>
</div>
);
}
57 changes: 57 additions & 0 deletions app/_components/ConnectClusterPage/EditCluster.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
"use client"

import { FormEvent } from 'react';
import React from 'react';

export default function EditCluster (props: {clusterName:string, clusterIp:string, cluster_id?:string, change_cluster: Function, change_edit: Function}) {


async function editCluster(event: FormEvent<HTMLFormElement>) {
event?.preventDefault();
const formData = new FormData(event.currentTarget);
let body:{cluster_name?: string, cluster_ip?: string, cluster_id?:string} = {}

body.cluster_name = formData.get('cluster_name')?.toString();
body.cluster_ip = formData.get('cluster_ip')?.toString();
body.cluster_id = props.cluster_id

if (body !== undefined) {
const response = await fetch('/api/updateCluster/edit', {
method: 'POST',
body: JSON.stringify(body),
})
let res = await response.json()
console.log(res)
}


props.change_cluster(body.cluster_name, body.cluster_ip);

alert('Changes saved')

props.change_edit();

}

return (

<div className="w-screen" >
<form onSubmit={editCluster}>
<div className="grid grid-cols-2 gap-8 w-4/5 resize">
<div className="w-screen">
<p className="font-bold pb-2 text-xl mt-5">Cluster Name:</p>
<input name="cluster_name" className="border-2 border-red-800 p-2 pl-4 rounded-md w-1/3" defaultValue={props.clusterName} />
<br></br>
<br></br>
<p className="font-bold pb-2 text-xl">Cluster IP:</p>
<input name="cluster_ip" className="border-2 border-red-800 p-2 pl-4 rounded-md w-1/3" defaultValue={props.clusterIp} />
<br></br>
<button className="text-white bg-primary-500 hover:bg-primary-600 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-3 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800 w-36 mt-8 shadow-lg" type="submit">Save</button>
</div>
</div>
</form>
</div>

)

}
40 changes: 40 additions & 0 deletions app/_components/ConnectClusterPage/UserClusters.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"use client"
import React from 'react';

export default function UserClusters(props: { owner?: string; clusterName: string; clusterIp: string; edit: string }) {

return (
<div className="w-full overflow-x-auto shadow-lg sm:rounded-lg">
<table className="w-full text-md text-left rtl:text-right text-gray-500 dark:text-gray-400">
<thead className="text-md text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
<tr>
<th scope="col" className="px-10 py-3">
Cluster Name
</th>
<th scope="col" className="px-5 py-3">
Cluster IP
</th>
<th scope="col" className="px-10 py-3 text-right">
User Permissions
</th>
</tr>
</thead>

{/* Table Body Rendered with Users Corresponding Clusters */}
<tbody>
<tr className="text-mdodd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800 border-b dark:border-gray-700">
<th
scope="row"
className="px-10 py-8 font-medium text-gray-900 whitespace-nowrap dark:text-white"
>
{props.clusterName}
</th>
<td className="px-5 py-8">{props.clusterIp}</td>
<td className="px-10 py-5 text-right font-semibold text-gray-900">{props.owner}
</td>
</tr>
</tbody>
</table>
</div>
);
}
Loading
Loading