🔀 Merge branch 'dev' into feature/add-basic-authentication

This commit is contained in:
Manuel
2023-09-23 20:32:17 +02:00
3 changed files with 41 additions and 14 deletions

View File

@@ -2,6 +2,8 @@ FROM node:20.5-slim
WORKDIR /app
# Define node.js environment variables
ARG PORT=7575
ENV NEXT_TELEMETRY_DISABLED 1
ENV NODE_ENV production
ENV NODE_OPTIONS '--no-experimental-fetch'
@@ -22,11 +24,15 @@ RUN apt-get update -y && apt-get install -y openssl
RUN yarn global add prisma
# Expose the default application port
EXPOSE 7575
EXPOSE $PORT
ENV PORT=${PORT}
ENV DATABASE_URL "file:../database/db.sqlite"
ENV NEXTAUTH_URL "http://localhost:3000"
ENV PORT 7575
ENV NEXTAUTH_SECRET NOT_IN_USE_BECAUSE_JWTS_ARE_UNUSED
HEALTHCHECK --interval=10s --timeout=5s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:${PORT} || exit 1
CMD ["sh", "./scripts/run.sh"]

View File

@@ -1,6 +1,12 @@
{
"descriptor": {
"name": "DNS hole controls",
"description": "Control PiHole or AdGuard from your dashboard"
"description": "Control PiHole or AdGuard from your dashboard",
"settings": {
"title": "DNS hole controls settings",
"showToggleAllButtons": {
"label": "Show 'Enable/Disable All' Buttons"
}
}
}
}

View File

@@ -25,7 +25,12 @@ import { useDnsHoleSummeryQuery } from './DnsHoleSummary';
const definition = defineWidget({
id: 'dns-hole-controls',
icon: IconDeviceGamepad,
options: {},
options: {
showToggleAllButtons: {
type: 'switch',
defaultValue: true,
},
},
gridstack: {
minWidth: 2,
minHeight: 1,
@@ -106,7 +111,7 @@ function DnsHoleControlsWidgetTile({ widget }: DnsHoleControlsWidgetProps) {
return (
<Stack justify="space-between" h={'100%'} spacing="0.25rem">
{sessionData?.user?.isAdmin && (
{sessionData?.user?.isAdmin && widget.properties.showToggleAllButtons && (
<SimpleGrid
ref={ref}
cols={width > 275 ? 2 : 1}
@@ -156,7 +161,14 @@ function DnsHoleControlsWidgetTile({ widget }: DnsHoleControlsWidgetProps) {
</SimpleGrid>
)}
<Stack spacing="0.25rem">
<Stack
spacing="0.25rem"
display="flex"
style={{
flex: '1',
justifyContent: widget.properties.showToggleAllButtons ? 'flex-end' : 'space-evenly',
}}
>
{data.status.map((dnsHole, index) => {
const app = config?.apps.find((x) => x.id === dnsHole.appId);
@@ -165,7 +177,7 @@ function DnsHoleControlsWidgetTile({ widget }: DnsHoleControlsWidgetProps) {
}
return (
<Card withBorder={true} key={dnsHole.appId} p="xs">
<Card withBorder={true} key={dnsHole.appId} p="xs" radius="md">
<Group>
<Box
sx={(theme) => ({
@@ -182,15 +194,18 @@ function DnsHoleControlsWidgetTile({ widget }: DnsHoleControlsWidgetProps) {
<Text>{app.name}</Text>
<UnstyledButton
onClick={async () => {
await mutateAsync({
action: dnsHole.status === 'enabled' ? 'disable' : 'enable',
configName,
appsToChange: [app.id],
},{
onSettled: () => {
reFetchSummaryDns();
await mutateAsync(
{
action: dnsHole.status === 'enabled' ? 'disable' : 'enable',
configName,
appsToChange: [app.id],
},
{
onSettled: () => {
reFetchSummaryDns();
},
}
});
);
}}
disabled={fetchingDnsSummary || changingStatus}
>