Merge pull request #368 from Ravinou/develop

Release v2.4.2
This commit is contained in:
Ravinou 2024-12-08 20:19:06 +01:00 committed by GitHub
commit 1ae44441be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 1889 additions and 1562 deletions

View file

@ -30,6 +30,7 @@ function findTypeIcon() {
declare -A icons
icons[build]='🤖'
icons[chore]='🧹'
icons["chore(deps)"]='🧹'
icons[config]='🔧'
icons[deploy]='🚀'
icons[doc]='📚'

View file

@ -1,6 +1,3 @@
#!/bin/bash
. "$(dirname "$0")/_/husky.sh"
# run commit lint
npx commitlint --edit "$1"

View file

@ -3,8 +3,10 @@ import classes from './StorageBar.module.css';
export default function StorageBar(props) {
//Var
//storageUsed is in octet, storageSize is in GB. Round to 1 decimal for %.
const storageUsedPercent = (((props.storageUsed / 1000000) * 100) / props.storageSize).toFixed(1);
//storageUsed is in kB, storageSize is in GB. Round to 1 decimal for %.
const storageUsedPercent = (((props.storageUsed / 1024 ** 2) * 100) / props.storageSize).toFixed(
1
);
return (
<div className={classes.barContainer}>
@ -19,8 +21,8 @@ export default function StorageBar(props) {
<div className={classes.progressionStyle} />
</div>
<div className={classes.tooltip}>
{storageUsedPercent}% ({(props.storageUsed / 1000000).toFixed(1)} GB / {props.storageSize}{' '}
GB)
{storageUsedPercent}% ({(props.storageUsed / 1024 ** 2).toFixed(1)} GB /{' '}
{props.storageSize} GB)
</div>
</div>
</div>

View file

@ -71,9 +71,9 @@ export default function StorageUsedChartBar() {
datasets: [
{
label: 'Storage used (%)',
//storageUsed is in octet, storageSize is in GB. Round to 1 decimal for %.
//storageUsed is in kB, storageSize is in GB. Round to 1 decimal for %.
data: data.map((repo) =>
(((repo.storageUsed / 1000000) * 100) / repo.storageSize).toFixed(1)
(((repo.storageUsed / 1024 ** 2) * 100) / repo.storageSize).toFixed(1)
),
backgroundColor: '#704dff',
},

View file

@ -1,6 +1,6 @@
//Lib
import classes from './RepoList.module.css';
import { useState, useEffect } from 'react';
import React, { useState, useEffect } from 'react';
import { IconPlus } from '@tabler/icons-react';
import { useRouter } from 'next/router';
import Link from 'next/link';
@ -109,7 +109,7 @@ export default function RepoList() {
//Dynamic list of repositories (with a map of Repo components)
const renderRepoList = data.repoList.map((repo, index) => {
return (
<>
<React.Fragment key={repo.id}>
<Repo
key={repo.id}
id={repo.id}
@ -127,7 +127,7 @@ export default function RepoList() {
repoManageEditHandler={() => repoManageEditHandler(repo.id)}
wizardEnv={wizardEnv}
></Repo>
</>
</React.Fragment>
);
});

View file

@ -1,7 +1,7 @@
ARG UID=1001
ARG GID=1001
FROM node:20-bookworm-slim as base
FROM node:22-bookworm-slim as base
# build stage
FROM base AS deps
@ -10,7 +10,7 @@ WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --only=production
RUN npm ci --omit=dev
FROM base AS builder
@ -31,6 +31,7 @@ ARG UID
ARG GID
ENV NODE_ENV production
ENV HOSTNAME=
RUN echo 'deb http://deb.debian.org/debian bookworm-backports main' >> /etc/apt/sources.list
RUN apt-get update && apt-get install -y \

View file

@ -14,6 +14,9 @@
# Exit when any command fails
set -e
# Ignore "lost+found" directories
GLOBIGNORE="LOST+FOUND:lost+found"
# Load .env if exists
if [[ -f .env ]]; then
source .env

View file

@ -1,25 +1,23 @@
/** @type {import('next').NextConfig} */
module.exports = {
// nextConfig
images: {
unoptimized: true,
},
reactStrictMode: false,
swcMinify: true,
//basePath: '/borgwarehouse-demo',
async redirects() {
return [
{
source: '/setup-wizard',
destination: '/setup-wizard/1',
permanent: true,
},
{
source: '/manage-repo',
destination: '/',
permanent: true,
},
];
},
// nextConfig
images: {
unoptimized: true,
},
reactStrictMode: false,
async redirects() {
return [
{
source: '/setup-wizard',
destination: '/setup-wizard/1',
permanent: true,
},
{
source: '/manage-repo',
destination: '/',
permanent: true,
},
];
},
};

3350
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -15,7 +15,7 @@
"@tabler/icons-react": "^3.24.0",
"bcryptjs": "^2.4.3",
"chart.js": "^4.4.7",
"next": "^14.2.15",
"next": "^15.0.4",
"next-auth": "^4.24.10",
"nodemailer": "^6.9.16",
"react": "^18.3.1",
@ -31,7 +31,7 @@
"devDependencies": {
"@commitlint/cli": "^19.6.0",
"@commitlint/config-conventional": "^19.6.0",
"eslint-config-next": "^14.2.15",
"eslint-config-next": "^15.0.4",
"husky": "^9.1.7",
"prettier": "^3.4.2"
}

View file

@ -76,3 +76,32 @@ teardown() {
[ "$status" -eq 0 ]
[ "$normalized_output" == "$normalized_expected_output" ]
}
@test "Test getStorageUsed.sh ignores lost+found directory" {
mkdir -p "${home}/repos/lost+found"
dd if=/dev/zero of="${home}/repos/lost+found/file1" bs=1K count=500
run bash /test/scripts/getStorageUsed.sh
# Expected output should NOT include lost+found
expected_output='[
{
"size": 36,
"name": "repo1"
},
{
"size": 1160,
"name": "repo2"
},
{
"size": 116,
"name": "repo3"
}
]'
normalized_output=$(echo "$output" | jq .)
normalized_expected_output=$(echo "$expected_output" | jq .)
[ "$status" -eq 0 ]
[ "$normalized_output" == "$normalized_expected_output" ]
}