Skip to content

Commit

Permalink
fix: resolve conflicts between main and current branch
Browse files Browse the repository at this point in the history
  • Loading branch information
HoreKk committed May 29, 2024
2 parents 27ff301 + a5723b5 commit ce883d7
Show file tree
Hide file tree
Showing 19 changed files with 2,359 additions and 1,330 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ jobs:
files-changed-kibana: ${{ steps.set-output.outputs.files-changed-kibana }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Get changed files in docker for elasticsearch
id: check-files-elasticsearch
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v44
with:
files: docker/elasticsearch

- name: Get changed files in docker for kibana
id: check-files-kibana
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v44
with:
files: docker/kibana

Expand All @@ -42,17 +42,17 @@ jobs:

steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:docker/elasticsearch"
push: true
Expand All @@ -65,17 +65,17 @@ jobs:

steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:docker/kibana"
push: true
Expand All @@ -86,17 +86,17 @@ jobs:

steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:webapp-next"
push: true
Expand Down
6 changes: 3 additions & 3 deletions webapp-next/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
##### DEPENDENCIES

FROM node:16-alpine3.17 AS deps
FROM node:18-alpine3.18 AS deps
RUN apk add --no-cache libc6-compat openssl1.1-compat
WORKDIR /app

Expand All @@ -16,7 +16,7 @@ RUN \

##### BUILDER

FROM node:16-alpine3.17 AS builder
FROM node:18-alpine3.18 AS builder

ARG ELASTIC_HOST
ARG ELASTIC_PASSWORD
Expand All @@ -41,7 +41,7 @@ RUN \

##### RUNNER

FROM node:16-alpine3.17 AS runner
FROM node:18-alpine3.18 AS runner
WORKDIR /app

ENV NODE_ENV production
Expand Down
44 changes: 44 additions & 0 deletions webapp-next/components/chakra/Alert.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { AlertProps, createMultiStyleConfigHelpers } from "@chakra-ui/react";
import { alertAnatomy } from "@chakra-ui/anatomy";

const { definePartsStyle, defineMultiStyleConfig } =
createMultiStyleConfigHelpers(alertAnatomy.keys);

const baseStyle = definePartsStyle((props: AlertProps) => {
const { status } = props;

const base = {
container: {
borderRadius: "lg",
},
description: {
fontWeight: 500,
},
};

const statusBases = {
success: base,
info: base,
warning: {
container: {
borderRadius: "lg",
bg: "highlight.50",
color: "orange.500",
},
icon: {
bg: "highlight.50",
color: "highlight.500",
},
description: {
fontWeight: 500,
},
},
error: base,
};

const baseStyle = statusBases[status as keyof typeof statusBases];

return baseStyle;
});

export const alertTheme = defineMultiStyleConfig({ baseStyle });
2 changes: 1 addition & 1 deletion webapp-next/components/filters/Dates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Cm2dContext } from '@/utils/cm2d-provider';
import { getLastDayOfMonth } from '@/utils/tools';
import { useContext, useEffect, useRef, useState } from 'react';
import DatePicker, { registerLocale } from 'react-datepicker';
import fr from 'date-fns/locale/fr';
import { fr } from 'date-fns/locale';
import 'react-datepicker/dist/react-datepicker.css';

registerLocale('fr', fr);
Expand Down
5 changes: 2 additions & 3 deletions webapp-next/components/layouts/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ import { UserCard } from './UserCard';
import { FilterDates } from '../filters/Dates';
import { FiltersDepartments } from '../filters/Departments';
import cookie from 'js-cookie';
import { hasAtLeastOneFilter, ELASTIC_API_KEY_NAME } from '@/utils/tools';
import { hasAtLeastOneFilter, ELASTIC_API_KEY_NAME, swrPOSTFetch } from '@/utils/tools';
import { FilterAssociateCauses } from '../filters/AssociateCauses';
import { RegionFilter } from '../filters/Regions';
import { auth } from '../login/FormLogin';
import useSWRMutation from 'swr/mutation';

export const ageRanges = [
Expand All @@ -40,7 +39,7 @@ export function Menu() {

const { trigger: triggerInvalidateApiKey } = useSWRMutation(
"/api/auth/invalidate-api-key",
auth<{ username: string }>
swrPOSTFetch<{ username: string }>
);

const { filters, setFilters, user } = context;
Expand Down
117 changes: 117 additions & 0 deletions webapp-next/components/login/FormForgotPassword.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import { swrPOSTFetch } from "@/utils/tools";
import { CheckCircleIcon } from "@chakra-ui/icons";
import {
Box,
Button,
Divider,
FormControl,
FormErrorMessage,
FormLabel,
Heading,
Image,
Input,
InputGroup,
InputLeftElement,
Link,
Text,
} from "@chakra-ui/react";
import NextLink from "next/link";
import { useForm, type SubmitHandler } from "react-hook-form";
import useSWRMutation from "swr/mutation";
import { WrapperForm } from "./WrapperForm";

type FormForgotPassword = {
username: string;
};

export const FormForgotPassword = () => {
const { trigger: triggerForgotPassword, isMutating } = useSWRMutation(
"/api/auth/forgot-password",
swrPOSTFetch<{ username: string }>
);

const {
handleSubmit,
register,
formState: { errors, isSubmitting, isSubmitSuccessful },
} = useForm<FormForgotPassword>();

const onSubmit: SubmitHandler<FormForgotPassword> = ({ username }) => {
triggerForgotPassword({ username });
};

const displayForm = () => {
return (
<form onSubmit={handleSubmit(onSubmit)}>
<FormControl mb={[4, 6]} isInvalid={!!errors.username}>
<FormLabel
htmlFor="username"
fontSize={["2xs", "xs"]}
fontWeight={500}
>
Identifiant
</FormLabel>
<InputGroup>
<InputLeftElement pointerEvents="none">
<Image
src={"/icons/user.svg"}
alt="User Icon"
boxSize={9}
pt={2}
/>
</InputLeftElement>
<Input
type="text"
id="username"
autoFocus
placeholder="Saisissez votre adresse email"
fontSize="xs"
bg={"secondary.500"}
{...register("username", {
required: "Ce champ est obligatoire",
})}
/>
</InputGroup>
</FormControl>
<FormErrorMessage>
{errors.username && errors.username.message}
</FormErrorMessage>
<Button
type="submit"
isLoading={isSubmitting || isMutating}
colorScheme="primary"
loadingText="..."
color="white"
w="full"
fontSize={["md", "lg", "xl"]}
fontWeight={600}
>
Réinitialiser le mot de passe
</Button>
</form>
);
};

const displaySubmitSuccess = () => {
return (
<Text fontSize={["sm", "md"]} color="neutral.500">
<CheckCircleIcon w={5} h={5} mb={1} color="green.500" /> Un email de
réinitialisation de mot de passe a été envoyé à
<br />
l'adresse email associée à votre compte.
</Text>
);
};

return (
<WrapperForm title="Mot de passe oublié">
<Box>{isSubmitSuccessful ? displaySubmitSuccess() : displayForm()}</Box>
<Divider my={4} />
<Text fontSize={["xs", "sm"]} color="neutral.500">
<Link as={NextLink} href="/login">
Retour à la connexion
</Link>
</Text>
</WrapperForm>
);
};
Loading

0 comments on commit ce883d7

Please sign in to comment.