From 89f4cd20673af44add4adca95aa853e82d81fbf5 Mon Sep 17 00:00:00 2001 From: Manuel Ruck Date: Sun, 29 Oct 2023 16:25:33 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=E2=9C=A8=20let=20bundestag.io=20admin?= =?UTF-8?q?=20work=20again=20:)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Ruck --- .../workflows/deploy-bundestag.io-admin.yaml | 55 - .github/workflows/pull_request.yaml | 1 + bundestag.io/admin/.eslintrc | 3 +- bundestag.io/admin/Dockerfile | 41 - bundestag.io/admin/components/App.tsx | 7 +- .../admin/components/Form/DatePicker.tsx | 14 +- bundestag.io/admin/components/Form/Input.tsx | 10 +- .../admin/components/Form/InputNumber.tsx | 10 +- .../admin/components/Layout/index.tsx | 22 +- bundestag.io/admin/components/Navigation.tsx | 29 +- .../admin/components/Procedures/List.tsx | 18 +- .../components/Procedures/PlenarText.tsx | 40 +- .../Procedures/VoteResultTextHelper.tsx | 22 +- .../components/Procedures/VoteResultsForm.tsx | 117 +- .../Procedures/VoteResultsFormNamedPoll.tsx | 38 +- .../admin/graphql/fragments/voteResults.js | 2 +- .../queries/{periods.js => periods.ts} | 4 +- .../queries/{procedure.tsx => procedure.ts} | 4 +- .../{procedureList.tsx => procedureList.ts} | 0 .../queries/{voteTexts.tsx => voteTexts.ts} | 2 +- bundestag.io/admin/lib/apolloClient.tsx | 48 +- bundestag.io/admin/lib/axios.ts | 8 + bundestag.io/admin/next-env.d.ts | 4 +- bundestag.io/admin/next.config.babel.ts | 7 - bundestag.io/admin/next.config.js | 8 +- bundestag.io/admin/package.json | 35 +- bundestag.io/admin/pages/_app.tsx | 22 +- bundestag.io/admin/pages/_document.tsx | 7 +- .../admin/pages/api/auth/[...nextauth].ts | 30 +- bundestag.io/admin/pages/api/graphql/index.ts | 19 +- .../admin/pages/api/health-check/index.ts | 4 +- .../admin/pages/api/procedures/save.ts | 34 +- bundestag.io/admin/pages/index.tsx | 4 +- bundestag.io/admin/pages/procedure/[id].tsx | 82 +- bundestag.io/admin/pages/procedures.tsx | 6 +- bundestag.io/admin/tsconfig.json | 19 +- infra/Dockerfile.service | 1 + pnpm-lock.yaml | 3497 ++++++----------- pnpm-workspace.yaml | 2 +- 39 files changed, 1526 insertions(+), 2750 deletions(-) delete mode 100644 .github/workflows/deploy-bundestag.io-admin.yaml delete mode 100644 bundestag.io/admin/Dockerfile rename bundestag.io/admin/graphql/queries/{periods.js => periods.ts} (58%) rename bundestag.io/admin/graphql/queries/{procedure.tsx => procedure.ts} (85%) rename bundestag.io/admin/graphql/queries/{procedureList.tsx => procedureList.ts} (100%) rename bundestag.io/admin/graphql/queries/{voteTexts.tsx => voteTexts.ts} (83%) create mode 100644 bundestag.io/admin/lib/axios.ts delete mode 100644 bundestag.io/admin/next.config.babel.ts diff --git a/.github/workflows/deploy-bundestag.io-admin.yaml b/.github/workflows/deploy-bundestag.io-admin.yaml deleted file mode 100644 index baf2cbe0f..000000000 --- a/.github/workflows/deploy-bundestag.io-admin.yaml +++ /dev/null @@ -1,55 +0,0 @@ -name: bundestag.io-admin/ Build and Push Docker Image - -on: - workflow_dispatch: - push: - paths: - - 'bundestag.io/admin/**' - branches: - - 'master' - tags: - - 'bundestag.io-admin@v*' - pull_request: - paths: - - 'bundestag.io/admin/**' - branches: - - 'master' - -jobs: - push: - runs-on: ubuntu-latest - environment: docker - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: democracy/bundestag.io-admin - tags: | - type=ref,event=branch,enable=${{ github.ref == format('refs/heads/{0}', 'master') || github.ref == format('refs/heads/{0}', 'alpha') || github.ref == format('refs/heads/{0}', 'internal') }} - type=ref,event=pr - type=match,asref=foo,pattern=crawler@v(\d+.\d+.\d+)(-alpha.\d+)?,group=1 - type=semver,pattern={{version}},use=foo - type=sha,enable=${{ github.event_name == 'workflow_dispatch' }} - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Login to DockerHub - uses: docker/login-action@v1 - if: github.event_name != 'pull_request' - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - context: bundestag.io/admin - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index f654d686d..4bdb847c0 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -4,6 +4,7 @@ on: pull_request: paths: - 'services/**' + - 'bundestag.io/**' branches: - 'master' diff --git a/bundestag.io/admin/.eslintrc b/bundestag.io/admin/.eslintrc index f52fd2cdd..cdb766c09 100644 --- a/bundestag.io/admin/.eslintrc +++ b/bundestag.io/admin/.eslintrc @@ -1,6 +1,7 @@ { "extends": ["next", "next/core-web-vitals"], "rules": { - "react/display-name": 0 + "react/display-name": 0, + "@typescript-eslint/no-explicit-any": ["warn"] } } diff --git a/bundestag.io/admin/Dockerfile b/bundestag.io/admin/Dockerfile deleted file mode 100644 index e27450d7e..000000000 --- a/bundestag.io/admin/Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -# Install dependencies only when needed -FROM node:16-alpine 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 yarn.lock ./ -RUN yarn install --frozen-lockfile - -# Rebuild the source code only when needed -FROM node:16-alpine AS builder -WORKDIR /app -COPY . . -COPY --from=deps /app/node_modules ./node_modules -RUN yarn build && yarn install --production --ignore-scripts --prefer-offline - -# Production image, copy all the files and run next -FROM node:16-alpine AS runner -WORKDIR /app - -ENV NODE_ENV production - -RUN addgroup -g 1001 -S nodejs -RUN adduser -S nextjs -u 1001 - -# 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 - -USER nextjs - -EXPOSE 3000 - -# 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 ["yarn", "start"] \ No newline at end of file diff --git a/bundestag.io/admin/components/App.tsx b/bundestag.io/admin/components/App.tsx index 073260597..9dde7a26b 100644 --- a/bundestag.io/admin/components/App.tsx +++ b/bundestag.io/admin/components/App.tsx @@ -1,11 +1,10 @@ const App = ({ children }) => (
{children} -