Browse Source

Merge pull request #3273 from nocodb/chore/docker-build

feat(gui-v2): Github Action v2
pull/3312/head
navi 2 years ago committed by GitHub
parent
commit
4c581af86a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 144
      .github/workflows/release-docker-v2.yml
  2. 93
      .github/workflows/release-npm-v2.yml
  3. 126
      .github/workflows/release-pr-v2.yml
  4. 6
      packages/nc-gui-v2/components/dlg/AirtableImport.vue
  5. 30
      packages/nc-gui-v2/components/general/Share.vue
  6. 2
      packages/nc-gui-v2/components/general/Sponsors.vue
  7. 6
      packages/nc-gui-v2/composables/useApi/index.ts
  8. 2
      packages/nc-gui-v2/composables/useGlobal/state.ts
  9. 8
      packages/nc-gui-v2/nuxt.config.ts
  10. 96
      packages/nc-gui-v2/package-lock.json
  11. 5
      packages/nc-gui-v2/package.json
  12. 7
      packages/nc-gui-v2/plugins/tele.ts
  13. 2
      packages/nc-gui/components/ProjectTreeView.vue
  14. 2
      packages/nc-gui/pages/nc/base/_shared_base_id.vue
  15. 11
      packages/nc-lib-gui-v2/.gitignore
  16. 5
      packages/nc-lib-gui-v2/README.md
  17. 30
      packages/nc-lib-gui-v2/__tests__/xc-tool-web.test.js
  18. 45
      packages/nc-lib-gui-v2/lib/XcLibGui.js
  19. 22
      packages/nc-lib-gui-v2/license.txt
  20. 1113
      packages/nc-lib-gui-v2/package-lock.json
  21. 37
      packages/nc-lib-gui-v2/package.json
  22. 2
      packages/nocodb-sdk/package.json
  23. 3
      packages/nocodb/Dockerfile
  24. 28
      packages/nocodb/package-lock.json
  25. 4
      packages/nocodb/package.json
  26. 13
      packages/nocodb/src/lib/Noco.ts
  27. 2
      packages/nocodb/src/lib/models/Column.ts
  28. 2
      packages/nocodb/tests/export-import/exportSchema.js
  29. 2
      packages/nocodb/tests/export-import/importSchema.js
  30. 16
      scripts/bumpNcGuiVersion.js
  31. 2
      scripts/bumpNocodbSdkVersion.js
  32. 49
      scripts/upgradeNcGui2.js
  33. 76
      scripts/upgradeNocodbSdk2.js

144
.github/workflows/release-docker-v2.yml

