refactor(up/down limit): allow floating value & default to 1
This commit is contained in:
parent
31719103f6
commit
f4a222aa15
5 changed files with 14 additions and 14 deletions
|
|
@ -61,12 +61,12 @@ export const AdvancedForm = ({ form }: Props) => {
|
||||||
disabled={!uploadLimitEnabled}
|
disabled={!uploadLimitEnabled}
|
||||||
type="number"
|
type="number"
|
||||||
min={1}
|
min={1}
|
||||||
step={1}
|
step={0.1}
|
||||||
max={999999}
|
max={999999}
|
||||||
placeholder="10"
|
placeholder="10"
|
||||||
className="pr-12"
|
className="pr-12"
|
||||||
{...field}
|
{...field}
|
||||||
onChange={(e) => field.onChange(parseInt(e.target.value, 10) || 1)}
|
onChange={(e) => field.onChange(parseFloat(e.target.value) || 1)}
|
||||||
/>
|
/>
|
||||||
<div className="absolute inset-y-0 right-0 flex items-center pr-3">
|
<div className="absolute inset-y-0 right-0 flex items-center pr-3">
|
||||||
<div className="h-4 w-px bg-border" />
|
<div className="h-4 w-px bg-border" />
|
||||||
|
|
@ -139,12 +139,12 @@ export const AdvancedForm = ({ form }: Props) => {
|
||||||
placeholder="10"
|
placeholder="10"
|
||||||
type="number"
|
type="number"
|
||||||
min={1}
|
min={1}
|
||||||
step={1}
|
step={0.1}
|
||||||
max={999999}
|
max={999999}
|
||||||
disabled={!downloadLimitEnabled}
|
disabled={!downloadLimitEnabled}
|
||||||
className="pr-12"
|
className="pr-12"
|
||||||
{...field}
|
{...field}
|
||||||
onChange={(e) => field.onChange(parseInt(e.target.value, 10) || 1)}
|
onChange={(e) => field.onChange(parseFloat(e.target.value) || 1)}
|
||||||
/>
|
/>
|
||||||
<div className="absolute inset-y-0 right-0 flex items-center pr-3">
|
<div className="absolute inset-y-0 right-0 flex items-center pr-3">
|
||||||
<div className="h-4 w-px bg-border" />
|
<div className="h-4 w-px bg-border" />
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ALTER TABLE `repositories_table` ADD `upload_limit_enabled` integer DEFAULT false NOT NULL;--> statement-breakpoint
|
ALTER TABLE `repositories_table` ADD `upload_limit_enabled` integer DEFAULT false NOT NULL;--> statement-breakpoint
|
||||||
ALTER TABLE `repositories_table` ADD `upload_limit_value` real DEFAULT 0 NOT NULL;--> statement-breakpoint
|
ALTER TABLE `repositories_table` ADD `upload_limit_value` real DEFAULT 1 NOT NULL;--> statement-breakpoint
|
||||||
ALTER TABLE `repositories_table` ADD `upload_limit_unit` text DEFAULT 'Mbps' NOT NULL;--> statement-breakpoint
|
ALTER TABLE `repositories_table` ADD `upload_limit_unit` text DEFAULT 'Mbps' NOT NULL;--> statement-breakpoint
|
||||||
ALTER TABLE `repositories_table` ADD `download_limit_enabled` integer DEFAULT false NOT NULL;--> statement-breakpoint
|
ALTER TABLE `repositories_table` ADD `download_limit_enabled` integer DEFAULT false NOT NULL;--> statement-breakpoint
|
||||||
ALTER TABLE `repositories_table` ADD `download_limit_value` real DEFAULT 0 NOT NULL;--> statement-breakpoint
|
ALTER TABLE `repositories_table` ADD `download_limit_value` real DEFAULT 1 NOT NULL;--> statement-breakpoint
|
||||||
ALTER TABLE `repositories_table` ADD `download_limit_unit` text DEFAULT 'Mbps' NOT NULL;
|
ALTER TABLE `repositories_table` ADD `download_limit_unit` text DEFAULT 'Mbps' NOT NULL;
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"version": "6",
|
"version": "6",
|
||||||
"dialect": "sqlite",
|
"dialect": "sqlite",
|
||||||
"id": "9506e3c1-3131-4621-b74b-6023d63a0f00",
|
"id": "73952303-c589-4b3b-93f1-b70478329dbf",
|
||||||
"prevId": "ad86ee2a-231e-45d1-9910-e4b7cac6a8af",
|
"prevId": "ad86ee2a-231e-45d1-9910-e4b7cac6a8af",
|
||||||
"tables": {
|
"tables": {
|
||||||
"account": {
|
"account": {
|
||||||
|
|
@ -717,7 +717,7 @@
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": true,
|
"notNull": true,
|
||||||
"autoincrement": false,
|
"autoincrement": false,
|
||||||
"default": 0
|
"default": 1
|
||||||
},
|
},
|
||||||
"upload_limit_unit": {
|
"upload_limit_unit": {
|
||||||
"name": "upload_limit_unit",
|
"name": "upload_limit_unit",
|
||||||
|
|
@ -741,7 +741,7 @@
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": true,
|
"notNull": true,
|
||||||
"autoincrement": false,
|
"autoincrement": false,
|
||||||
"default": 0
|
"default": 1
|
||||||
},
|
},
|
||||||
"download_limit_unit": {
|
"download_limit_unit": {
|
||||||
"name": "download_limit_unit",
|
"name": "download_limit_unit",
|
||||||
|
|
|
||||||
|
|
@ -236,8 +236,8 @@
|
||||||
{
|
{
|
||||||
"idx": 33,
|
"idx": 33,
|
||||||
"version": "6",
|
"version": "6",
|
||||||
"when": 1768497229303,
|
"when": 1768497767122,
|
||||||
"tag": "0033_thankful_master_chief",
|
"tag": "0033_chunky_tyrannus",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -166,10 +166,10 @@ export const repositoriesTable = sqliteTable("repositories_table", {
|
||||||
lastChecked: int("last_checked", { mode: "number" }),
|
lastChecked: int("last_checked", { mode: "number" }),
|
||||||
lastError: text("last_error"),
|
lastError: text("last_error"),
|
||||||
uploadLimitEnabled: int("upload_limit_enabled", { mode: "boolean" }).notNull().default(false),
|
uploadLimitEnabled: int("upload_limit_enabled", { mode: "boolean" }).notNull().default(false),
|
||||||
uploadLimitValue: real("upload_limit_value").notNull().default(0),
|
uploadLimitValue: real("upload_limit_value").notNull().default(1),
|
||||||
uploadLimitUnit: text("upload_limit_unit").$type<BandwidthUnit>().notNull().default("Mbps"),
|
uploadLimitUnit: text("upload_limit_unit").$type<BandwidthUnit>().notNull().default("Mbps"),
|
||||||
downloadLimitEnabled: int("download_limit_enabled", { mode: "boolean" }).notNull().default(false),
|
downloadLimitEnabled: int("download_limit_enabled", { mode: "boolean" }).notNull().default(false),
|
||||||
downloadLimitValue: real("download_limit_value").notNull().default(0),
|
downloadLimitValue: real("download_limit_value").notNull().default(1),
|
||||||
downloadLimitUnit: text("download_limit_unit").$type<BandwidthUnit>().notNull().default("Mbps"),
|
downloadLimitUnit: text("download_limit_unit").$type<BandwidthUnit>().notNull().default("Mbps"),
|
||||||
createdAt: int("created_at", { mode: "number" })
|
createdAt: int("created_at", { mode: "number" })
|
||||||
.notNull()
|
.notNull()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue