Skip to content

Commit

Permalink
Admin dashboard (#4)
Browse files Browse the repository at this point in the history
* prepared 2 pages for admin dashboard

* Added shadcn for vue and tailwindcss

* Made login page frontend

* Css fixes

* Made layout of the main dashboard page

* Added forgotten files

* Commit before pc reset

* Added announcement (#3)

* Update app.vue (#5)

* Updated announcements (#6)

* Update app.vue (#7)

* Reworked Hyperplanning backend (#8)

* Reworked Hyperplanning backend

* Removed unused code and unused files.

* Removed unused code + fixes for images

* Thème de noel (#9)

* Want maintainer ;(

* Fixed EDT for empty rooms (#11)

* CI/CD rework to drop netlify (#12)

* Create main.yml

* Added preview script, corrected main script name

* Updated preview script to ditch Github CLI

* removing line that caused the script to crash

* Added small test to ensure we are pulling the right thing. Will be removed during the next commit.

* Pulled the right thing, removing test. Added files for podman

* Corrected auto deploy script

* Renamed dockerfile

* Correcting dockerfile

* Added root url to support reverse proxy custom paths

* Added forgotten commas

* Test for images

* Test to import images as ES modules. Switched the proxy from nuxt to the reverse proxy (Caddy)

* Test image import from bg

* Corrected image paths

* Added cleanup steps

* Removed sudo because sudo is not needed and user is not sudoer.

* Corrected proxying for hyperplanning

* Replaced every image link with a valid one.
Removed every files linked to netlify, attempt to fix menus.

* Added logo for new year

* Attempt to fix plannings. Fixed bad image link

* Corrected link to build

* Same as last commit but just because of one capital letter >:(

* Attempt to correct plannings and allow the code to compile

* Added failing condition to deploys

* Test to see if what i am trying to correct is really the problem :/

* 2nd test that SHOULD pass

* NO >:( Driving me crazy

* Tried to switch the page to client side

* Testing with everything on server side

* May have found the problem. Sending test fix

* Import fix

* Correction attempt for planning url

* Test to see everything working (or not)

* Test for menus

* Test fixes for HP and menus

* missing async fix

* Multiple fixes in crous menus.

* Fully repaired menus.

* Fixed plannings. Things should be ready to merge. Code unhacked.

* Update deploy-preview.yml

* Corrected service name

* Changed icals for some classes because they finished their semester (#13)

* Added shadcn for vue and tailwindcss

* Made login page frontend

* Commit before pc reset

* Responsive design for admin panel

* Better responsive

* Added ui/ux elements

* Added automatic change detection and made detection for unwanted meals more stict

* Made partial doc for API

* Added swagger ui

* Database schema

* Pre no GSM area commit

* Added forgotten files

* Made most of the CRUD logic

* Started to switch to the dotenv lib to read env vars.

* Made all methods in jwt.js

* Removed potential hash leak from getUsers function

* Switched to JOSE for JWT. //TODO: FIX JWT CHECK

* Added exemple.env

* Fixed authenticated access problems

* Made events route (UNTESTED)'

* Disabled slides are from now on really disabled

* The slides are now staying the time defined in the database.

* Added setup script

* Added all information viewing for PC

* Added UI components

* Corrected date formatting

* Some fixes

* Added cache update for event, created all function needed for events to be added, modified or deleted. Only event deletion is linked to the GUI.

* Split admin panel into different components in order to be maintainable

* Done event editing. //TODO: Fix CRUD OP in DB and set modification field default values to the current event value

* Added missing UI Elements

* Date field modifying the display of an already existing event are now default to the database values.

* Updated icals for S2

* Readded the file

* Included volumes for .env files in compose.yaml

* Fixed building

* Fixed event editing

* Tried to fix container bootloop

* Added some alpine packages required for prisma to work.

* Removed cleanup steps as they are not necessary since the storage driver switch on the remote server.

* Switched to pnpm to try having a more efficient package install
  • Loading branch information
Xabi08YT authored Feb 2, 2025
1 parent b409982 commit 8a669e9
Show file tree
Hide file tree
Showing 114 changed files with 10,558 additions and 2,964 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/deploy-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,3 @@ jobs:
podman-compose down
echo "Bringing up new containers with the latest released code..."
podman-compose up -d
echo "Cleaning up..."
podman image ls -a | grep '<none>' | awk '{print $3}' | xargs podman rmi -f
5 changes: 0 additions & 5 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
script: |
echo "Removing previous preview data..."
rm -rf preview-info
podman image rm
echo "Cloning preview..."
git clone https://github.com/Xabi08YT/iut-onboarding.git preview-info
echo "Using correct folder..."
Expand All @@ -35,8 +34,6 @@ jobs:
echo "Building container image..."
podman build -t onboarding-info-preview:latest .
if [[ $? -ne 0 ]] ; then
echo "Failed, Cleaning up..."
podman image ls -a | grep '<none>' | awk '{print $3}' | xargs podman rmi -f
exit 1
fi
echo "Using preview podman configs..."
Expand All @@ -45,5 +42,3 @@ jobs:
podman-compose down
echo "Bringing up new preview..."
podman-compose up -d
echo "Cleaning up..."
podman image ls -a | grep '<none>' | awk '{print $3}' | xargs podman rmi -f
4 changes: 3 additions & 1 deletion .previewConfigs/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ services:
restart: unless-stopped
networks:
proxy:
ipv4_address: 10.89.1.151
ipv4_address: 10.89.1.151
volumes:
- "~/infoPreview.env:/server/.env"
61 changes: 43 additions & 18 deletions .previewConfigs/devnuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,54 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default {
compatibilityDate: '2024-04-03',
compatibilityDate: "2024-04-03",
devtools: { enabled: true },
modules: ['@nuxtjs/google-fonts'],

modules: [
"@nuxtjs/google-fonts",
"@nuxtjs/tailwindcss",
"shadcn-nuxt",
"nuxt-lucide-icons",
],

lucide: {
namePrefix: "Lucide"
},

css: ["./stylesheets/global.css"],

app: {
baseURL: '/preview/info/'
baseURL: "/preview/info/"
},

googleFonts: {
display: 'swap',
outputDir: 'assets/fonts/',
families: {
Fredoka: {
wght: ["75..125",500]
},
Poppins: {
wght: 300
display: "swap",
outputDir: "assets/fonts/",
families: {
Fredoka: {
wght: ["75..125",500]
},
Poppins: {
wght: 300
}
}
}
},

routeRules: {
"/api/hp/**": {
proxy: "https://hyperplanning.iut.u-bordeaux.fr/Telechargements/ical/**"
}
"api/hp/**": {
proxy: "https://hyperplanning.iut.u-bordeaux.fr/Telechargements/ical/**"
},
// Add cors headers
"/api/v1/**": { cors: true },
},

shadcn: {
/**
* Prefix for all the imported component
*/
prefix: "",
/**
* Directory that the component lives in.
* @default "./components/ui"
*/
componentDir: "./components/ui"
}
};
};
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM docker.io/node:20-alpine
WORKDIR /server
COPY . /server
RUN npm ci
RUN npm run build
CMD node .output/server/index.mjs
RUN apk update && apk add openssl musl zlib libgcc
RUN npm i -g pnpm
RUN pnpm install
RUN pnpm run build
CMD ["sh","setup.sh"]
32 changes: 0 additions & 32 deletions api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import ICAL from "ical.js";
import { useFetch } from "nuxt/app";

const TBM_URL = "https://gateway-apim.infotbm.com/maas-web/web/v1/timetables/stops/stop_area:";
const WEATHER_URL_NEXT_12_HOURS =
"https://api.weatherapi.com/v1/forecast.json?key=72687f6b06f94afa9f7103056220603&q=Gradignan&aqi=no&lang=fr&hour=";
Expand Down Expand Up @@ -78,32 +75,3 @@ export const getTBMLineWaitInterval = async (stopId, lineId) => {
throw `Erreur de récupération des wait interval TBM (ligne: ${lineId}, arrêt: ${stopId}) : ${e}`;
}
};

const transformDesc = (desc) => {
if(desc.length === 0) {
return ;
}
let stage1 = desc.replaceAll("<br/>",";");
let stage2 = stage1.split(";");
let stage3 = [];
for(let i of stage2) {
stage3.push(i.split(":"));
}

let stage4 = {};
for(let t of stage3) {
let key = t[0];
key = key.replaceAll("é","e");
key = key.replaceAll(" ","");
key = key.replaceAll("è","e");
stage4[key] = t[1];
}

if(stage4.Salle !== undefined) {
stage4.Salle = stage4.Salle.split(" ")[1];
} else {
stage4.Salle = "";
}

return stage4;
};
Binary file added assets/bg.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://shadcn-vue.com/schema.json",
"style": "default",
"typescript": true,
"tsConfigPath": ".nuxt/tsconfig.json",
"tailwind": {
"config": "tailwind.config.js",
"css": "stylesheets/global.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"framework": "nuxt",
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
2 changes: 1 addition & 1 deletion components/DateHourHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div id="header">
<p>{{ currentDate }}</p>
<p>{{ currentTime }}</p>
<img style="width: 150px; margin-left: 150px;" src="/assets/logo_iut_nouvelan.png" />
<img style="width: 150px; margin-left: 150px;" src="/assets/logo_iut.png" />
</div>
</template>

Expand Down
9 changes: 5 additions & 4 deletions components/PlanningCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</div>
<div v-else style="opacity: 0.5" class="data-container">
<div class="subject-info">
<img style="width: 35%;" :src="noClassLogo" />
<img style="width: 35%; margin-left: 33.5%" :src="noClassLogo" />
<p>Pas cours</p>
</div>
</div>
Expand Down Expand Up @@ -160,7 +160,6 @@ export default {
display: flex;
flex-direction: column;
align-items: space-evenly;
justify-content: space-evenly;
}
Expand All @@ -173,16 +172,18 @@ export default {
display: flex;
justify-content: center;
flex-wrap: wrap;
text-align: center;
}
.subject-infos > p {
margin-right: 10px;
margin-left: 10px;
line-height: 40px;
max-width: 75%;
}
.subject-infos > p {
max-width: 75%;
.subject-infos > img {
justify-self: center;
}
.room {
Expand Down
4 changes: 2 additions & 2 deletions components/TransitionOverlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</template>

<script>
import logoIUT from "../public/assets/logo_iut_nouvelan_NOTEXT.png";
import logoGP from "../public/assets/gitpoule.png"
import logoIUT from "../public/assets/logo_iut.png";
import logoGP from "../public/assets/gitpoule.png";
export default {
data() {
Expand Down
26 changes: 26 additions & 0 deletions components/ui/button/Button.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'
import { Primitive, type PrimitiveProps } from 'radix-vue'
import { type ButtonVariants, buttonVariants } from '.'
interface Props extends PrimitiveProps {
variant?: ButtonVariants['variant']
size?: ButtonVariants['size']
class?: HTMLAttributes['class']
}
const props = withDefaults(defineProps<Props>(), {
as: 'button',
})
</script>

<template>
<Primitive
:as="as"
:as-child="asChild"
:class="cn(buttonVariants({ variant, size }), props.class)"
>
<slot />
</Primitive>
</template>
35 changes: 35 additions & 0 deletions components/ui/button/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { cva, type VariantProps } from 'class-variance-authority'

export { default as Button } from './Button.vue'

export const buttonVariants = cva(
'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
{
variants: {
variant: {
default:
'bg-primary text-primary-foreground shadow hover:bg-primary/90',
destructive:
'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',
outline:
'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground',
secondary:
'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80',
ghost: 'hover:bg-accent hover:text-accent-foreground',
link: 'text-primary underline-offset-4 hover:underline',
},
size: {
default: 'h-9 px-4 py-2',
sm: 'h-8 rounded-md px-3 text-xs',
lg: 'h-10 rounded-md px-8',
icon: 'h-9 w-9',
},
},
defaultVariants: {
variant: 'default',
size: 'default',
},
},
)

export type ButtonVariants = VariantProps<typeof buttonVariants>
21 changes: 21 additions & 0 deletions components/ui/card/Card.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'
const props = defineProps<{
class?: HTMLAttributes['class']
}>()
</script>

<template>
<div
:class="
cn(
'rounded-lg border bg-card text-card-foreground shadow-sm',
props.class,
)
"
>
<slot />
</div>
</template>
14 changes: 14 additions & 0 deletions components/ui/card/CardContent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'
const props = defineProps<{
class?: HTMLAttributes['class']
}>()
</script>

<template>
<div :class="cn('p-6 pt-0', props.class)">
<slot />
</div>
</template>
14 changes: 14 additions & 0 deletions components/ui/card/CardDescription.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'
const props = defineProps<{
class?: HTMLAttributes['class']
}>()
</script>

<template>
<p :class="cn('text-sm text-muted-foreground', props.class)">
<slot />
</p>
</template>
14 changes: 14 additions & 0 deletions components/ui/card/CardFooter.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'
const props = defineProps<{
class?: HTMLAttributes['class']
}>()
</script>

<template>
<div :class="cn('flex items-center p-6 pt-0', props.class)">
<slot />
</div>
</template>
14 changes: 14 additions & 0 deletions components/ui/card/CardHeader.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'
const props = defineProps<{
class?: HTMLAttributes['class']
}>()
</script>

<template>
<div :class="cn('flex flex-col gap-y-1.5 p-6', props.class)">
<slot />
</div>
</template>
Loading

0 comments on commit 8a669e9

Please sign in to comment.