@ -0,0 +1,144 @@
name: "Release : Docker (v2)"
on:
# Triggered manually
workflow_dispatch:
inputs:
tag:
description: "Docker image tag"
required: true
targetEnv:
description: "Target Environment"
required: true
type: choice
options:
- DEV
- PROD
# Triggered by release-nocodb.yml / release-nightly-dev.yml / release-pr.yml
workflow_call:
inputs:
tag:
description: "Docker image tag"
required: true
type: string
targetEnv:
description: "Target Environment"
required: true
type: string
isDaily:
description: "Is it triggered by daily schedule"
required: false
type: string
currentVersion:
description: "The current NocoDB version"
required: false
type: string
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
jobs:
buildx:
runs-on: ubuntu-latest
env:
working-directory: ./packages/nocodb
steps:
- name: Get Docker Repository
id: get-docker-repository
run: |
DOCKER_REPOSITORY=nocodb
DOCKER_BUILD_TAG=${{ github.event.inputs.tag || inputs.tag }}
if [[ ${{ github.event.inputs.targetEnv || inputs.targetEnv }} == 'DEV' ]]; then
if [[ ${{ github.event.inputs.currentVersion || inputs.currentVersion || 'N/A' }} != 'N/A' ]]; then
DOCKER_BUILD_TAG=${{ github.event.inputs.currentVersion || inputs.currentVersion }}-${{ github.event.inputs.tag || inputs.tag }}
fi
if [[ ${{ inputs.isDaily || 'N' }} == 'Y' ]]; then
DOCKER_REPOSITORY=${DOCKER_REPOSITORY}-daily
else
DOCKER_REPOSITORY=${DOCKER_REPOSITORY}-timely
fi
fi
echo "::set-output name=DOCKER_REPOSITORY::${DOCKER_REPOSITORY}"
echo "::set-output name=DOCKER_BUILD_TAG::${DOCKER_BUILD_TAG}"
echo ${DOCKER_REPOSITORY}
echo ${DOCKER_BUILD_TAG}
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: 16.15.0
- name: upgrade packages for nightly build or pr build
if: ${{ github.event.inputs.targetEnv == 'DEV' || inputs.targetEnv == 'DEV' }}
run: |
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js
cd packages/nocodb-sdk
npm install && npm run build
cd ../..
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk2.js &&
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNcGuiVersion.js &&
cd packages/nc-gui-v2
npm install
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy
cd ../..
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNcGui2.js
- uses: bahmutov/npm-install@v1
with:
working-directory: ${{ env.working-directory }}
- name: Build nocodb and docker files
run: |
npm run build
npm run docker:build
working-directory: ${{ env.working-directory }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: ${{ env.working-directory }}
build-args: NC_VERSION=${{ steps.get-docker-repository.outputs.DOCKER_BUILD_TAG }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
push: true
tags: |
nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:${{ steps.get-docker-repository.outputs.DOCKER_BUILD_TAG }}
nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:latest
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

93
.github/workflows/release-npm-v2.yml

@ -0,0 +1,93 @@
name: "Release : NPM packages (v2)"
on:
# Triggered manually
workflow_dispatch:
inputs:
tag:
description: "Tag"
required: true
targetEnv:
description: "Target Environment"
required: true
type: choice
options:
- DEV
- PROD
# Triggered by release-nocodb.yml / release-nightly-dev.yml / release-pr.yml
workflow_call:
inputs:
tag:
description: "Tag"
required: true
type: string
targetEnv:
description: "Target Environment"
required: true
type: string
secrets:
NPM_TOKEN:
required: true
# GITHUB_TOKEN:
# required: true
jobs:
release:
runs-on: ubuntu-latest
env:
working-directory: ./packages/nocodb
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: NPM Setup and Publish with 16.15.0
# Setup .npmrc file to publish to npm
uses: actions/setup-node@v2
with:
node-version: 16.15.0
registry-url: 'https://registry.npmjs.org'
- run: |
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js &&
cd packages/nocodb-sdk &&
npm ci && npm run build && npm publish &&
cd ../.. &&
sleep 60 &&
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk2.js &&
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNcGuiVersion.js &&
cd packages/nc-gui-v2 &&
npm ci &&
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy:publish &&
cd ../.. &&
sleep 60 &&
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNcGui2.js && cd packages/nocodb && npm install && npm run obfuscate:build:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Pull Request
if: ${{ github.event.inputs.targetEnv == 'PROD' || inputs.targetEnv == 'PROD' }}
id: cpr
uses: peter-evans/create-pull-request@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# commit-message: Update report
# committer: GitHub <noreply@github.com>
# author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: true
branch: 'release/${{ github.event.inputs.tag || inputs.tag }}'
delete-branch: true
title: 'Release ${{ github.event.inputs.tag || inputs.tag }}'
labels: 'Bot: Automerge'
- name: Check outputs
if: ${{ github.event.inputs.targetEnv == 'PROD' || inputs.targetEnv == 'PROD' }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: automerge
if: ${{ github.event.inputs.targetEnv == 'PROD' || inputs.targetEnv == 'PROD' }}
uses: "pascalgn/automerge-action@v0.14.3"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
PULL_REQUEST: "${{ steps.cpr.outputs.pull-request-number }}"
MERGE_LABELS: "Bot: Automerge"

126
.github/workflows/release-pr-v2.yml

@ -0,0 +1,126 @@
name: 'PR Release (v2)'
on:
pull_request:
# opened: pull request is created
# reopened: closed pull request is reopened
# synchronize: commit(s) pushed to the pull request
# ready_for_review: non PR release
types: [opened, reopened, synchronize, ready_for_review]
paths:
# - "packages/nocodb-sdk/**"
- "packages/nc-gui-v2/**"
# - "packages/nc-plugin/**"
# - "packages/nocodb/**"
jobs:
# enrich tag for pr release
set-tag:
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
runs-on: 'ubuntu-latest'
steps:
- name: set-tag
id: tag-step
run: |
# Get current date
CURRENT_DATE=$(date +"%Y%m%d")
CURRENT_TIME=$(date +"%H%M")
# Get current PR number
PR_NUMBER=${{github.event.number}}
# Get current version
CURRENT_VERSION=$(basename $(curl -fs -o/dev/null -w %{redirect_url} https://github.com/nocodb/nocodb/releases/latest))
# Construct tag name
TAG_NAME=pr-${PR_NUMBER}-${CURRENT_DATE}-${CURRENT_TIME}
echo "::set-output name=TARGET_TAG::${TAG_NAME}"
echo "::set-output name=CURRENT_VERSION::${CURRENT_VERSION}"
- name: verify-tag
run: |
echo ${{ steps.tag-step.outputs.TARGET_TAG }}
echo ${{ steps.tag-step.outputs.CURRENT_VERSION }}
outputs:
target_tag: ${{ steps.tag-step.outputs.TARGET_TAG }}
current_version: ${{ steps.tag-step.outputs.CURRENT_VERSION }}
# Build, install, publish frontend and backend to npm
release-npm:
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
needs: [set-tag]
uses: ./.github/workflows/release-npm-v2.yml
with:
tag: ${{ needs.set-tag.outputs.target_tag }}
targetEnv: 'DEV'
secrets:
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
# Build docker image and push to docker hub
release-docker:
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
needs: [release-npm, set-tag]
uses: ./.github/workflows/release-docker-v2.yml
with:
currentVersion: ${{ needs.set-tag.outputs.current_version }}
tag: ${{ needs.set-tag.outputs.target_tag }}
targetEnv: 'DEV'
isDaily: 'N'
secrets:
DOCKERHUB_USERNAME: "${{ secrets.DOCKERHUB_USERNAME }}"
DOCKERHUB_TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}"
# Build executables and publish to GitHub
# release-executables:
# if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
# needs: [set-tag, release-npm]
# uses: ./.github/workflows/release-timely-executables.yml
# with:
# tag: ${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}
# secrets:
# NC_GITHUB_TOKEN: "${{ secrets.NC_GITHUB_TOKEN }}"
# Add a comment for PR docker build
leave-comment:
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
runs-on: 'ubuntu-latest'
needs: [release-docker, set-tag]
steps:
- uses: peter-evans/commit-comment@v2
with:
body: |
The PR changes have been deployed. Please run the following command to verify:
```
docker run -d -p 8888:8080 nocodb/nocodb-timely:${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}
```
# Add a comment for PR executable build
# leave-executable-comment:
# if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
# runs-on: 'ubuntu-latest'
# needs: [release-executables, set-tag]
# steps:
# - uses: peter-evans/commit-comment@v2
# with:
# body: |
# ### Run Executables
# #### MacOS
# ```bash
# mkdir -p ./${{ needs.set-tag.outputs.current_version }}/${{ needs.set-tag.outputs.target_tag }} && cd "$_" \
# && curl http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-macos-arm64 -o noco -L \
# && chmod +x noco \
# && ./noco
# ```
# #### Linux
# ```bash
# mkdir -p ./${{ needs.set-tag.outputs.current_version }}/${{ needs.set-tag.outputs.target_tag }} && cd "$_" \
# && curl http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-linux-x64 -o noco -L \
# && chmod +x noco \
# && ./noco
# ```
# #### Windows
# ```bash
# iwp http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-win-arm64.exe
# .\Noco-win-arm64.exe
# ```
# For executables visit [here](https://github.com/nocodb/nocodb-timely/releases/tag/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }})

6
packages/nc-gui-v2/components/dlg/AirtableImport.vue

@ -11,6 +11,7 @@ import {
onBeforeUnmount, onBeforeUnmount,
onMounted, onMounted,
ref, ref,
useGlobal,
useNuxtApp, useNuxtApp,
useProject, useProject,
watch, watch,
@ -24,8 +25,9 @@ const { modelValue } = defineProps<Props>()
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
// TODO: handle baseURL const { appInfo } = $(useGlobal())
const baseURL = 'http://localhost:8080' // this.$axios.defaults.baseURL
const baseURL = appInfo.ncSiteUrl
const { $state } = useNuxtApp() const { $state } = useNuxtApp()

30
packages/nc-gui-v2/components/general/Share.vue

@ -52,7 +52,7 @@ const openUrl = (url: string) => {
@click.prevent="openUrl(`https://twitter.com/intent/tweet?url=${shareUrl}&text=${encodedSummary}&hashtags=${hashTags}`)" @click.prevent="openUrl(`https://twitter.com/intent/tweet?url=${shareUrl}&text=${encodedSummary}&hashtags=${hashTags}`)"
> >
<img <img
src="/social/twitter.png" src="~/public/social/twitter.png"
class="img-responsive" class="img-responsive"
alt="Twitter" alt="Twitter"
:width="width" :width="width"
@ -71,7 +71,7 @@ const openUrl = (url: string) => {
" "
> >
<img <img
src="/social/linkedin.png" src="~/public/social/linkedin.png"
class="img-responsive" class="img-responsive"
alt="Linkedin" alt="Linkedin"
:width="width" :width="width"
@ -92,7 +92,7 @@ const openUrl = (url: string) => {
" "
> >
<img <img
src="/social/facebook.png" src="~/public/social/facebook.png"
class="img-responsive" class="img-responsive"
alt="Facebook" alt="Facebook"
:width="width" :width="width"
@ -108,7 +108,7 @@ const openUrl = (url: string) => {
class="px-2" class="px-2"
@click.prevent="openUrl(`https://www.reddit.com/submit?url=${shareUrl}&title=${encodedSummary}`)" @click.prevent="openUrl(`https://www.reddit.com/submit?url=${shareUrl}&title=${encodedSummary}`)"
> >
<img src="/social/reddit.png" class="img-responsive" alt="Reddit" :width="width" :style="css" title="Social Media Share" /> <img src="~/public/social/reddit.png" class="img-responsive" alt="Reddit" :width="width" :style="css" title="Social Media Share" />
</a> </a>
<a <a
@ -119,7 +119,7 @@ const openUrl = (url: string) => {
@click.prevent="openUrl(`https://pinterest.com/pin/create/button/?url=${shareUrl}&description==${encodedSummary}`)" @click.prevent="openUrl(`https://pinterest.com/pin/create/button/?url=${shareUrl}&description==${encodedSummary}`)"
> >
<img <img
src="/social/pinterest.png" src="~/public/social/pinterest.png"
class="img-responsive" class="img-responsive"
alt="Printrest" alt="Printrest"
:width="width" :width="width"
@ -136,7 +136,7 @@ const openUrl = (url: string) => {
@click.prevent="openUrl(`https://api.whatsapp.com/send?text=${encodedSummary}%0D%0A${shareUrl}`)" @click.prevent="openUrl(`https://api.whatsapp.com/send?text=${encodedSummary}%0D%0A${shareUrl}`)"
> >
<img <img
src="/social/whatsapp.png" src="~/public/social/whatsapp.png"
class="img-responsive" class="img-responsive"
alt="Whatsapp" alt="Whatsapp"
:width="width" :width="width"
@ -152,7 +152,7 @@ const openUrl = (url: string) => {
@click.prevent="openUrl(`https://telegram.me/share/url?url=${shareUrl}&text=${encodedSummary}`)" @click.prevent="openUrl(`https://telegram.me/share/url?url=${shareUrl}&text=${encodedSummary}`)"
> >
<img <img
src="/social/png/telegram.png" src="~/public/social/png/telegram.png"
class="img-responsive" class="img-responsive"
alt="Telegram" alt="Telegram"
:width="width" :width="width"
@ -167,7 +167,7 @@ const openUrl = (url: string) => {
@click.prevent="openUrl(`https://www.addtoany.com/add_to/wechat?linkurl=${shareUrl}&linkname=${encodedTitle}`)" @click.prevent="openUrl(`https://www.addtoany.com/add_to/wechat?linkurl=${shareUrl}&linkname=${encodedTitle}`)"
> >
<img <img
src="/social/png/wechat.png" src="~/public/social/png/wechat.png"
class="img-responsive" class="img-responsive"
alt="Wechat" alt="Wechat"
:width="width" :width="width"
@ -177,7 +177,7 @@ const openUrl = (url: string) => {
</a> </a>
<a v-if="!socialMedias || !socialMedias.length || socialMedias.includes('line')" href="#" :class="iconClass" class="px-2"> <a v-if="!socialMedias || !socialMedias.length || socialMedias.includes('line')" href="#" :class="iconClass" class="px-2">
<img <img
src="/social/png/line.png" src="~/public/social/png/line.png"
class="img-responsive" class="img-responsive"
alt="Line" alt="Line"
:width="width" :width="width"
@ -193,7 +193,7 @@ const openUrl = (url: string) => {
class="px-2" class="px-2"
> >
<img <img
src="/social/png/odnoklassniki.png" src="~/public/social/png/odnoklassniki.png"
class="img-responsive" class="img-responsive"
alt="Odnoklassniki" alt="Odnoklassniki"
:width="width" :width="width"
@ -212,7 +212,7 @@ const openUrl = (url: string) => {
@click.prevent="openUrl(`http://service.weibo.com/share/share.php?url=${shareUrl})&title=${encodedTitle}`)" @click.prevent="openUrl(`http://service.weibo.com/share/share.php?url=${shareUrl})&title=${encodedTitle}`)"
> >
<img <img
src="/social/png/weibo.png" src="~/public/social/png/weibo.png"
class="img-responsive" class="img-responsive"
alt="Weibo" alt="Weibo"
:width="width" :width="width"
@ -231,7 +231,7 @@ const openUrl = (url: string) => {
" "
> >
<img <img
src="/social/png/renren.png" src="~/public/social/png/renren.png"
class="img-responsive" class="img-responsive"
alt="Renren" alt="Renren"
:width="width" :width="width"
@ -246,7 +246,7 @@ const openUrl = (url: string) => {
@click.prevent="openUrl(`http://www.douban.com/recommend/?url=${shareUrl}&title=${encodedTitle}`)" @click.prevent="openUrl(`http://www.douban.com/recommend/?url=${shareUrl}&title=${encodedTitle}`)"
> >
<img <img
src="/social/png/douban.png" src="~/public/social/png/douban.png"
class="img-responsive" class="img-responsive"
alt="Douban" alt="Douban"
:width="width" :width="width"
@ -263,7 +263,7 @@ const openUrl = (url: string) => {
openUrl(`https://vk.com/share.php?url=${shareUrl})&title=${encodedTitle}&description=${encodedSummary}&noparse=true`) openUrl(`https://vk.com/share.php?url=${shareUrl})&title=${encodedTitle}&description=${encodedSummary}&noparse=true`)
" "
> >
<img src="/social/png/vk.png" class="img-responsive" alt="VK" :width="width" :style="css" title="Social Media Share" /> <img src="~/public/social/png/vk.png" class="img-responsive" alt="VK" :width="width" :style="css" title="Social Media Share" />
</a> </a>
<a <a
v-if="!socialMedias || !socialMedias.length || socialMedias.includes('wykop')" v-if="!socialMedias || !socialMedias.length || socialMedias.includes('wykop')"
@ -272,7 +272,7 @@ const openUrl = (url: string) => {
@click.prevent="openUrl(`https://www.addtoany.com/add_to/wykop?linkurl=${shareUrl}&linkname=${encodedTitle}`)" @click.prevent="openUrl(`https://www.addtoany.com/add_to/wykop?linkurl=${shareUrl}&linkname=${encodedTitle}`)"
> >
<img <img
src="/social/png/wykop.jpg" src="~/public/social/png/wykop.jpg"
class="img-responsive" class="img-responsive"
alt="Wykop" alt="Wykop"
:width="width" :width="width"

2
packages/nc-gui-v2/components/general/Sponsors.vue

@ -9,7 +9,7 @@ const { nav = false } = defineProps<Props>()
<template> <template>
<a-card class="w-[300px] shadow-sm !rounded-lg"> <a-card class="w-[300px] shadow-sm !rounded-lg">
<template #cover> <template #cover>
<img class="max-h-[180px] !rounded-t-lg" alt="cover" src="/ants-leaf-cutter.jpeg" /> <img class="max-h-[180px] !rounded-t-lg" alt="cover" src="~/public/ants-leaf-cutter.jpeg" />
</template> </template>
<a-card-meta> <a-card-meta>

6
packages/nc-gui-v2/composables/useApi/index.ts

@ -3,12 +3,14 @@ import { Api } from 'nocodb-sdk'
import type { Ref } from 'vue' import type { Ref } from 'vue'
import type { CreateApiOptions, UseApiProps, UseApiReturn } from './types' import type { CreateApiOptions, UseApiProps, UseApiReturn } from './types'
import { addAxiosInterceptors } from './interceptors' import { addAxiosInterceptors } from './interceptors'
import { createEventHook, ref, unref, useCounter, useNuxtApp } from '#imports' import { createEventHook, ref, unref, useCounter, useGlobal, useNuxtApp } from '#imports'
export function createApiInstance<SecurityDataType = any>(options: CreateApiOptions = {}): Api<SecurityDataType> { export function createApiInstance<SecurityDataType = any>(options: CreateApiOptions = {}): Api<SecurityDataType> {
const { appInfo } = $(useGlobal())
return addAxiosInterceptors( return addAxiosInterceptors(
new Api<SecurityDataType>({ new Api<SecurityDataType>({
baseURL: options.baseURL ?? 'http://localhost:8080', baseURL: options.baseURL ?? appInfo.ncSiteUrl,
}), }),
) )
} }

2
packages/nc-gui-v2/composables/useGlobal/state.ts

@ -77,7 +77,7 @@ export function useGlobalState(storageKey = 'nocodb-gui-v2'): State {
}) })
const appInfo = ref<AppInfo>({ const appInfo = ref<AppInfo>({
ncSiteUrl: 'localhost:8080', ncSiteUrl: process.env.NC_BACKEND_URL || (process.env.NODE_ENV === 'production' ? location.origin : 'http://localhost:8080'),
authType: 'jwt', authType: 'jwt',
connectToExternalDB: false, connectToExternalDB: false,
defaultLimit: 0, defaultLimit: 0,

8
packages/nc-gui-v2/nuxt.config.ts

@ -11,8 +11,11 @@ import monacoEditorPlugin from 'vite-plugin-monaco-editor'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: ['@vueuse/nuxt', 'nuxt-windicss', '@nuxt/image-edge'], modules: ['@vueuse/nuxt', 'nuxt-windicss', '@nuxt/image-edge'],
ssr: false,
ssr: false,
app: {
baseURL: '/dashboard/',
},
css: [ css: [
'virtual:windi.css', 'virtual:windi.css',
'virtual:windi-devtools', 'virtual:windi-devtools',
@ -47,9 +50,11 @@ export default defineNuxtConfig({
vite: { vite: {
// todo: minifiy again // todo: minifiy again
build: { build: {
minify: false, minify: false,
rollupOptions: { rollupOptions: {
external: 'httpsnippet', external: 'httpsnippet',
}, },
}, },
plugins: [ plugins: [
@ -93,7 +98,6 @@ export default defineNuxtConfig({
image: { image: {
dir: 'assets/', dir: 'assets/',
}, },
autoImports: { autoImports: {
dirs: ['./context', './utils', './lib'], dirs: ['./context', './utils', './lib'],
imports: [{ name: 'useI18n', from: 'vue-i18n' }], imports: [{ name: 'useI18n', from: 'vue-i18n' }],

96
packages/nc-gui-v2/package-lock.json generated

@ -931,7 +931,7 @@
"dependencies": { "dependencies": {
"fast-deep-equal": "^3.1.1", "fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0", "fast-json-stable-stringify": "^2.0.0",
"json-schem-traverse": "^0.4.1", "json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2" "uri-js": "^4.2.2"
}, },
"funding": { "funding": {
@ -954,9 +954,9 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/@eslint/eslintrc/node_modules/json-schem-traverse": { "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": {
"version": "0.4.1", "version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schem-traverse/-/json-schem-traverse-0.4.1.tgz", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true "dev": true
}, },
@ -1730,7 +1730,7 @@
}, },
"node_modules/@nuxt/schema": { "node_modules/@nuxt/schema": {
"version": "3.0.0-rc.6", "version": "3.0.0-rc.6",
"resolved": "https://registry.npmjs.org/@nuxt/schema/-/schem-3.0.0-rc.6.tgz", "resolved": "https://registry.npmjs.org/@nuxt/schema/-/schema-3.0.0-rc.6.tgz",
"integrity": "sha512-BcD5YtWRhn+jU2DlzuI1TeITFeOt5x6qm2KeaU/d5jzJ0oZDzmZwKsAimLtRbHwyU6/kKa+zFbK6pp5obm1XLg==", "integrity": "sha512-BcD5YtWRhn+jU2DlzuI1TeITFeOt5x6qm2KeaU/d5jzJ0oZDzmZwKsAimLtRbHwyU6/kKa+zFbK6pp5obm1XLg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
@ -2379,7 +2379,7 @@
}, },
"node_modules/@types/json-schema": { "node_modules/@types/json-schema": {
"version": "7.0.11", "version": "7.0.11",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schem-7.0.11.tgz", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
"dev": true "dev": true
}, },
@ -3548,7 +3548,7 @@
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"fast-deep-equal": "^3.1.1", "fast-deep-equal": "^3.1.1",
"json-schem-traverse": "^1.0.0", "json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2", "require-from-string": "^2.0.2",
"uri-js": "^4.2.2" "uri-js": "^4.2.2"
}, },
@ -6774,7 +6774,7 @@
"dependencies": { "dependencies": {
"fast-deep-equal": "^3.1.1", "fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0", "fast-json-stable-stringify": "^2.0.0",
"json-schem-traverse": "^0.4.1", "json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2" "uri-js": "^4.2.2"
}, },
"funding": { "funding": {
@ -6895,9 +6895,9 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/eslint/node_modules/json-schem-traverse": { "node_modules/eslint/node_modules/json-schema-traverse": {
"version": "0.4.1", "version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schem-traverse/-/json-schem-traverse-0.4.1.tgz", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true "dev": true
}, },
@ -7935,7 +7935,7 @@
}, },
"node_modules/har-schema": { "node_modules/har-schema": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schem-2.0.0.tgz", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
"integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==",
"dev": true, "dev": true,
"engines": { "engines": {
@ -7964,7 +7964,7 @@
"dependencies": { "dependencies": {
"fast-deep-equal": "^3.1.1", "fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0", "fast-json-stable-stringify": "^2.0.0",
"json-schem-traverse": "^0.4.1", "json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2" "uri-js": "^4.2.2"
}, },
"funding": { "funding": {
@ -7972,9 +7972,9 @@
"url": "https://github.com/sponsors/epoberezkin" "url": "https://github.com/sponsors/epoberezkin"
} }
}, },
"node_modules/har-validator/node_modules/json-schem-traverse": { "node_modules/har-validator/node_modules/json-schema-traverse": {
"version": "0.4.1", "version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schem-traverse/-/json-schem-traverse-0.4.1.tgz", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true "dev": true
}, },
@ -9288,12 +9288,6 @@
"integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",
"dev": true "dev": true
}, },
"node_modules/json-schem-traverse": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schem-traverse/-/json-schem-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
"dev": true
},
"node_modules/json-schema-traverse": { "node_modules/json-schema-traverse": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
@ -12585,9 +12579,9 @@
"node": ">=v12.22.7" "node": ">=v12.22.7"
} }
}, },
"node_modules/schem-utils": { "node_modules/schema-utils": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/schem-utils/-/schem-utils-3.1.1.tgz", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",
"integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@ -12605,7 +12599,7 @@
"url": "https://opencollective.com/webpack" "url": "https://opencollective.com/webpack"
} }
}, },
"node_modules/schem-utils/node_modules/ajv": { "node_modules/schema-utils/node_modules/ajv": {
"version": "6.12.6", "version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
@ -12615,7 +12609,7 @@
"dependencies": { "dependencies": {
"fast-deep-equal": "^3.1.1", "fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0", "fast-json-stable-stringify": "^2.0.0",
"json-schem-traverse": "^0.4.1", "json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2" "uri-js": "^4.2.2"
}, },
"funding": { "funding": {
@ -12623,7 +12617,7 @@
"url": "https://github.com/sponsors/epoberezkin" "url": "https://github.com/sponsors/epoberezkin"
} }
}, },
"node_modules/schem-utils/node_modules/ajv-keywords": { "node_modules/schema-utils/node_modules/ajv-keywords": {
"version": "3.5.2", "version": "3.5.2",
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
@ -12634,9 +12628,9 @@
"ajv": "^6.9.1" "ajv": "^6.9.1"
} }
}, },
"node_modules/schem-utils/node_modules/json-schem-traverse": { "node_modules/schema-utils/node_modules/json-schema-traverse": {
"version": "0.4.1", "version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schem-traverse/-/json-schem-traverse-0.4.1.tgz", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@ -13547,7 +13541,7 @@
"dependencies": { "dependencies": {
"@jridgewell/trace-mapping": "^0.3.7", "@jridgewell/trace-mapping": "^0.3.7",
"jest-worker": "^27.4.5", "jest-worker": "^27.4.5",
"schem-utils": "^3.1.1", "schema-utils": "^3.1.1",
"serialize-javascript": "^6.0.0", "serialize-javascript": "^6.0.0",
"terser": "^5.7.2" "terser": "^5.7.2"
}, },
@ -14775,7 +14769,7 @@
"loader-runner": "^4.2.0", "loader-runner": "^4.2.0",
"mime-types": "^2.1.27", "mime-types": "^2.1.27",
"neo-async": "^2.6.2", "neo-async": "^2.6.2",
"schem-utils": "^3.1.0", "schema-utils": "^3.1.0",
"tapable": "^2.1.1", "tapable": "^2.1.1",
"terser-webpack-plugin": "^5.1.3", "terser-webpack-plugin": "^5.1.3",
"watchpack": "^2.3.1", "watchpack": "^2.3.1",
@ -15856,7 +15850,7 @@
"requires": { "requires": {
"fast-deep-equal": "^3.1.1", "fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0", "fast-json-stable-stringify": "^2.0.0",
"json-schem-traverse": "^0.4.1", "json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2" "uri-js": "^4.2.2"
} }
}, },
@ -15869,9 +15863,9 @@
"type-fest": "^0.20.2" "type-fest": "^0.20.2"
} }
}, },
"json-schem-traverse": { "json-schema-traverse": {
"version": "0.4.1", "version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schem-traverse/-/json-schem-traverse-0.4.1.tgz", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true "dev": true
}, },
@ -16475,7 +16469,7 @@
}, },
"@nuxt/schema": { "@nuxt/schema": {
"version": "3.0.0-rc.6", "version": "3.0.0-rc.6",
"resolved": "https://registry.npmjs.org/@nuxt/schema/-/schem-3.0.0-rc.6.tgz", "resolved": "https://registry.npmjs.org/@nuxt/schema/-/schema-3.0.0-rc.6.tgz",
"integrity": "sha512-BcD5YtWRhn+jU2DlzuI1TeITFeOt5x6qm2KeaU/d5jzJ0oZDzmZwKsAimLtRbHwyU6/kKa+zFbK6pp5obm1XLg==", "integrity": "sha512-BcD5YtWRhn+jU2DlzuI1TeITFeOt5x6qm2KeaU/d5jzJ0oZDzmZwKsAimLtRbHwyU6/kKa+zFbK6pp5obm1XLg==",
"dev": true, "dev": true,
"requires": { "requires": {
@ -17016,7 +17010,7 @@
}, },
"@types/json-schema": { "@types/json-schema": {
"version": "7.0.11", "version": "7.0.11",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schem-7.0.11.tgz", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
"dev": true "dev": true
}, },
@ -17877,7 +17871,7 @@
"dev": true, "dev": true,
"requires": { "requires": {
"fast-deep-equal": "^3.1.1", "fast-deep-equal": "^3.1.1",
"json-schem-traverse": "^1.0.0", "json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2", "require-from-string": "^2.0.2",
"uri-js": "^4.2.2" "uri-js": "^4.2.2"
} }
@ -19848,7 +19842,7 @@
"requires": { "requires": {
"fast-deep-equal": "^3.1.1", "fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0", "fast-json-stable-stringify": "^2.0.0",
"json-schem-traverse": "^0.4.1", "json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2" "uri-js": "^4.2.2"
} }
}, },
@ -19926,9 +19920,9 @@
"slash": "^3.0.0" "slash": "^3.0.0"
} }
}, },
"json-schem-traverse": { "json-schema-traverse": {
"version": "0.4.1", "version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schem-traverse/-/json-schem-traverse-0.4.1.tgz", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true "dev": true
}, },
@ -21061,7 +21055,7 @@
}, },
"har-schema": { "har-schema": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schem-2.0.0.tgz", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
"integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==",
"dev": true "dev": true
}, },
@ -21083,13 +21077,13 @@
"requires": { "requires": {
"fast-deep-equal": "^3.1.1", "fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0", "fast-json-stable-stringify": "^2.0.0",
"json-schem-traverse": "^0.4.1", "json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2" "uri-js": "^4.2.2"
} }
}, },
"json-schem-traverse": { "json-schema-traverse": {
"version": "0.4.1", "version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schem-traverse/-/json-schem-traverse-0.4.1.tgz", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true "dev": true
} }
@ -22053,12 +22047,6 @@
"integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",
"dev": true "dev": true
}, },
"json-schem-traverse": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schem-traverse/-/json-schem-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
"dev": true
},
"json-schema-traverse": { "json-schema-traverse": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
@ -24554,9 +24542,9 @@
"xmlchars": "^2.2.0" "xmlchars": "^2.2.0"
} }
}, },
"schem-utils": { "schema-utils": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/schem-utils/-/schem-utils-3.1.1.tgz", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",
"integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@ -24577,7 +24565,7 @@
"requires": { "requires": {
"fast-deep-equal": "^3.1.1", "fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0", "fast-json-stable-stringify": "^2.0.0",
"json-schem-traverse": "^0.4.1", "json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2" "uri-js": "^4.2.2"
} }
}, },
@ -24590,9 +24578,9 @@
"peer": true, "peer": true,
"requires": {} "requires": {}
}, },
"json-schem-traverse": { "json-schema-traverse": {
"version": "0.4.1", "version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schem-traverse/-/json-schem-traverse-0.4.1.tgz", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true, "dev": true,
"optional": true, "optional": true,
@ -25307,7 +25295,7 @@
"requires": { "requires": {
"@jridgewell/trace-mapping": "^0.3.7", "@jridgewell/trace-mapping": "^0.3.7",
"jest-worker": "^27.4.5", "jest-worker": "^27.4.5",
"schem-utils": "^3.1.1", "schema-utils": "^3.1.1",
"serialize-javascript": "^6.0.0", "serialize-javascript": "^6.0.0",
"terser": "^5.7.2" "terser": "^5.7.2"
}, },
@ -26188,7 +26176,7 @@
"loader-runner": "^4.2.0", "loader-runner": "^4.2.0",
"mime-types": "^2.1.27", "mime-types": "^2.1.27",
"neo-async": "^2.6.2", "neo-async": "^2.6.2",
"schem-utils": "^3.1.0", "schema-utils": "^3.1.0",
"tapable": "^2.1.1", "tapable": "^2.1.1",
"terser-webpack-plugin": "^5.1.3", "terser-webpack-plugin": "^5.1.3",
"watchpack": "^2.3.1", "watchpack": "^2.3.1",

5
packages/nc-gui-v2/package.json

@ -8,7 +8,10 @@
"lint": "eslint --ext \".js,.jsx,.ts,.tsx,.vue\" --fix --ignore-path .gitignore .", "lint": "eslint --ext \".js,.jsx,.ts,.tsx,.vue\" --fix --ignore-path .gitignore .",
"test": "vitest -c test/vite.config.ts", "test": "vitest -c test/vite.config.ts",
"test:ui": "vitest -c test/vite.config.ts --ui", "test:ui": "vitest -c test/vite.config.ts --ui",
"coverage": "vitest -c test/vite.config.ts run --coverage" "coverage": "vitest -c test/vite.config.ts run --coverage",
"build:copy": "npm run generate; rm -rf ../nc-lib-gui-v2/lib/dist/; rsync -rvzh ./dist/ ../nc-lib-gui-v2/lib/dist/",
"build:copy:publish": "npm run generate; rm -rf ../nc-lib-gui-v2/lib/dist/; rsync -rvzh ./dist/ ../nc-lib-gui-v2/lib/dist/; npm publish ../nc-lib-gui-v2"
}, },
"dependencies": { "dependencies": {
"@ckpack/vue-color": "^1.2.0", "@ckpack/vue-color": "^1.2.0",

7
packages/nc-gui-v2/plugins/tele.ts

@ -6,16 +6,19 @@ import type { UseGlobalReturn } from '~/composables/useGlobal/types'
// todo: ignore init if tele disabled // todo: ignore init if tele disabled
export default defineNuxtPlugin(async (nuxtApp) => { export default defineNuxtPlugin(async (nuxtApp) => {
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const { appInfo } = $(useGlobal())
let socket: Socket let socket: Socket
const init = async (token: string) => { const init = async (token: string) => {
try { try {
if (socket) socket.disconnect() if (socket) socket.disconnect()
// todo: extract base url const url = new URL(appInfo.ncSiteUrl, window.location.href.split(/[?#]/)[0]).href
const url = 'http://localhost:8080' // new URL($axios.defaults.baseURL, window.location.href.split(/[?#]/)[0]).href
socket = io(url, { socket = io(url, {
extraHeaders: { 'xc-auth': token }, extraHeaders: { 'xc-auth': token },
}) })

2
packages/nc-gui/components/ProjectTreeView.vue

@ -2,7 +2,7 @@
<div style="height: 100%" class="nc-tree-view" @mouseenter="onMiniHoverEnter" @mouseleave="onMiniHoverLeave"> <div style="height: 100%" class="nc-tree-view" @mouseenter="onMiniHoverEnter" @mouseleave="onMiniHoverLeave">
<!-- :expand-on-hover="mini"--> <!-- :expand-on-hover="mini"-->
<div class="primary nc-project-title theme--dark" :class="{ shared: sharedBase }"> <div class="primary nc-project-title theme--dark" :class="{ shared: sharedBase }">
<img v-if="sharedBase" src="favicon-32.png" height="18" class="ml-2" /> <img v-if="sharedBase" src="~/public/favicon-32.png" height="18" class="ml-2" />
<h3 v-if="sharedBase" class="nc-project-title white--text text-capitalize"> <h3 v-if="sharedBase" class="nc-project-title white--text text-capitalize">
{{ $store.getters['project/GtrProjectName'] }} {{ $store.getters['project/GtrProjectName'] }}
</h3> </h3>

2
packages/nc-gui/pages/nc/base/_shared_base_id.vue

@ -29,7 +29,7 @@
<div class="nc-embedded-options d-flex align-center px-3"> <div class="nc-embedded-options d-flex align-center px-3">
<v-spacer /> <v-spacer />
<a href="https://github.com/nocodb/nocodb" target="_blank" class="d-inline-flex align-center caption"> <a href="https://github.com/nocodb/nocodb" target="_blank" class="d-inline-flex align-center caption">
<img src="favicon-32.png" height="15" class="mr-2" /> <img src="~/public/favicon-32.png" height="15" class="mr-2" />
<span>Built with </span> &nbsp; <span class=""><span class="font-weight-bold"> NocoDB</span> </span></a <span>Built with </span> &nbsp; <span class=""><span class="font-weight-bold"> NocoDB</span> </span></a
> >
<span v-if="embed" class="caption pointer ml-4" @click="showLargerVersion" <span v-if="embed" class="caption pointer ml-4" @click="showLargerVersion"

11
packages/nc-lib-gui-v2/.gitignore vendored

@ -0,0 +1,11 @@
/node_modules/
#build
src/**.js
.idea/*
coverage
.nyc_output
*.log
yarn.lock
/lib/dist/

5
packages/nc-lib-gui-v2/README.md

@ -0,0 +1,5 @@
# nc-lib-gui
This package is the build version of ``nc-gui`` which will be used in ``packages/nocodb``. The built files should be located in ``packages/nc-lib-gui/lib/dist/``.
To build the frontend and copy the built files to dist directory, run ``npm run build:copy`` under ``packages/nc-gui/``.

30
packages/nc-lib-gui-v2/__tests__/xc-tool-web.test.js

@ -0,0 +1,30 @@
'use strict';
const xcToolWeb = require('..');
describe('xc-tool-web', () => {
it('needs tests');
});
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

45
packages/nc-lib-gui-v2/lib/XcLibGui.js

@ -0,0 +1,45 @@
const express = require('express');
const path = require('path');
class XcLibGui {
static expressMiddleware(dashboardPath) {
const router = express.Router();
// Express will serve up production assets i.e. main.js
router.use(dashboardPath, express.static(path.join(__dirname, 'dist')));
// If Express doesn't recognize route serve index.html
router.get(`${dashboardPath}/*`, (_req, res) => {
res.sendFile(path.join(__dirname, 'dist', 'index.html'));
});
return router;
}
}
module.exports = XcLibGui;
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

22
packages/nc-lib-gui-v2/license.txt

@ -0,0 +1,22 @@
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

1113
packages/nc-lib-gui-v2/package-lock.json generated

File diff suppressed because it is too large Load Diff

37
packages/nc-lib-gui-v2/package.json

@ -0,0 +1,37 @@
{
"name": "nc-lib-gui-v2",
"version": "0.0.0",
"description": "NocoDB GUI",
"author": {
"name": "NocoDB",
"url": "https://nocodb.com/"
},
"homepage": "https://github.com/nocodb/nocodb",
"license": "AGPL-3.0-or-later",
"main": "lib/XcLibGui.js",
"directories": {
"lib": "lib",
"test": "__tests__"
},
"files": [
"lib"
],
"repository": {
"type": "git",
"url": "git+ssh://git@github.com:nocodb/nocodb.git"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
},
"bugs": {
"url": "https://github.com/nocodb/nocodb/issues"
},
"dependencies": {
"axios": "^0.19.2",
"body-parser": "^1.19.0",
"dayjs": "^1.10.4",
"express": "^4.17.1",
"serve-static": "^1.15.0",
"vuedraggable": "^2.24.3"
}
}

2
packages/nocodb-sdk/package.json

@ -107,4 +107,4 @@
"**/*.spec.js" "**/*.spec.js"
] ]
} }
} }

3
packages/nocodb/Dockerfile

@ -33,7 +33,7 @@ COPY ./docker/start-litestream.sh /usr/src/appEntry/start.sh
# reduce node_module size with modclean & removing sqlite deps, # reduce node_module size with modclean & removing sqlite deps,
# package built code into app.tar.gz & add execute permission to start.sh # package built code into app.tar.gz & add execute permission to start.sh
RUN npm ci --production --quiet \ RUN npm ci --production --quiet \
&& npx modclean --patterns="default:*" --ignore="nc-lib-gui/**,dayjs/**,express-status-monitor/**" --run \ && npx modclean --patterns="default:*" --ignore="nc-lib-gui/**,nc-lib-gui-v2/**,dayjs/**,express-status-monitor/**" --run \
&& rm -rf ./node_modules/sqlite3/deps \ && rm -rf ./node_modules/sqlite3/deps \
&& tar -czf ../appEntry/app.tar.gz ./* \ && tar -czf ../appEntry/app.tar.gz ./* \
&& chmod +x /usr/src/appEntry/start.sh && chmod +x /usr/src/appEntry/start.sh
@ -45,6 +45,7 @@ FROM alpine:3.12
WORKDIR /usr/src/app WORKDIR /usr/src/app
ENV NC_DOCKER 0.6 ENV NC_DOCKER 0.6
ENV NODE_ENV production
ENV PORT 8080 ENV PORT 8080
ENV NC_TOOL_DIR=/usr/app/data/ ENV NC_TOOL_DIR=/usr/app/data/

28
packages/nocodb/package-lock.json generated

@ -71,7 +71,7 @@
"nanoid": "^3.1.20", "nanoid": "^3.1.20",
"nc-common": "0.0.6", "nc-common": "0.0.6",
"nc-help": "0.2.67", "nc-help": "0.2.67",
"nc-lib-gui": "0.92.4", "nc-lib-gui-v2": "0.0.0",
"nc-plugin": "0.1.2", "nc-plugin": "0.1.2",
"ncp": "^2.0.0", "ncp": "^2.0.0",
"nocodb-sdk": "file:../nocodb-sdk", "nocodb-sdk": "file:../nocodb-sdk",
@ -15324,19 +15324,20 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/nc-lib-gui": { "node_modules/nc-lib-gui-v2": {
"version": "0.92.4", "version": "0.0.0",
"resolved": "https://registry.npmjs.org/nc-lib-gui/-/nc-lib-gui-0.92.4.tgz", "resolved": "https://registry.npmjs.org/nc-lib-gui-v2/-/nc-lib-gui-v2-0.0.0.tgz",
"integrity": "sha512-Sozs8w9fQN0WscoxKDGsMqviM/6wasqaag3dRPZ+SISu+bhOnogWUuZXM8Ivl6+dcj3RkXR0n4llF0Z+NvJW/A==", "integrity": "sha512-UVg/awpj3IQGf5SMCBCwga2a4PDjkmpDnUfuQCGfy2ErkscFontRVHWtSpTp43CKqYRRt7pZdUHcVp7d9AIUNw==",
"dependencies": { "dependencies": {
"axios": "^0.19.2", "axios": "^0.19.2",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"dayjs": "^1.10.4", "dayjs": "^1.10.4",
"express": "^4.17.1", "express": "^4.17.1",
"serve-static": "^1.15.0",
"vuedraggable": "^2.24.3" "vuedraggable": "^2.24.3"
} }
}, },
"node_modules/nc-lib-gui/node_modules/axios": { "node_modules/nc-lib-gui-v2/node_modules/axios": {
"version": "0.19.2", "version": "0.19.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
"integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
@ -15345,7 +15346,7 @@
"follow-redirects": "1.5.10" "follow-redirects": "1.5.10"
} }
}, },
"node_modules/nc-lib-gui/node_modules/debug": { "node_modules/nc-lib-gui-v2/node_modules/debug": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
@ -15353,7 +15354,7 @@
"ms": "2.0.0" "ms": "2.0.0"
} }
}, },
"node_modules/nc-lib-gui/node_modules/follow-redirects": { "node_modules/nc-lib-gui-v2/node_modules/follow-redirects": {
"version": "1.5.10", "version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
@ -15364,7 +15365,7 @@
"node": ">=4.0" "node": ">=4.0"
} }
}, },
"node_modules/nc-lib-gui/node_modules/ms": { "node_modules/nc-lib-gui-v2/node_modules/ms": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
@ -36756,15 +36757,16 @@
} }
} }
}, },
"nc-lib-gui": { "nc-lib-gui-v2": {
"version": "0.92.4", "version": "0.0.0",
"resolved": "https://registry.npmjs.org/nc-lib-gui/-/nc-lib-gui-0.92.4.tgz", "resolved": "https://registry.npmjs.org/nc-lib-gui-v2/-/nc-lib-gui-v2-0.0.0.tgz",
"integrity": "sha512-Sozs8w9fQN0WscoxKDGsMqviM/6wasqaag3dRPZ+SISu+bhOnogWUuZXM8Ivl6+dcj3RkXR0n4llF0Z+NvJW/A==", "integrity": "sha512-UVg/awpj3IQGf5SMCBCwga2a4PDjkmpDnUfuQCGfy2ErkscFontRVHWtSpTp43CKqYRRt7pZdUHcVp7d9AIUNw==",
"requires": { "requires": {
"axios": "^0.19.2", "axios": "^0.19.2",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"dayjs": "^1.10.4", "dayjs": "^1.10.4",
"express": "^4.17.1", "express": "^4.17.1",
"serve-static": "^1.15.0",
"vuedraggable": "^2.24.3" "vuedraggable": "^2.24.3"
}, },
"dependencies": { "dependencies": {

4
packages/nocodb/package.json

@ -55,7 +55,7 @@
"postbuild": "npm run copy-files", "postbuild": "npm run copy-files",
"copy-files": "copyfiles -u 1 \"src/**/*.ejs\" build/main && copyfiles -u 1 \"src/**/*.ejs\" build/module && copyfiles -u 1 \"src/**/*.ejs\" docker", "copy-files": "copyfiles -u 1 \"src/**/*.ejs\" build/main && copyfiles -u 1 \"src/**/*.ejs\" build/module && copyfiles -u 1 \"src/**/*.ejs\" docker",
"docker:build": "EE=\"true-xc-test\" webpack --config docker/webpack.config.js", "docker:build": "EE=\"true-xc-test\" webpack --config docker/webpack.config.js",
"docker:image:build": "docker build . -t nocodb/nocodb:latest -t nocodb/nocodb:0.10.0 --no-cache", "docker:image:build": "docker build . -t nocodb/nocodb-test:latest -t nocodb/nocodb-test:0.10.0 --no-cache",
"docker:image:buildx": "docker buildx build . --platform linux/arm64 -t nocodb/nocodb:arm64 --no-cache", "docker:image:buildx": "docker buildx build . --platform linux/arm64 -t nocodb/nocodb:arm64 --no-cache",
"docker:image:deploy": "docker push nocodb/nocodb:latest && docker push nocodb/nocodb:0.10.0", "docker:image:deploy": "docker push nocodb/nocodb:latest && docker push nocodb/nocodb:0.10.0",
"docker:build:publish:image": "npm run build && npm run docker:build && npm run docker:image:build", "docker:build:publish:image": "npm run build && npm run docker:build && npm run docker:image:build",
@ -157,7 +157,7 @@
"nanoid": "^3.1.20", "nanoid": "^3.1.20",
"nc-common": "0.0.6", "nc-common": "0.0.6",
"nc-help": "0.2.67", "nc-help": "0.2.67",
"nc-lib-gui": "0.92.4", "nc-lib-gui-v2": "0.0.0",
"nc-plugin": "0.1.2", "nc-plugin": "0.1.2",
"ncp": "^2.0.0", "ncp": "^2.0.0",
"nocodb-sdk": "file:../nocodb-sdk", "nocodb-sdk": "file:../nocodb-sdk",

13
packages/nocodb/src/lib/Noco.ts

@ -11,7 +11,7 @@ import * as express from 'express';
import { Router } from 'express'; import { Router } from 'express';
import importFresh from 'import-fresh'; import importFresh from 'import-fresh';
import morgan from 'morgan'; import morgan from 'morgan';
import NcToolGui from 'nc-lib-gui'; import NcToolGui from 'nc-lib-gui-v2';
import requestIp from 'request-ip'; import requestIp from 'request-ip';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
@ -118,7 +118,7 @@ export default class Noco {
this.config.toolDir = process.cwd(); this.config.toolDir = process.cwd();
} }
this.ncToolApi = new NcToolGui(this.config); // this.ncToolApi = new NcToolGui(this.config);
// if (server) { // if (server) {
// server.set('view engine', 'ejs'); // server.set('view engine', 'ejs');
// } // }
@ -248,10 +248,13 @@ export default class Noco {
await NcPluginMgrv2.init(Noco.ncMeta); await NcPluginMgrv2.init(Noco.ncMeta);
registerMetaApis(this.router, server); registerMetaApis(this.router, server);
this.router.use( // this.router.use(
// this.config.dashboardPath,
// await this.ncToolApi.expressMiddleware()
// );
this.router.use(NcToolGui.expressMiddleware(
this.config.dashboardPath, this.config.dashboardPath,
await this.ncToolApi.expressMiddleware() ));
);
this.router.get('/', (_req, res) => this.router.get('/', (_req, res) =>
res.redirect(this.config.dashboardPath) res.redirect(this.config.dashboardPath)
); );

2
packages/nocodb/src/lib/models/Column.ts

@ -861,7 +861,7 @@ export default class Column<T = any> implements ColumnType {
o = { ...o, ...updateObj }; o = { ...o, ...updateObj };
// set cache // set cache
await NocoCache.set(key, o); await NocoCache.set(key, o);
} }
// set meta // set meta
await ncMeta.metaUpdate( await ncMeta.metaUpdate(
null, null,

2
packages/nocodb/tests/export-import/exportSchema.js

@ -295,4 +295,4 @@ async function exportSchema() {
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */

2
packages/nocodb/tests/export-import/importSchema.js

@ -534,4 +534,4 @@ async function importSchema() {
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */

16
scripts/bumpNcGuiVersion.js

@ -0,0 +1,16 @@
const fs = require('fs')
const path = require('path')
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-v2', 'package.json'), 'utf8'))
if (process.env.targetEnv === 'DEV') {
// nightly build
// e.g. 0.84.2-20220220-1250
// pr build
// e.g. 0.84.2-pr-1234-20220220-1250
packageJson.version = `${packageJson.version}-${process.env.targetVersion}`
packageJson.name += '-daily'
} else {
packageJson.version = process.env.targetVersion
}
fs.writeFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-v2', 'package.json'), JSON.stringify(packageJson, 0, 2))

2
scripts/bumpNocodbSdkVersion.js

@ -1,6 +1,6 @@
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
console.log(path.join(__dirname, '..', 'packages', 'nocodb-sdk', 'package.json'))
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nocodb-sdk', 'package.json'), 'utf8')) const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nocodb-sdk', 'package.json'), 'utf8'))
const version = packageJson.version const version = packageJson.version
.replace(/\.(\d+)$/, (_, v) => { .replace(/\.(\d+)$/, (_, v) => {

49
scripts/upgradeNcGui2.js

@ -0,0 +1,49 @@
const fs = require('fs')
const path = require('path')
const execSync = require('child_process').execSync;
// extract latest version from package.json
const ncLibPackage = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-v2', 'package.json')))
const replacePackageName = (filePath) => {
return new Promise((resolve, reject) => {
return fs.readFile(filePath, 'utf8', function (err, data) {
if (err) return reject(err)
var result = data.replace(/nc-lib-gui-v2/g, ncLibPackage.name);
return fs.writeFile(filePath, result, 'utf8', function (err) {
if (err) return reject(err)
return resolve()
});
});
})
}
const bumbVersionAndSave = () => {
// upgrade nc-lib-gui-v2 version in nocodb
execSync(`cd packages/nocodb && npm install --save --save-exact ${ncLibPackage.name}@${ncLibPackage.version}`, {});
const nocodbPackageFilePath = path.join(__dirname, '..', 'packages', 'nocodb', 'package.json')
const nocoLibPackage = JSON.parse(fs.readFileSync(nocodbPackageFilePath))
if (process.env.targetEnv === 'DEV') {
nocoLibPackage.name = `${nocoLibPackage.name}-daily`
}
nocoLibPackage.version = ncLibPackage.version
fs.writeFileSync(nocodbPackageFilePath, JSON.stringify(nocoLibPackage, null, 2));
}
if (process.env.targetEnv === 'DEV') {
// replace nc-lib-gui-v2 by nc-lib-gui-v2-daily if it is nightly build / pr release
const filePaths = [
path.join(__dirname, '..', 'packages', 'nocodb', 'Dockerfile'),
path.join(__dirname, '..', 'packages', 'nocodb', 'litestream', 'Dockerfile'),
path.join(__dirname, '..', 'packages', 'nocodb', 'package.json'),
path.join(__dirname, '..', 'packages', 'nocodb', 'README.md'),
path.join(__dirname, '..', 'packages', 'nocodb', 'src', 'lib', 'Noco.ts'),
]
Promise.all(filePaths.map(filePath => { return replacePackageName(filePath) })).then(() => {
bumbVersionAndSave();
})
} else {
bumbVersionAndSave();
}

76
scripts/upgradeNocodbSdk2.js

@ -0,0 +1,76 @@
const fs = require('fs')
const path = require('path');
const execSync = require('child_process').execSync;
// extract latest version from package.json
const nocodbSdkPackage = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nocodb-sdk', 'package.json'), 'utf8'))
const replacePackageName = (filePath) => {
return new Promise((resolve, reject) => {
return fs.readFile(filePath, 'utf8', function (err, data) {
if (err) return reject(err)
var result = data.replace(/nocodb-sdk/g, nocodbSdkPackage.name);
return fs.writeFile(filePath, result, 'utf8', function (err) {
if (err) return reject(err)
return resolve()
});
});
})
}
const bumbVersionAndSave = () => {
// upgrade nocodb-sdk version in nocodb
execSync(`cd packages/nocodb && npm install --save --save-exact ${nocodbSdkPackage.name}@${nocodbSdkPackage.version}`, {});
// upgrade nocodb-sdk version in nc-gui-v2
execSync(`cd packages/nc-gui-v2 && npm install --save --save-exact ${nocodbSdkPackage.name}@${nocodbSdkPackage.version}`, {});
}
const dfs = function(dir) {
var res = [];
var list = fs.readdirSync(dir);
list.forEach(function(file) {
if (['node_modules', 'build'].includes(file)) return;
file = dir + '/' + file;
var stat = fs.statSync(file);
if (stat && stat.isDirectory()) {
res = res.concat(dfs(file));
} else {
const ext = path.extname(file).toLowerCase()
if (ext == '.vue' || ext == '.ts' || ext == '.js') {
res.push(file);
}
}
})
return res;
}
const searchAndReplace = (target) => {
let list = [
...dfs(path.resolve(path.join(__dirname, '..', 'packages', 'nc-gui-v2'))),
...dfs(path.resolve(path.join(__dirname, '..', 'packages', 'nocodb'))),
path.join(__dirname, '..', 'packages', 'nc-gui-v2', 'package.json'),
path.join(__dirname, '..', 'packages', 'nocodb', 'package.json')
]
return Promise.all(list.map(d => {
return new Promise((resolve, reject) => {
fs.readFile(d, function(err, content) {
if (err) reject(err)
if (content.indexOf(target) > -1) {
resolve(replacePackageName(d))
} else {
resolve()
}
})
})
}))
}
if (process.env.targetEnv === 'DEV') {
// replace nocodb-sdk by nocodb-sdk-daily if it is nightly build / pr build
searchAndReplace('nocodb-sdk')
.then(() => {
bumbVersionAndSave()
})
} else {
bumbVersionAndSave()
}
Loading…
Cancel
Save