Rewrite from Go + vanilla JS to Python (FastAPI) + React (TypeScript)
- Backend: Python 3.12 with FastAPI, SQLAlchemy, boto3 - Frontend: React 18 with TypeScript, Vite build tooling - Updated Dockerfile for multi-stage Node + Python build - Updated CI pipeline for Python backend - Removed old Go code (cmd/, internal/, go.mod, go.sum) - Updated README with new tech stack documentation
This commit is contained in:
134
frontend/src/pages/GrovePage.tsx
Normal file
134
frontend/src/pages/GrovePage.tsx
Normal file
@@ -0,0 +1,134 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useParams, Link } from 'react-router-dom';
|
||||
import { Grove, Tree } from '../types';
|
||||
import { getGrove, listTrees, createTree } from '../api';
|
||||
import './Home.css';
|
||||
|
||||
function GrovePage() {
|
||||
const { groveName } = useParams<{ groveName: string }>();
|
||||
const [grove, setGrove] = useState<Grove | null>(null);
|
||||
const [trees, setTrees] = useState<Tree[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [showForm, setShowForm] = useState(false);
|
||||
const [newTree, setNewTree] = useState({ name: '', description: '' });
|
||||
const [creating, setCreating] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (groveName) {
|
||||
loadData();
|
||||
}
|
||||
}, [groveName]);
|
||||
|
||||
async function loadData() {
|
||||
try {
|
||||
setLoading(true);
|
||||
const [groveData, treesData] = await Promise.all([
|
||||
getGrove(groveName!),
|
||||
listTrees(groveName!),
|
||||
]);
|
||||
setGrove(groveData);
|
||||
setTrees(treesData);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to load data');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateTree(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
try {
|
||||
setCreating(true);
|
||||
await createTree(groveName!, newTree);
|
||||
setNewTree({ name: '', description: '' });
|
||||
setShowForm(false);
|
||||
loadData();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to create tree');
|
||||
} finally {
|
||||
setCreating(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <div className="loading">Loading...</div>;
|
||||
}
|
||||
|
||||
if (!grove) {
|
||||
return <div className="error-message">Grove not found</div>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="home">
|
||||
<nav className="breadcrumb">
|
||||
<Link to="/">Groves</Link> / <span>{grove.name}</span>
|
||||
</nav>
|
||||
|
||||
<div className="page-header">
|
||||
<div>
|
||||
<h1>{grove.name}</h1>
|
||||
{grove.description && <p className="description">{grove.description}</p>}
|
||||
</div>
|
||||
<button className="btn btn-primary" onClick={() => setShowForm(!showForm)}>
|
||||
{showForm ? 'Cancel' : '+ New Tree'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{error && <div className="error-message">{error}</div>}
|
||||
|
||||
{showForm && (
|
||||
<form className="form card" onSubmit={handleCreateTree}>
|
||||
<h3>Create New Tree</h3>
|
||||
<div className="form-group">
|
||||
<label htmlFor="name">Name</label>
|
||||
<input
|
||||
id="name"
|
||||
type="text"
|
||||
value={newTree.name}
|
||||
onChange={(e) => setNewTree({ ...newTree, name: e.target.value })}
|
||||
placeholder="releases"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label htmlFor="description">Description</label>
|
||||
<input
|
||||
id="description"
|
||||
type="text"
|
||||
value={newTree.description}
|
||||
onChange={(e) => setNewTree({ ...newTree, description: e.target.value })}
|
||||
placeholder="Optional description"
|
||||
/>
|
||||
</div>
|
||||
<button type="submit" className="btn btn-primary" disabled={creating}>
|
||||
{creating ? 'Creating...' : 'Create Tree'}
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
|
||||
{trees.length === 0 ? (
|
||||
<div className="empty-state">
|
||||
<p>No trees yet. Create your first tree to start uploading artifacts!</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="grove-grid">
|
||||
{trees.map((tree) => (
|
||||
<Link to={`/grove/${groveName}/${tree.name}`} key={tree.id} className="grove-card card">
|
||||
<h3>📦 {tree.name}</h3>
|
||||
{tree.description && <p>{tree.description}</p>}
|
||||
<div className="grove-meta">
|
||||
<span className="date">
|
||||
Created {new Date(tree.created_at).toLocaleDateString()}
|
||||
</span>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default GrovePage;
|
||||
186
frontend/src/pages/Home.css
Normal file
186
frontend/src/pages/Home.css
Normal file
@@ -0,0 +1,186 @@
|
||||
.home {
|
||||
max-width: 1000px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.page-header h1 {
|
||||
font-size: 2rem;
|
||||
color: var(--primary-dark);
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 0.625rem 1.25rem;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: var(--primary);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background-color: var(--primary-dark);
|
||||
}
|
||||
|
||||
.btn-primary:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background-color: var(--border);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background-color: #d0d0d0;
|
||||
}
|
||||
|
||||
.card {
|
||||
background-color: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.form {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.form h3 {
|
||||
margin-bottom: 1rem;
|
||||
color: var(--primary-dark);
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 0.375rem;
|
||||
font-weight: 500;
|
||||
color: var(--text-light);
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.form-group input[type="text"],
|
||||
.form-group input[type="file"],
|
||||
.form-group select,
|
||||
.form-group textarea {
|
||||
width: 100%;
|
||||
padding: 0.625rem;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.form-group input:focus,
|
||||
.form-group select:focus,
|
||||
.form-group textarea:focus {
|
||||
outline: none;
|
||||
border-color: var(--primary);
|
||||
box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.1);
|
||||
}
|
||||
|
||||
.form-group.checkbox label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.form-group.checkbox input {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.error-message {
|
||||
background-color: #fef2f2;
|
||||
border: 1px solid #fecaca;
|
||||
color: var(--error);
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.loading {
|
||||
text-align: center;
|
||||
padding: 3rem;
|
||||
color: var(--text-light);
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
padding: 3rem;
|
||||
color: var(--text-light);
|
||||
background-color: var(--surface);
|
||||
border: 1px dashed var(--border);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.grove-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.grove-card {
|
||||
display: block;
|
||||
color: inherit;
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.grove-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.grove-card h3 {
|
||||
color: var(--primary);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.grove-card p {
|
||||
color: var(--text-light);
|
||||
font-size: 0.875rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.grove-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.badge {
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 4px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.badge-public {
|
||||
background-color: #dcfce7;
|
||||
color: #166534;
|
||||
}
|
||||
|
||||
.badge-private {
|
||||
background-color: #fef3c7;
|
||||
color: #92400e;
|
||||
}
|
||||
|
||||
.date {
|
||||
color: var(--text-light);
|
||||
}
|
||||
128
frontend/src/pages/Home.tsx
Normal file
128
frontend/src/pages/Home.tsx
Normal file
@@ -0,0 +1,128 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Grove } from '../types';
|
||||
import { listGroves, createGrove } from '../api';
|
||||
import './Home.css';
|
||||
|
||||
function Home() {
|
||||
const [groves, setGroves] = useState<Grove[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [showForm, setShowForm] = useState(false);
|
||||
const [newGrove, setNewGrove] = useState({ name: '', description: '', is_public: true });
|
||||
const [creating, setCreating] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
loadGroves();
|
||||
}, []);
|
||||
|
||||
async function loadGroves() {
|
||||
try {
|
||||
setLoading(true);
|
||||
const data = await listGroves();
|
||||
setGroves(data);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to load groves');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateGrove(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
try {
|
||||
setCreating(true);
|
||||
await createGrove(newGrove);
|
||||
setNewGrove({ name: '', description: '', is_public: true });
|
||||
setShowForm(false);
|
||||
loadGroves();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to create grove');
|
||||
} finally {
|
||||
setCreating(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <div className="loading">Loading groves...</div>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="home">
|
||||
<div className="page-header">
|
||||
<h1>Groves</h1>
|
||||
<button className="btn btn-primary" onClick={() => setShowForm(!showForm)}>
|
||||
{showForm ? 'Cancel' : '+ New Grove'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{error && <div className="error-message">{error}</div>}
|
||||
|
||||
{showForm && (
|
||||
<form className="form card" onSubmit={handleCreateGrove}>
|
||||
<h3>Create New Grove</h3>
|
||||
<div className="form-group">
|
||||
<label htmlFor="name">Name</label>
|
||||
<input
|
||||
id="name"
|
||||
type="text"
|
||||
value={newGrove.name}
|
||||
onChange={(e) => setNewGrove({ ...newGrove, name: e.target.value })}
|
||||
placeholder="my-project"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label htmlFor="description">Description</label>
|
||||
<input
|
||||
id="description"
|
||||
type="text"
|
||||
value={newGrove.description}
|
||||
onChange={(e) => setNewGrove({ ...newGrove, description: e.target.value })}
|
||||
placeholder="Optional description"
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group checkbox">
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={newGrove.is_public}
|
||||
onChange={(e) => setNewGrove({ ...newGrove, is_public: e.target.checked })}
|
||||
/>
|
||||
Public
|
||||
</label>
|
||||
</div>
|
||||
<button type="submit" className="btn btn-primary" disabled={creating}>
|
||||
{creating ? 'Creating...' : 'Create Grove'}
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
|
||||
{groves.length === 0 ? (
|
||||
<div className="empty-state">
|
||||
<p>No groves yet. Create your first grove to get started!</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="grove-grid">
|
||||
{groves.map((grove) => (
|
||||
<Link to={`/grove/${grove.name}`} key={grove.id} className="grove-card card">
|
||||
<h3>{grove.name}</h3>
|
||||
{grove.description && <p>{grove.description}</p>}
|
||||
<div className="grove-meta">
|
||||
<span className={`badge ${grove.is_public ? 'badge-public' : 'badge-private'}`}>
|
||||
{grove.is_public ? 'Public' : 'Private'}
|
||||
</span>
|
||||
<span className="date">
|
||||
Created {new Date(grove.created_at).toLocaleDateString()}
|
||||
</span>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Home;
|
||||
131
frontend/src/pages/TreePage.css
Normal file
131
frontend/src/pages/TreePage.css
Normal file
@@ -0,0 +1,131 @@
|
||||
.breadcrumb {
|
||||
margin-bottom: 1rem;
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-light);
|
||||
}
|
||||
|
||||
.breadcrumb a {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.breadcrumb span {
|
||||
color: var(--text);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.description {
|
||||
color: var(--text-light);
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
|
||||
.success-message {
|
||||
background-color: #f0fdf4;
|
||||
border: 1px solid #bbf7d0;
|
||||
color: var(--success);
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.upload-section {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.upload-section h3 {
|
||||
margin-bottom: 1rem;
|
||||
color: var(--primary-dark);
|
||||
}
|
||||
|
||||
.upload-form {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
align-items: flex-end;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.upload-form .form-group {
|
||||
margin-bottom: 0;
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-bottom: 1rem;
|
||||
color: var(--primary-dark);
|
||||
}
|
||||
|
||||
.grafts-table {
|
||||
background-color: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.grafts-table table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.grafts-table th,
|
||||
.grafts-table td {
|
||||
padding: 0.875rem 1rem;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.grafts-table th {
|
||||
background-color: #f9f9f9;
|
||||
font-weight: 600;
|
||||
font-size: 0.75rem;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-light);
|
||||
}
|
||||
|
||||
.grafts-table tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.grafts-table tr:hover {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
.fruit-id {
|
||||
font-family: monospace;
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-light);
|
||||
}
|
||||
|
||||
.btn-small {
|
||||
padding: 0.375rem 0.75rem;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.usage-section {
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.usage-section h3 {
|
||||
margin-bottom: 0.5rem;
|
||||
color: var(--primary-dark);
|
||||
}
|
||||
|
||||
.usage-section p {
|
||||
color: var(--text-light);
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.usage-section pre {
|
||||
background-color: #1e1e1e;
|
||||
color: #d4d4d4;
|
||||
padding: 1rem;
|
||||
border-radius: 6px;
|
||||
overflow-x: auto;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.usage-section code {
|
||||
font-family: 'Fira Code', 'Consolas', monospace;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
160
frontend/src/pages/TreePage.tsx
Normal file
160
frontend/src/pages/TreePage.tsx
Normal file
@@ -0,0 +1,160 @@
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import { useParams, Link } from 'react-router-dom';
|
||||
import { Graft } from '../types';
|
||||
import { listGrafts, cultivate, getDownloadUrl } from '../api';
|
||||
import './Home.css';
|
||||
import './TreePage.css';
|
||||
|
||||
function TreePage() {
|
||||
const { groveName, treeName } = useParams<{ groveName: string; treeName: string }>();
|
||||
const [grafts, setGrafts] = useState<Graft[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [uploading, setUploading] = useState(false);
|
||||
const [uploadResult, setUploadResult] = useState<string | null>(null);
|
||||
const [tag, setTag] = useState('');
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (groveName && treeName) {
|
||||
loadGrafts();
|
||||
}
|
||||
}, [groveName, treeName]);
|
||||
|
||||
async function loadGrafts() {
|
||||
try {
|
||||
setLoading(true);
|
||||
const data = await listGrafts(groveName!, treeName!);
|
||||
setGrafts(data);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to load grafts');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleUpload(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
const file = fileInputRef.current?.files?.[0];
|
||||
if (!file) {
|
||||
setError('Please select a file');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
setUploading(true);
|
||||
setError(null);
|
||||
const result = await cultivate(groveName!, treeName!, file, tag || undefined);
|
||||
setUploadResult(`Uploaded successfully! Fruit ID: ${result.fruit_id}`);
|
||||
setTag('');
|
||||
if (fileInputRef.current) {
|
||||
fileInputRef.current.value = '';
|
||||
}
|
||||
loadGrafts();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Upload failed');
|
||||
} finally {
|
||||
setUploading(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <div className="loading">Loading...</div>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="home">
|
||||
<nav className="breadcrumb">
|
||||
<Link to="/">Groves</Link> / <Link to={`/grove/${groveName}`}>{groveName}</Link> / <span>{treeName}</span>
|
||||
</nav>
|
||||
|
||||
<div className="page-header">
|
||||
<h1>📦 {treeName}</h1>
|
||||
</div>
|
||||
|
||||
{error && <div className="error-message">{error}</div>}
|
||||
{uploadResult && <div className="success-message">{uploadResult}</div>}
|
||||
|
||||
<div className="upload-section card">
|
||||
<h3>Upload Artifact</h3>
|
||||
<form onSubmit={handleUpload} className="upload-form">
|
||||
<div className="form-group">
|
||||
<label htmlFor="file">File</label>
|
||||
<input
|
||||
id="file"
|
||||
type="file"
|
||||
ref={fileInputRef}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label htmlFor="tag">Tag (optional)</label>
|
||||
<input
|
||||
id="tag"
|
||||
type="text"
|
||||
value={tag}
|
||||
onChange={(e) => setTag(e.target.value)}
|
||||
placeholder="v1.0.0, latest, stable..."
|
||||
/>
|
||||
</div>
|
||||
<button type="submit" className="btn btn-primary" disabled={uploading}>
|
||||
{uploading ? 'Uploading...' : 'Upload'}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<h2>Tags / Versions</h2>
|
||||
{grafts.length === 0 ? (
|
||||
<div className="empty-state">
|
||||
<p>No tags yet. Upload an artifact with a tag to create one!</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="grafts-table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Tag</th>
|
||||
<th>Fruit ID</th>
|
||||
<th>Created</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{grafts.map((graft) => (
|
||||
<tr key={graft.id}>
|
||||
<td><strong>{graft.name}</strong></td>
|
||||
<td className="fruit-id">{graft.fruit_id.substring(0, 12)}...</td>
|
||||
<td>{new Date(graft.created_at).toLocaleString()}</td>
|
||||
<td>
|
||||
<a
|
||||
href={getDownloadUrl(groveName!, treeName!, graft.name)}
|
||||
className="btn btn-secondary btn-small"
|
||||
download
|
||||
>
|
||||
Download
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="usage-section card">
|
||||
<h3>Usage</h3>
|
||||
<p>Download artifacts using:</p>
|
||||
<pre>
|
||||
<code>curl -O {window.location.origin}/api/v1/grove/{groveName}/{treeName}/+/latest</code>
|
||||
</pre>
|
||||
<p>Or with a specific tag:</p>
|
||||
<pre>
|
||||
<code>curl -O {window.location.origin}/api/v1/grove/{groveName}/{treeName}/+/v1.0.0</code>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default TreePage;
|
||||
Reference in New Issue
Block a user