From f5ff51f7a8b97e7b0271706a3ef4f0eae515cff1 Mon Sep 17 00:00:00 2001 From: Ankhbayasgalan Davaadorj <31855776+anhbaysgalan1@users.noreply.github.com> Date: Mon, 20 Nov 2023 05:03:16 +0800 Subject: [PATCH 1/2] Get detailed wallet info screen empty balance issue fix --- app/routes/wallets/$walletId.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/routes/wallets/$walletId.tsx b/app/routes/wallets/$walletId.tsx index f5b32286..eae8def5 100644 --- a/app/routes/wallets/$walletId.tsx +++ b/app/routes/wallets/$walletId.tsx @@ -112,14 +112,14 @@ export const loader: LoaderFunction = async ({ request, params }) => { `${API_WALLET}/wallets/${params.walletId}/balances/${balance.name}`, 'data' ); - if (detailedBalance) { + if (detailedBalance && detailedBalance.assets) { let a = ''; - Object.keys(detailedBalance.assets).forEach((key: string) => { - a = `${a}${key} ${detailedBalance.assets[key]} `; + Object.keys(detailedBalance.assets).forEach((key) => { + a = `${a}${key} ${detailedBalance.assets[key]} `; }); - + balances.push({ ...detailedBalance, formattedAssets: a }); - } + } } return { From 0b22120021225dbf9f63372258e9d31a34aedf12 Mon Sep 17 00:00:00 2001 From: Ankhbayasgalan Davaadorj <31855776+anhbaysgalan1@users.noreply.github.com> Date: Mon, 20 Nov 2023 06:01:24 +0800 Subject: [PATCH 2/2] fix --- .github/workflows/build_branch.yml | 42 --------- .github/workflows/codeql.yml | 33 -------- .github/workflows/docker-build-push.yml | 24 ++++++ .github/workflows/main.yml | 108 ------------------------ Dockerfile | 8 +- 5 files changed, 28 insertions(+), 187 deletions(-) delete mode 100644 .github/workflows/build_branch.yml delete mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/docker-build-push.yml delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/build_branch.yml b/.github/workflows/build_branch.yml deleted file mode 100644 index d60258d5..00000000 --- a/.github/workflows/build_branch.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Build special named branch -on: - push: - branches: - - 'features/**' - - 'feature/**' - - 'feat/**' - - 'fix/**' - - 'hotfix/**' -jobs: - BuildDockerImage: - name: 'Build & Publish Docker' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: 'NumaryBot' - password: ${{ secrets.NUMARY_GITHUB_TOKEN }} - - uses: actions/setup-node@v3 - with: - node-version: 16 - cache: 'yarn' - - run: yarn install - - run: yarn build - - name: Build and push - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - target: app - tags: ghcr.io/formancehq/control:${{ github.sha }} - build-args: | - APP_SHA=${{ github.sha }} - VERSION=${{ github.sha }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index a46ece9f..00000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: 'CodeQL' - -on: - push: - branches: [main] - pull_request: - branches: [main] - schedule: - - cron: '35 21 * * 5' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - strategy: - fail-fast: false - matrix: - language: ['javascript'] - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml new file mode 100644 index 00000000..cd186246 --- /dev/null +++ b/.github/workflows/docker-build-push.yml @@ -0,0 +1,24 @@ +name: Build and Push Docker Image +on: + push: + branches: + - main # Change this to your main branch name + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Login to Docker Hub + run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + env: + VERSION: v1.0.0 # Replace with your desired version + run: | + docker build -t your-dockerhub-username/your-image-name:${{ env.VERSION }} . + docker push your-dockerhub-username/your-image-name:${{ env.VERSION }} + diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 535112f2..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,108 +0,0 @@ -on: - push: - branches: - - main - pull_request: - types: [assigned, opened, synchronize, reopened] - release: - types: [prereleased, released] - -name: Main -jobs: - Pr: - if: github.event_name == 'pull_request' - uses: formancehq/gh-workflows/.github/workflows/pr-style.yml@main - - Lint: - name: 'Lint' - runs-on: 'ubuntu-latest' - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 16 - cache: 'yarn' - - run: yarn install - - run: yarn run lint - - # Todo: Add Test - # Test: - # uses: formancehq/gh-workflows/.github/workflows/golang-test.yml@main - - Docker: - name: 'Build Docker' - runs-on: ubuntu-latest - needs: - - Lint - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 16 - cache: 'yarn' - - run: yarn install - - run: yarn build - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: 'NumaryBot' - password: ${{ secrets.NUMARY_GITHUB_TOKEN }} - - name: Build and push Released - if: github.event.action == 'released' - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/amd64,linux/arm64 - target: app - push: true - tags: ghcr.io/formancehq/control:latest,ghcr.io/formancehq/control:${{ github.event.release.tag_name }} - build-args: | - APP_SHA=${{ github.sha }} - VERSION=${{ github.event.release.tag_name }} - - name: Build and push PreReleased - if: github.event.action == 'prereleased' - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/amd64,linux/arm64 - target: app - push: true - tags: ghcr.io/formancehq/control:${{ github.event.release.tag_name }} - build-args: | - APP_SHA=${{ github.sha }} - VERSION=${{ github.event.release.tag_name }} - - name: Build and push - if: github.event.action != 'released' || github.event.action != 'prereleased' - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/amd64,linux/arm64 - target: app - push: true - tags: ghcr.io/formancehq/control:${{ github.sha }} - build-args: | - APP_SHA=${{ github.sha }} - VERSION=develop - - Assets: - name: "Push Assets to S3" - runs-on: ubuntu-latest - permissions: - id-token: write - contents: read - if: github.event.action == 'released' - steps: - - uses: actions/checkout@v3 - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - role-to-assume: arn:aws:iam::288350113309:role/github-access - aws-region: us-east-1 - - name: Copy files to the bucket with the AWS CLI - run: | - aws s3 sync . s3://production-us-east-1-assets/control/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6b1cad28..90e2b356 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,15 @@ -FROM node:16 as deps +FROM node:18 as deps WORKDIR /app COPY ./package.json ./ RUN yarn install -FROM node:16 as build +FROM node:18 as build WORKDIR /app COPY --from=deps /app/node_modules /app/node_modules COPY . . RUN yarn run build -FROM node:16-slim +FROM node:18-slim WORKDIR /app ENV NODE_ENV=production COPY --from=deps /app/node_modules /app/node_modules @@ -18,7 +18,7 @@ COPY --from=build /app/public /app/public ADD . . CMD ["yarn", "run", "start"] -FROM node:16-slim as app +FROM node:18-slim as app WORKDIR /app ENV NODE_ENV=production ARG VERSION