Fix database model associations and update API route

This commit is contained in:
newtbot
2024-01-27 20:15:29 +08:00
parent 6190cb63cd
commit d491750916
14 changed files with 61 additions and 164 deletions

View File

@ -547,106 +547,3 @@ body.one-content-column-version .content thead {
background-color: #45a049; /* Darker green on hover */
}
.delete-key-button {
float: right; /* Align the button to the right */
margin-right: 78%;
margin-top: -40px; /* Adjust the margin-top value based on your layout */
/* Add any additional styling you want for the button */
}
#content-get-api .delete-key-button {
background-color: #af4c4c; /* Green background color */
color: white; /* White text color */
padding: 5px 11px; /* Padding for the button */
border: none; /* Remove button border */
border-radius: 5px; /* Add border-radius for rounded corners */
cursor: pointer; /* Add pointer cursor on hover */
font-size: 14px; /* Font size */
}
#content-get-api .delete-key-button:hover {
background-color: #a04545; /* Darker green on hover */
}
.generate-key-screen {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 30px;
width: 400px; /* Adjust the width as needed */
background-color: #ffffff;
border: 1px solid #eaeaea;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); /* Adjust the shadow as needed */
z-index: 1000;
border-radius: 12px; /* Slightly increased border-radius for a softer look */
overflow: hidden; /* Hide overflow content */
}
.generate-key-screen label {
display: block;
margin-bottom: 8px;
color: #333;
}
.generate-key-screen input {
width: 100%;
padding: 8px;
margin-bottom: 16px;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 4px;
}
.generate-key-screen button {
background-color: #4caf50;
color: #fff;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.generate-key-screen button:hover {
background-color: #45a049;
}
.generate-key-screen button + button {
margin-left: 8px;
background-color: #f44336;
}
.generate-key-screen button + button:hover {
background-color: #d32f2f;
}
.key-input {
display: flex;
align-items: center;
}
.key-input input {
flex: 1;
padding: 8px;
margin-right: 8px;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 4px;
}
.key-input button {
background-color: #4caf50;
color: #fff;
padding: 8px 12px;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.key-input button:hover {
background-color: #45a049;
}

View File

@ -147,13 +147,13 @@ button.btn-secondary:hover{
border: none;
}
.services-bar .card h4.card-header{
background-color: #4e3914;
background-color: #ffffff;
color: #4eae3a;
font-size: 18px;
font-weight: 400;
}
.services-bar .card .card-footer{
background-color: #4e3914;
background-color: #ffffff;
}
.about-main{
padding: 30px 0px;

View File

@ -5,8 +5,6 @@ document.addEventListener("DOMContentLoaded", function () {
const aqi = "15";
const temperature = "25°C";
const humidity = "60%";
const pm25 = "10";
const pm10 = "20";
const so2 = "5";
const o3 = "35";
const co = "0.5";
@ -15,7 +13,6 @@ document.addEventListener("DOMContentLoaded", function () {
infoContainer.innerHTML = `
<div class="additional-info-box">
<h3>Additional Information - ${region}</h3>
<button id="viewData">View Data</button>
<div class="info-item">
<span class="info-label">Air Quality Index:</span>
<span class="info-value">${aqi}</span>
@ -28,14 +25,6 @@ document.addEventListener("DOMContentLoaded", function () {
<span class="info-label">Humidity:</span>
<span class="info-value">${humidity}</span>
</div>
<div class="info-item">
<span class="info-label">PM2.5:</span>
<span class="info-value">${pm25}</span>
</div>
<div class="info-item">
<span class="info-label">PM10:</span>
<span class="info-value">${pm10}</span>
</div>
<div class="info-item">
<span class="info-label">SO2:</span>
<span class="info-value">${so2}</span>
@ -54,21 +43,6 @@ document.addEventListener("DOMContentLoaded", function () {
</div>
</div>
`;
var viewDataButton = document.getElementById("viewData");
// Add a click event listener to the button
viewDataButton.addEventListener("click", function () {
// Redirect to the "viewdata.ejs" page
window.location.href = "/viewdata";
});
// Remove the 'active' class from all info-box elements
const infoBoxes = document.querySelectorAll('.info-box');
infoBoxes.forEach(box => box.classList.remove('active'));
// Add the 'active' class to the clicked info-box
const clickedBox = document.getElementById(region.toLowerCase());
clickedBox.classList.add('active');
}