mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-16 23:20:12 +01:00
Fix some Codacy warnings
This commit is contained in:
parent
41ce5a3b32
commit
ad12b483ff
5 changed files with 30 additions and 21 deletions
|
|
@ -16,10 +16,12 @@ type Handler struct {
|
|||
Client container.Client
|
||||
}
|
||||
|
||||
// CheckRequest defines the type for the request data of the Check endpoint
|
||||
type CheckRequest struct {
|
||||
ContainerId string
|
||||
}
|
||||
|
||||
// CheckResponse defines the type for the response data of the Check endpoint
|
||||
type CheckResponse struct {
|
||||
ContainerId string
|
||||
HasUpdate bool
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ type Handler struct {
|
|||
Client container.Client
|
||||
}
|
||||
|
||||
// ContainerListEntry defines the type of each container in the response
|
||||
type ContainerListEntry struct {
|
||||
ContainerId string
|
||||
ContainerName string
|
||||
|
|
@ -25,6 +26,8 @@ type ContainerListEntry struct {
|
|||
ImageVersion string
|
||||
ImageCreatedDate string
|
||||
}
|
||||
|
||||
// ListResponse defines the return type of the List endpoint
|
||||
type ListResponse struct {
|
||||
Containers []ContainerListEntry
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,23 +4,13 @@ const apiFactory = () => {
|
|||
let token = "";
|
||||
|
||||
const headers = () => ({
|
||||
'Authorization': 'Bearer ' + token
|
||||
"Authorization": "Bearer " + token
|
||||
});
|
||||
|
||||
const checkLogin = async () => {
|
||||
const token = localStorage.getItem("token");
|
||||
|
||||
if (token) {
|
||||
const isLoggedIn = await logIn(token);
|
||||
return isLoggedIn;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const logIn = async (password, remember) => {
|
||||
token = password;
|
||||
const response = await fetch(baseUrl + "/list", {
|
||||
credentials: 'include',
|
||||
credentials: "include",
|
||||
headers: headers()
|
||||
});
|
||||
|
||||
|
|
@ -35,13 +25,23 @@ const apiFactory = () => {
|
|||
return false;
|
||||
};
|
||||
|
||||
const checkLogin = async () => {
|
||||
const token = localStorage.getItem("token");
|
||||
|
||||
if (token) {
|
||||
const isLoggedIn = await logIn(token);
|
||||
return isLoggedIn;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const logOut = () => {
|
||||
localStorage.clear();
|
||||
};
|
||||
|
||||
const list = async () => {
|
||||
const response = await fetch(baseUrl + "/list", {
|
||||
credentials: 'include',
|
||||
credentials: "include",
|
||||
headers: headers()
|
||||
});
|
||||
const data = await response.json();
|
||||
|
|
@ -53,11 +53,11 @@ const apiFactory = () => {
|
|||
ContainerId: containerId
|
||||
};
|
||||
const response = await fetch(baseUrl + "/check", {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
headers: {
|
||||
...headers(),
|
||||
'Content-Type': 'application/json',
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(requestData)
|
||||
});
|
||||
|
|
@ -73,7 +73,7 @@ const apiFactory = () => {
|
|||
}
|
||||
|
||||
const response = await fetch(updateUrl.toString(), {
|
||||
credentials: 'include',
|
||||
credentials: "include",
|
||||
headers: headers(),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
--bs-secondary: #acbfc7 !important;
|
||||
--bs-secondary-rgb: 64, 97, 112;
|
||||
|
||||
|
||||
--bs-dark: #003343 !important;
|
||||
}
|
||||
|
||||
|
|
@ -32,8 +32,8 @@
|
|||
}
|
||||
|
||||
.btn-outline-primary {
|
||||
--bs-btn-color:#038C7F;
|
||||
--bs-btn-disabled-color:#038C7F;
|
||||
--bs-btn-color: #038C7F;
|
||||
--bs-btn-disabled-color: #038C7F;
|
||||
--bs-btn-border-color: #038C7F;
|
||||
--bs-btn-hover-bg: #02675d;
|
||||
--bs-btn-hover-border-color: #025a52;
|
||||
|
|
@ -47,5 +47,6 @@ body {
|
|||
}
|
||||
|
||||
.container-list-entry:hover .container-list-entry-icon .bi-box::before {
|
||||
content: "\F7D2" /* .bi-box-fill */
|
||||
/* .bi-box-fill */
|
||||
content: "\F7D2"
|
||||
}
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
var React;
|
||||
var ReactDOM;
|
||||
|
||||
const useState = React.useState;
|
||||
const useEffect = React.useEffect;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue