mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-16 15:10:12 +01:00
Additional Codacy fixes
This commit is contained in:
parent
741f315f14
commit
73f7e105e8
4 changed files with 33 additions and 34 deletions
|
|
@ -7,7 +7,7 @@ interface LoginProps {
|
|||
}
|
||||
|
||||
const Login = (props: LoginProps) => {
|
||||
const [password, setPassword] = useState("");
|
||||
const [value, setValue] = useState("");
|
||||
const [remember, setRemember] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ const Login = (props: LoginProps) => {
|
|||
if (event.target.type === "checkbox") {
|
||||
setRemember(event.target.checked);
|
||||
} else {
|
||||
setPassword(event.target.value);
|
||||
setValue(event.target.value);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -23,11 +23,11 @@ const Login = (props: LoginProps) => {
|
|||
setError("");
|
||||
event.preventDefault();
|
||||
|
||||
if (password === "") {
|
||||
if (value === "") {
|
||||
return;
|
||||
}
|
||||
|
||||
const loggedIn = await logIn(password, remember);
|
||||
const loggedIn = await logIn(value, remember);
|
||||
if (loggedIn) {
|
||||
props.onLogin();
|
||||
} else {
|
||||
|
|
@ -42,7 +42,7 @@ const Login = (props: LoginProps) => {
|
|||
<h1 className="h3 mb-3 fw-normal">Please log in</h1>
|
||||
|
||||
<div className="form-floating mb-3">
|
||||
<input type="password" value={password} onChange={handleChange} className={"form-control" + (error ? " is-invalid" : "")} id="floatingPassword" placeholder="Password" required />
|
||||
<input type="password" value={value} onChange={handleChange} className={"form-control" + (error ? " is-invalid" : "")} id="floatingPassword" placeholder="Password" required />
|
||||
<label htmlFor="floatingPassword" className="user-select-none">Password</label>
|
||||
{error &&
|
||||
<div className="invalid-feedback">
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@ import { CheckResponse, ContainerListEntry } from "../services/Api";
|
|||
export default interface ContainerModel extends ContainerListEntry, CheckResponse {
|
||||
Selected: boolean;
|
||||
IsChecking: boolean;
|
||||
}
|
||||
};
|
||||
|
|
@ -1,3 +1,26 @@
|
|||
export interface ListResponse {
|
||||
Containers: ContainerListEntry[];
|
||||
}
|
||||
|
||||
export interface ContainerListEntry {
|
||||
ContainerID: string;
|
||||
ContainerName: string;
|
||||
ImageName: string;
|
||||
ImageNameShort: string;
|
||||
ImageVersion: string;
|
||||
ImageCreatedDate: string;
|
||||
}
|
||||
|
||||
export interface CheckRequest {
|
||||
ContainerID: string;
|
||||
}
|
||||
|
||||
export interface CheckResponse {
|
||||
ContainerID: string;
|
||||
HasUpdate: boolean;
|
||||
NewVersion: string;
|
||||
NewVersionCreated: string;
|
||||
}
|
||||
|
||||
const getEmbeddedVariable = (variableName: string) => {
|
||||
const value = document.body.getAttribute(`data-${variableName}`);
|
||||
|
|
@ -83,28 +106,4 @@ export const update = async (images?: string[]): Promise<boolean> => {
|
|||
});
|
||||
|
||||
return response.ok;
|
||||
};
|
||||
|
||||
export interface ListResponse {
|
||||
Containers: ContainerListEntry[];
|
||||
}
|
||||
|
||||
export interface ContainerListEntry {
|
||||
ContainerID: string;
|
||||
ContainerName: string;
|
||||
ImageName: string;
|
||||
ImageNameShort: string;
|
||||
ImageVersion: string;
|
||||
ImageCreatedDate: string;
|
||||
}
|
||||
|
||||
export interface CheckRequest {
|
||||
ContainerID: string;
|
||||
}
|
||||
|
||||
export interface CheckResponse {
|
||||
ContainerID: string;
|
||||
HasUpdate: boolean;
|
||||
NewVersion: string;
|
||||
NewVersionCreated: string;
|
||||
}
|
||||
};
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { defineConfig, loadEnv } from "vite"
|
||||
import react from "@vitejs/plugin-react"
|
||||
import { defineConfig, loadEnv } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
|
||||
const htmlPlugin = (mode: string) => {
|
||||
const env = loadEnv(mode, ".");
|
||||
|
|
@ -8,7 +8,7 @@ const htmlPlugin = (mode: string) => {
|
|||
name: "html-transform",
|
||||
transformIndexHtml(html: string) {
|
||||
return html.replace(/%(.*?)%/g, function (match, p1) {
|
||||
return env[p1];
|
||||
return env[String(p1)];
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue