mirror of
https://github.com/logos-storage/logos-storage-frontend.git
synced 2026-01-02 05:13:13 +00:00
ADD expiry dropdown list
This commit is contained in:
parent
cd50aaef09
commit
7a21c33e13
@ -30,7 +30,17 @@ function CreateTab() {
|
|||||||
const toggleBoxExpiry = () => {
|
const toggleBoxExpiry = () => {
|
||||||
setBoxOpenExpiry(!isBoxOpenExpiry);
|
setBoxOpenExpiry(!isBoxOpenExpiry);
|
||||||
};
|
};
|
||||||
|
const handleExpiryChangeDropdown = (e: any) => {
|
||||||
|
const minutes = e.target.value;
|
||||||
|
console.log(minutes);
|
||||||
|
const newDuration = {
|
||||||
|
days: 0,
|
||||||
|
hours: 0,
|
||||||
|
minutes: minutes,
|
||||||
|
seconds: 0
|
||||||
|
};
|
||||||
|
handleExpiryChange(newDuration);
|
||||||
|
};
|
||||||
const handleExpiryChange = (newDuration: { days: number; hours: number; minutes: number; seconds: number }) => {
|
const handleExpiryChange = (newDuration: { days: number; hours: number; minutes: number; seconds: number }) => {
|
||||||
const { days, hours, minutes, seconds } = newDuration;
|
const { days, hours, minutes, seconds } = newDuration;
|
||||||
const totalSeconds = days * 24 * 60 * 60 + hours * 60 * 60 + minutes * 60 + seconds;
|
const totalSeconds = days * 24 * 60 * 60 + hours * 60 * 60 + minutes * 60 + seconds;
|
||||||
@ -41,12 +51,19 @@ function CreateTab() {
|
|||||||
const handleDurationChange = (newDuration: { days: number; hours: number; minutes: number; seconds: number }) => {
|
const handleDurationChange = (newDuration: { days: number; hours: number; minutes: number; seconds: number }) => {
|
||||||
const { days, hours, minutes, seconds } = newDuration;
|
const { days, hours, minutes, seconds } = newDuration;
|
||||||
const totalSeconds = days * 24 * 60 * 60 + hours * 60 * 60 + minutes * 60 + seconds;
|
const totalSeconds = days * 24 * 60 * 60 + hours * 60 * 60 + minutes * 60 + seconds;
|
||||||
|
|
||||||
if (totalSeconds >= 60 && totalSeconds <= 86400) {
|
if (totalSeconds >= 60 && totalSeconds <= 86400) {
|
||||||
setDuration(totalSeconds.toString());
|
setDuration(totalSeconds.toString());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleProofProbabilityChange = (e: any) => {
|
||||||
|
const value = e.target.value;
|
||||||
|
if (value === "" || (value >= 0 && value <= 99)) {
|
||||||
|
setProofProbability(value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function upload(cid: string) {
|
function upload(cid: string) {
|
||||||
fetch(
|
fetch(
|
||||||
`/api/codex/v1/storage/request/${cid}`,
|
`/api/codex/v1/storage/request/${cid}`,
|
||||||
@ -89,12 +106,6 @@ function CreateTab() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleProofProbabilityChange = (e: any) => {
|
|
||||||
const value = e.target.value;
|
|
||||||
if (value === "" || (value >= 0 && value <= 99)) {
|
|
||||||
setProofProbability(value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -134,6 +145,15 @@ function CreateTab() {
|
|||||||
onClick={toggleBoxExpiry}
|
onClick={toggleBoxExpiry}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<select
|
||||||
|
value={expiry}
|
||||||
|
onChange={handleExpiryChangeDropdown}
|
||||||
|
>
|
||||||
|
<option value="">Recommended Expiry Time</option>
|
||||||
|
<option value="5">Small datasets</option>
|
||||||
|
<option value="15">Medium Datasets</option>
|
||||||
|
<option value="60">Large Datasets</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="row">
|
<div className="row">
|
||||||
@ -181,22 +201,22 @@ function CreateTab() {
|
|||||||
<div className="field">
|
<div className="field">
|
||||||
<label>Proof Probability</label>
|
<label>Proof Probability</label>
|
||||||
<div>
|
<div>
|
||||||
<select
|
<select
|
||||||
|
value={proofProbability}
|
||||||
|
onChange={handleProofProbabilityChange}
|
||||||
|
>
|
||||||
|
<option value="">Select Proof Probability</option>
|
||||||
|
<option value="1">Low Durability Guarantee</option>
|
||||||
|
<option value="3">Medium Durability Guarantee</option>
|
||||||
|
<option value="6">Strong Durability Guarantee</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="Custom Proof Probability"
|
||||||
value={proofProbability}
|
value={proofProbability}
|
||||||
onChange={handleProofProbabilityChange}
|
onChange={handleProofProbabilityChange}
|
||||||
>
|
/>
|
||||||
<option value="">Select Proof Probability</option>
|
|
||||||
<option value="1">Low Durability Guarantee</option>
|
|
||||||
<option value="3">Medium Durability Guarantee</option>
|
|
||||||
<option value="6">Strong Durability Guarantee</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder="Custom Proof Probability"
|
|
||||||
value={proofProbability}
|
|
||||||
onChange={handleProofProbabilityChange}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<button onClick={() => upload(ftdCid)}>Create</button>
|
<button onClick={() => upload(ftdCid)}>Create</button>
|
||||||
</div>
|
</div>
|
||||||
@ -242,6 +262,16 @@ h1 {
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.select{
|
||||||
|
padding: 16px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: #141414;
|
||||||
|
border-radius: 8px;
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
.row {
|
.row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -294,6 +324,7 @@ button {
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
button span {
|
button span {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@ function SettingsPage() {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await fetch(
|
await fetch(
|
||||||
`http://localhost:8080/api/codex/v1/connect/${encodeURIComponent(
|
`/api/codex/v1/connect/${encodeURIComponent(
|
||||||
params.id
|
params.id
|
||||||
)}?addrs=${encodeURIComponent(params.address)}`
|
)}?addrs=${encodeURIComponent(params.address)}`
|
||||||
)
|
)
|
||||||
@ -58,17 +58,6 @@ function SettingsPage() {
|
|||||||
<main>
|
<main>
|
||||||
<div className="inputs">
|
<div className="inputs">
|
||||||
<h4>Connection Settings</h4>
|
<h4>Connection Settings</h4>
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder="Local node base URL (default is http://localhost:8080)"
|
|
||||||
value={nodeInfoInput.nodeBaseUrl}
|
|
||||||
onChange={(e) =>
|
|
||||||
setNodeInfoInput({
|
|
||||||
...nodeInfoInput,
|
|
||||||
nodeBaseUrl: e.target.value,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Node to connect to (blank for local node) (e.g. http://example.com:8080))"
|
placeholder="Node to connect to (blank for local node) (e.g. http://example.com:8080))"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user