Merge pull request 'style-app' (#1) from style-app into master
Reviewed-on: #1
This commit is contained in:
commit
ec145e4531
931
frontend/package-lock.json
generated
931
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -10,6 +10,11 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@emotion/styled": "^11.14.0",
|
||||
"@mui/base": "^5.0.0-beta.70",
|
||||
"@mui/material": "^7.1.1",
|
||||
"@mui/styled-engine": "^7.1.1",
|
||||
"axios": "^1.9.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0"
|
||||
|
||||
@ -1,42 +1,36 @@
|
||||
#root {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
body {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
/* Top-level layout container */
|
||||
.snapix-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center; /* horizontal center */
|
||||
justify-content: center; /* vertical center */
|
||||
min-height: 100vh;
|
||||
color: white;
|
||||
padding: 2rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Title styling */
|
||||
.snapix-title {
|
||||
text-align: center;
|
||||
color: white;
|
||||
margin-bottom: 2rem;
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 6em;
|
||||
padding: 1.5em;
|
||||
will-change: filter;
|
||||
transition: filter 300ms;
|
||||
}
|
||||
.logo:hover {
|
||||
filter: drop-shadow(0 0 2em #646cffaa);
|
||||
}
|
||||
.logo.react:hover {
|
||||
filter: drop-shadow(0 0 2em #61dafbaa);
|
||||
}
|
||||
|
||||
@keyframes logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
a:nth-of-type(2) .logo {
|
||||
animation: logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
.read-the-docs {
|
||||
color: #888;
|
||||
/* Dashboard: backup + restore side by side */
|
||||
.snapix-dashboard {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
gap: 30px;
|
||||
flex-wrap: wrap;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
@ -1,14 +1,17 @@
|
||||
import BackupForm from './components/BackupForm';
|
||||
import RestoreForm from './components/RestoreForm';
|
||||
import './App.css';
|
||||
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div style={{ padding: "2rem" }}>
|
||||
<h1>🚀 Snapix Dashboard</h1>
|
||||
<div className="snapix-container">
|
||||
<h1 className="snapix-title">🚀 Snapix Dashboard</h1>
|
||||
<div className="snapix-dashboard">
|
||||
<BackupForm />
|
||||
<hr />
|
||||
<RestoreForm />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { getNamespaces, getPVCs, createBackup } from '../api/snapix';
|
||||
import { Button, Input } from '@mui/base';
|
||||
|
||||
export default function BackupForm() {
|
||||
const [namespaces, setNamespaces] = useState([]);
|
||||
@ -27,41 +28,57 @@ export default function BackupForm() {
|
||||
pvc_name: selectedPvc,
|
||||
backup_name: backupName,
|
||||
}).then(() => {
|
||||
alert("Backup started!");
|
||||
alert('Backup started!');
|
||||
setBackupName('');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="form-group">
|
||||
<h2>📦 Backup PVC</h2>
|
||||
|
||||
<div className="form-content">
|
||||
<label>Namespace:</label>
|
||||
<select onChange={e => setSelectedNs(e.target.value)} value={selectedNs}>
|
||||
<select value={selectedNs} onChange={(e) => setSelectedNs(e.target.value)}>
|
||||
<option value="">-- Select Namespace --</option>
|
||||
{namespaces.map(ns => <option key={ns}>{ns}</option>)}
|
||||
{namespaces.map(ns => (
|
||||
<option key={ns} value={ns}>
|
||||
{ns}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div className="form-content">
|
||||
<label>PVC:</label>
|
||||
<select
|
||||
onChange={e => setSelectedPvc(e.target.value)}
|
||||
value={selectedPvc}
|
||||
onChange={(e) => setSelectedPvc(e.target.value)}
|
||||
disabled={!selectedNs}
|
||||
>
|
||||
<option value="">-- Select PVC --</option>
|
||||
{pvcs.map(pvc => <option key={pvc}>{pvc}</option>)}
|
||||
{pvcs.map(pvc => (
|
||||
<option key={pvc} value={pvc}>
|
||||
{pvc}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div className="form-content">
|
||||
<label>Backup Name:</label>
|
||||
<input
|
||||
<Input
|
||||
type="text"
|
||||
value={backupName}
|
||||
onChange={e => setBackupName(e.target.value)}
|
||||
onChange={(e) => setBackupName(e.target.value)}
|
||||
placeholder="e.g. git-bkp"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button onClick={handleSubmit}>Create Backup</button>
|
||||
<Button className="btn" onClick={handleSubmit}>
|
||||
Create Backup
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { useState } from 'react';
|
||||
import { restoreBackup } from '../api/snapix';
|
||||
import { Button, Input } from '@mui/base'
|
||||
import '../style/RestoreForm.css'; // Assuming you have some styles for the form
|
||||
|
||||
export default function RestoreForm() {
|
||||
const [backupName, setBackupName] = useState('');
|
||||
@ -19,31 +21,39 @@ export default function RestoreForm() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className='form-group'>
|
||||
<h2>🔁 Restore PVC</h2>
|
||||
|
||||
<div className='form-content'>
|
||||
<label>Backup Name:</label>
|
||||
<input
|
||||
<Input
|
||||
type="text"
|
||||
value={backupName}
|
||||
onChange={e => setBackupName(e.target.value)}
|
||||
className='restore-input'
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className='form-content'>
|
||||
<label>Target Namespace:</label>
|
||||
<input
|
||||
<Input
|
||||
type="text"
|
||||
value={targetNs}
|
||||
onChange={e => setTargetNs(e.target.value)}
|
||||
className='restore-input'
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className='form-content'>
|
||||
<label>Target PVC:</label>
|
||||
<input
|
||||
<Input
|
||||
type="text"
|
||||
value={targetPvc}
|
||||
onChange={e => setTargetPvc(e.target.value)}
|
||||
className='restore-input'
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button onClick={handleRestore}>Restore</button>
|
||||
<Button id='restore-btn' className='btn' onClick={handleRestore}>Restore</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { StrictMode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import './index.css'
|
||||
import './style/global.css'
|
||||
import App from './App.jsx'
|
||||
|
||||
createRoot(document.getElementById('root')).render(
|
||||
|
||||
3
frontend/src/style/RestoreForm.css
Normal file
3
frontend/src/style/RestoreForm.css
Normal file
@ -0,0 +1,3 @@
|
||||
#restore-btn {
|
||||
background-color: dodgerblue;
|
||||
}
|
||||
76
frontend/src/style/global.css
Normal file
76
frontend/src/style/global.css
Normal file
@ -0,0 +1,76 @@
|
||||
h2 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
border: 2px solid #ccc;
|
||||
border-radius: 8px;
|
||||
padding: 13px;
|
||||
margin: 10px;
|
||||
height: auto;
|
||||
width: 500px;
|
||||
flex: 1;
|
||||
max-width: 500px;
|
||||
min-width: 300px;
|
||||
}
|
||||
|
||||
.form-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* Unified input/select styling */
|
||||
input,
|
||||
select {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
background-color: #1a1a1a;
|
||||
border: 1px solid #444;
|
||||
border-radius: 8px;
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
box-sizing: border-box;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
input:hover,
|
||||
select:hover {
|
||||
border-color: #1a73e8;
|
||||
}
|
||||
|
||||
input:disabled,
|
||||
select:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
margin-top: 30px;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
background-color: #45a049;
|
||||
}
|
||||
|
||||
/* Scrollbar inside <select> dropdown (some browsers only) */
|
||||
select {
|
||||
scrollbar-color: #666 #1a1a1a;
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
|
||||
select::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
select::-webkit-scrollbar-thumb {
|
||||
background-color: #666;
|
||||
border-radius: 4px;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user