Skip to content
Commits on Source (10)
FROM node:18-alpine AS base
# Install dependencies only when needed
FROM node:16-alpine AS deps
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json ./
RUN npm install --frozen-lockfile
# Rebuild the source code only when needed
FROM node:16-alpine AS builder
FROM base AS builder
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN npm run build && npm install --production --ignore-scripts --prefer-offline
COPY . .
ENV NEXT_TELEMETRY_DISABLED 1
RUN npm run build && npm install
# Production image, copy all the files and run next
FROM node:16-alpine AS runner
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# You only need to copy next.config.js if you are NOT using the default configuration
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
# Execute script
RUN apk add --no-cache --upgrade bash
USER nextjs
EXPOSE 3000
ENV PORT 3000
# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry.
ENV NEXT_TELEMETRY_DISABLED 1
CMD ["node_modules/.bin/next", "start"]
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD ["node", "start"]
\ No newline at end of file
import Logout from "./Logout";
import Logout from "../Logout/Logout";
import { useSession } from "next-auth/react";
import styles from "../styles/Auth.module.css";
import { publicRuntimeConfig } from "../utils/envConfig";
import styles from "./Auth.module.css";
import { publicRuntimeConfig } from "../../utils/envConfig";
export default function Auth({ children }) {
const { data: session, status } = useSession({ required: true });
......@@ -13,12 +13,10 @@ export default function Auth({ children }) {
!publicRuntimeConfig.NEXT_PUBLIC_AUTHORIZED.includes(session.user.email)
) {
return (
<>
<div className={styles.auth}>
<p>Désolé {session.user.email}, vous n avez pas les droits</p>
<Logout />
</div>
</>
<div className={styles.auth}>
<p>Désolé {session.user.email}, vous n avez pas les droits</p>
<Logout />
</div>
);
}
return children;
......
......@@ -5,14 +5,14 @@ import { useSession } from "next-auth/react";
import { Box, IconButton, Tooltip } from "@mui/material";
import { Delete, Edit } from "@mui/icons-material";
import styles from "../styles/DashBoard.module.css";
import styles from "./DashBoard.module.css";
import Navigation from "./Navigation";
import Header from "./Header";
import Notification from "./Notification";
import Navigation from "../Navigation/Navigation";
import Header from "../Header/Header";
import Notification from "../Notification/Notification";
import { formatData } from "../utils/table/formatData";
import { publicRuntimeConfig } from "../utils/envConfig";
import { formatData } from "../../utils/table/formatData";
import { publicRuntimeConfig } from "../../utils/envConfig";
const DashBoard = ({ columns, apiRouteName }) => {
const [tableData, setTableData] = useState([]);
......@@ -152,8 +152,8 @@ const DashBoard = ({ columns, apiRouteName }) => {
)
}
state={{ isLoading, sorting }}
virtualizerInstanceRef={virtualizerInstanceRef}
virtualizerProps={{ overscan: 20 }}
rowVirtualizerInstanceRef={virtualizerInstanceRef}
rowVirtualizerProps={{ overscan: 20 }}
initialState={{
showColumnFilters: false,
density: "compact",
......
import { useEffect, useState } from "react";
import Logout from "./Logout";
import Logout from "../Logout/Logout";
import { useSession } from "next-auth/react";
import styles from "../styles/Header.module.css";
import { publicRuntimeConfig } from "../utils/envConfig";
import styles from "./Header.module.css";
import { publicRuntimeConfig } from "../../utils/envConfig";
export default function Header({ tableName }) {
const { data: session } = useSession();
......
import { signOut } from "next-auth/react";
import styles from "../styles/Logout.module.css";
import styles from "./Logout.module.css";
export default function Logout() {
return (
<>
<button className={styles.logout} onClick={() => signOut()}>
Logout
</button>
</>
<button className={styles.logout} onClick={() => signOut()}>
Logout
</button>
);
}
import Link from "next/link";
import styles from "../styles/Navigation.module.css";
import styles from "./Navigation.module.css";
export default function Navigation() {
return (
<>
<div className={styles.link}>
<Link href="/appSettings">
<a>
<p>AppSettings</p>
</a>
</Link>
<Link href="/appSettings">AppSettings</Link>
</div>
<div className={styles.link}>
<Link href="/analytics">
<a>
<p>Analytics</p>
</a>
</Link>
<Link href="/analytics">Analytics</Link>
</div>
<div className={styles.link}>
<Link href="/articles">
<a>
<p>Articles</p>
</a>
</Link>
<Link href="/articles">Articles</Link>
</div>
<div className={styles.link}>
<Link href="/asamextensions">
<a>
<p>AsamExtensions</p>
</a>
</Link>
<Link href="/asamextensions">AsamExtensions</Link>
</div>
<div className={styles.link}>
<Link href="/bookmarks">
<a>
<p>Bookmarks</p>
</a>
</Link>
<Link href="/bookmarks">Bookmarks</Link>
</div>
<div className={styles.link}>
<Link href="/categories">
<a>
<p>Catégories</p>
</a>
</Link>
<Link href="/categories">Catégories</Link>
</div>
<div className={styles.link}>
<Link href="/defaultSpaces">
<a>
<p>DefaultSpaces</p>
</a>
</Link>
<Link href="/defaultSpaces">DefaultSpaces</Link>
</div>
<div className={styles.link}>
<Link href="/forms">
<a>
<p>Forms</p>
</a>
</Link>
<Link href="/forms">Forms</Link>
</div>
<div className={styles.link}>
<Link href="/eventsAgenda">
<a>
<p>EventsAgenda</p>
</a>
</Link>
<Link href="/eventsAgenda">EventsAgenda</Link>
</div>
<div className={styles.link}>
<Link href="/globalInfos">
<a>
<p>GlobalInfos</p>
</a>
</Link>
<Link href="/globalInfos">GlobalInfos</Link>
</div>
<div className={styles.link}>
<Link href="/groups">
<a>
<p>Groups</p>
</a>
</Link>
<Link href="/groups">Groups</Link>
</div>
<div className={styles.link}>
<Link href="/helps">
<a>
<p>Helps</p>
</a>
</Link>
<Link href="/helps">Helps</Link>
</div>
<div className={styles.link}>
<Link href="/mezigs">
<a>
<p>Mezigs</p>
</a>
</Link>
<Link href="/mezigs">Mezigs</Link>
</div>
<div className={styles.link}>
<Link href="/migrations">
<a>
<p>Migrations</p>
</a>
</Link>
<Link href="/migrations">Migrations</Link>
</div>
<div className={styles.link}>
<Link href="/nextcloud">
<a>
<p>Nextcloud</p>
</a>
</Link>
<Link href="/nextcloud">Nextcloud</Link>
</div>
<div className={styles.link}>
<Link href="/notifications">
<a>
<p>Notifications</p>
</a>
</Link>
<Link href="/notifications">Notifications</Link>
</div>
<div className={styles.link}>
<Link href="/personalSpaces">
<a>
<p>PersonalSpaces</p>
</a>
</Link>
<Link href="/personalSpaces">PersonalSpaces</Link>
</div>
<div className={styles.link}>
<Link href="/polls">
<a>
<p>Polls</p>
</a>
</Link>
<Link href="/polls">Polls</Link>
</div>
<div className={styles.link}>
<Link href="/pollsAnswers">
<a>
<p>pollsAnswers</p>
</a>
</Link>
<Link href="/pollsAnswers">pollsAnswers</Link>
</div>
<div className={styles.link}>
<Link href="/roles">
<a>
<p>Roles</p>
</a>
</Link>
<Link href="/roles">Roles</Link>
</div>
<div className={styles.link}>
<Link href="/roleAssignments">
<a>
<p>RoleAssignment</p>
</a>
</Link>
<Link href="/roleAssignments">RoleAssignment</Link>
</div>
<div className={styles.link}>
<Link href="/services">
<a>
<p>Services</p>
</a>
</Link>
<Link href="/services">Services</Link>
</div>
<div className={styles.link}>
<Link href="/skills">
<a>
<p>Skills</p>
</a>
</Link>
<Link href="/skills">Skills</Link>
</div>
<div className={styles.link}>
<Link href="/structures">
<a>
<p>Structures</p>
</a>
</Link>
<Link href="/structures">Structures</Link>
</div>
<div className={styles.link}>
<Link href="/tags">
<a>
<p>Tags</p>
</a>
</Link>
<Link href="/tags">Tags</Link>
</div>
<div className={styles.link}>
<Link href="/users" target="_blank">
<a>
<p>Users</p>
</a>
</Link>
<Link href="/users">Users</Link>
</div>
<div className={styles.link}>
<Link href="/userBookmarks">
<a>
<p>UserBookmarks</p>
</a>
</Link>
<Link href="/userBookmarks">UserBookmarks</Link>
</div>
</>
);
......
.link{
border: 1px solid rgba(25, 118, 210, 0.5);
border-radius: 10px;
padding: 0 10px;
padding: 10px;
margin: 10px;
}
\ No newline at end of file
......@@ -26,4 +26,4 @@ On peut éditer la taille des cellules etc .
**AJOUT DE LA PAGE A LA NAVIGATION**
_./Components/Navigation.jsx_
_./components/Navigation.jsx_
......@@ -26,14 +26,14 @@ export default mongoose.models.Bookmarks ||
> Création de votre route API => ./pages/api/collectionName/index.js
```jsx
import { unstable_getServerSession } from "next-auth/next"; // For check client session for block API access to non authenticated user
import { getServerSession } from "next-auth/next"; // For check client session for block API access to non authenticated user
import { authOptions } from "../auth/[...nextauth]";
import connectDB from "../../../database/connectDB";
import Bookmarks from "../../../database/models/Bookmarks";
export default async function handler(req, res) {
const session = await unstable_getServerSession(req, res, authOptions);
const session = await getServerSession(req, res, authOptions);
const { method } = req;
const { tableName } = req.query;
......@@ -94,7 +94,7 @@ export default async function handler(req, res) {
```jsx
import React, { useMemo } from "react";
import DashBoard from "../Components/DashBoard";
import DashBoard from "../components/DashBoard/DashBoard";
const Bookmarks = () => {
const columns = useMemo(
......@@ -191,12 +191,8 @@ const Bookmarks = () => {
export default Bookmarks;
```
> Ajouter votre page dans la navigation => ./Components/Navigation.jsx
> Ajouter votre page dans la navigation => ./components/Navigation.jsx
```jsx
<Link href="/yourPage">
<a>
<p>YourPage</p>
</a>
</Link>
<Link href="/yourPage"> YourPage</Link>
```
This diff is collapsed.
{
"name": "supercrudv2",
"version": "1.2.0",
"version": "1.3.0-testing.1",
"private": true,
"scripts": {
"dev": "next dev -p 3050",
......
import "../styles/globals.css";
import "./globals.css";
import { SessionProvider } from "next-auth/react";
import Auth from "../Components/Auth";
import Auth from "../components/Auth/Auth";
import App from "next/app";
export default function MyApp({
......
import { useMemo } from "react";
import DashBoard from "../Components/DashBoard";
import DashBoard from "../components/DashBoard/DashBoard";
const Analytics = () => {
const columns = useMemo(
......
import { unstable_getServerSession } from "next-auth/next";
import { getServerSession } from "next-auth/next";
import { authOptions } from "../auth/[...nextauth]";
import connectDB from "../../../database/connectDB";
import Analytics from "../../../database/models/Analytics";
export default async function handler(req, res) {
const session = await unstable_getServerSession(req, res, authOptions);
const session = await getServerSession(req, res, authOptions);
const { method } = req;
const { tableName } = req.query;
......
import { unstable_getServerSession } from "next-auth/next";
import { getServerSession } from "next-auth/next";
import { authOptions } from "../auth/[...nextauth]";
import connectDB from "../../../database/connectDB";
import AppSettings from "../../../database/models/AppSettings";
export default async function handler(req, res) {
const session = await unstable_getServerSession(req, res, authOptions);
const session = await getServerSession(req, res, authOptions);
const { method } = req;
const { tableName } = req.query;
......