From 5c48e3c96c6f5be65c321e29e7a3063873e73bee Mon Sep 17 00:00:00 2001 From: Michel Loiseleur <97035654+mloiseleur@users.noreply.github.com> Date: Fri, 7 Jun 2024 16:56:04 +0200 Subject: [PATCH] chore(ci): improve webui build and lint --- .github/workflows/build.yaml | 14 +++++++++++++- .github/workflows/experimental.yaml | 11 ++++++++++- webui/Dockerfile | 2 +- webui/package.json | 11 ++++++----- webui/readme.md | 2 +- webui/src/components/_commons/AvatarState.vue | 2 +- webui/src/components/_commons/MainTable.vue | 6 +++--- webui/src/components/_commons/PanelHealthCheck.vue | 2 +- webui/src/components/_commons/PanelMiddlewares.vue | 4 ++-- .../components/_commons/PanelMirroringServices.vue | 2 +- .../src/components/_commons/PanelRouterDetails.vue | 4 ++-- webui/src/components/_commons/PanelServers.vue | 2 +- .../components/_commons/PanelServiceDetails.vue | 2 +- webui/src/components/_commons/PanelTLS.vue | 10 +++++----- .../components/_commons/PanelWeightedServices.vue | 2 +- webui/src/components/_commons/ProviderIcon.vue | 2 +- .../components/_commons/StickyServiceDetails.vue | 2 +- webui/src/components/_commons/ToolBarTable.vue | 5 +++-- webui/src/components/dashboard/PanelChart.vue | 6 +++--- webui/src/components/dashboard/PanelEntry.vue | 8 ++++---- webui/src/components/dashboard/PanelFeature.vue | 5 ++++- webui/src/components/dashboard/PanelProvider.vue | 7 +++++-- webui/src/pages/_commons/MiddlewareDetail.vue | 4 ++-- webui/src/pages/_commons/RouterDetail.vue | 4 ++-- webui/src/pages/_commons/ServiceDetail.vue | 4 ++-- 25 files changed, 76 insertions(+), 47 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ec0c32edb..95e921ebf 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,9 +20,21 @@ jobs: with: fetch-depth: 0 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version-file: webui/.nvmrc + cache: yarn + cache-dependency-path: webui/yarn.lock + - name: Build webui + working-directory: ./webui + run: | + yarn install + yarn build + + - name: Package webui run: | - make clean-webui generate-webui tar czvf webui.tar.gz ./webui/static/ - name: Artifact webui diff --git a/.github/workflows/experimental.yaml b/.github/workflows/experimental.yaml index b20d31124..fa91bfda5 100644 --- a/.github/workflows/experimental.yaml +++ b/.github/workflows/experimental.yaml @@ -25,9 +25,18 @@ jobs: with: fetch-depth: 0 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version-file: webui/.nvmrc + cache: yarn + cache-dependency-path: webui/yarn.lock + - name: Build webui + working-directory: ./webui run: | - make clean-webui generate-webui + yarn install + yarn build - name: Set up Go ${{ env.GO_VERSION }} uses: actions/setup-go@v5 diff --git a/webui/Dockerfile b/webui/Dockerfile index 3939d56b0..df6ca6167 100644 --- a/webui/Dockerfile +++ b/webui/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20.11 +FROM node:20.14 # Current Active LTS release according to (https://nodejs.org/en/about/releases/) ENV WEBUI_DIR /src/webui diff --git a/webui/package.json b/webui/package.json index f33140de3..f6d7acb42 100644 --- a/webui/package.json +++ b/webui/package.json @@ -8,10 +8,10 @@ "scripts": { "transfer": "node dev/scripts/transfer.js", "lint": "eslint --ext .js,.vue src", - "dev": "export APP_ENV='development' && quasar dev", + "dev": "APP_ENV=development quasar dev", "build-quasar": "quasar build", - "build-staging": "export NODE_ENV='production' && export APP_ENV='development' && yarn build-quasar", - "build": "export NODE_ENV='production' && export APP_ENV='production' && yarn build-quasar && yarn transfer spa", + "build-staging": "NODE_ENV=production APP_ENV=development yarn build-quasar", + "build": "NODE_ENV=production APP_ENV=production yarn build-quasar && yarn transfer spa", "build:nc": "yarn build", "test": "echo \"See package.json => scripts for available tests.\" && exit 0", "test:unit": "vitest", @@ -56,6 +56,7 @@ "engines": { "node": "^20 || ^18 || ^16", "npm": ">= 6.13.4", - "yarn": ">= 1.21.1" - } + "yarn": ">= 1.22.22" + }, + "packageManager": "yarn@1.22.22" } diff --git a/webui/readme.md b/webui/readme.md index e621e4080..812cbdf5a 100644 --- a/webui/readme.md +++ b/webui/readme.md @@ -20,7 +20,7 @@ make clean-webui generate-webui # Generate static contents in `webui/static/` fo ## How to build (only for frontend developer) -- prerequisite: [Node 20.11+](https://nodejs.org) [Yarn 1.22.19](https://yarnpkg.com/) +- prerequisite: [Node 20.14+](https://nodejs.org) [Yarn 1.22.22](https://yarnpkg.com/) - Go to the `webui/` directory diff --git a/webui/src/components/_commons/AvatarState.vue b/webui/src/components/_commons/AvatarState.vue index e74e73104..1b99f976e 100644 --- a/webui/src/components/_commons/AvatarState.vue +++ b/webui/src/components/_commons/AvatarState.vue @@ -24,7 +24,7 @@ import { defineComponent } from 'vue' export default defineComponent({ name: 'AvatarState', props: { - state: String + state: { type: String, default: undefined, required: false } } }) diff --git a/webui/src/components/_commons/MainTable.vue b/webui/src/components/_commons/MainTable.vue index 4b64c8999..100e76ad7 100644 --- a/webui/src/components/_commons/MainTable.vue +++ b/webui/src/components/_commons/MainTable.vue @@ -104,12 +104,12 @@ export default defineComponent({ QPageScroller }, props: { - data: Object, + data: { type: Object, default: undefined, required: false }, columns: Array[Object], loading: Boolean, - onLoadMore: Function, + onLoadMore: { type: Function, default: undefined, required: false }, endReached: Boolean, - onRowClick: Function + onRowClick: { type: Function, default: undefined, required: false } }, methods: { getColumn (columnName) { diff --git a/webui/src/components/_commons/PanelHealthCheck.vue b/webui/src/components/_commons/PanelHealthCheck.vue index 7513cded0..0d1689d0d 100644 --- a/webui/src/components/_commons/PanelHealthCheck.vue +++ b/webui/src/components/_commons/PanelHealthCheck.vue @@ -137,7 +137,7 @@ export default { filters: { }, props: { - data: Object, + data: { type: Object, default: undefined, required: false }, dense: Boolean }, computed: { diff --git a/webui/src/components/_commons/PanelMiddlewares.vue b/webui/src/components/_commons/PanelMiddlewares.vue index 5ef836118..ced92222d 100644 --- a/webui/src/components/_commons/PanelMiddlewares.vue +++ b/webui/src/components/_commons/PanelMiddlewares.vue @@ -75,8 +75,8 @@ ERRORS {{ errorMsg }} diff --git a/webui/src/components/_commons/PanelMirroringServices.vue b/webui/src/components/_commons/PanelMirroringServices.vue index 3a3fa3319..a526f3f0f 100644 --- a/webui/src/components/_commons/PanelMirroringServices.vue +++ b/webui/src/components/_commons/PanelMirroringServices.vue @@ -70,7 +70,7 @@ export default { name: 'PanelMirroringServices', props: { - data: Object, + data: { type: Object, default: undefined, required: false }, dense: Boolean }, computed: { diff --git a/webui/src/components/_commons/PanelRouterDetails.vue b/webui/src/components/_commons/PanelRouterDetails.vue index 2ae068fa7..25a01e902 100644 --- a/webui/src/components/_commons/PanelRouterDetails.vue +++ b/webui/src/components/_commons/PanelRouterDetails.vue @@ -131,8 +131,8 @@ export default defineComponent({ AvatarState }, props: { - data: Object, - protocol: String + data: { type: Object, default: undefined, required: false }, + protocol: { type: String, default: undefined, required: false } }, computed: { getProviderLogoPath () { diff --git a/webui/src/components/_commons/PanelServers.vue b/webui/src/components/_commons/PanelServers.vue index 5b07eda44..5c3e8f54b 100644 --- a/webui/src/components/_commons/PanelServers.vue +++ b/webui/src/components/_commons/PanelServers.vue @@ -102,7 +102,7 @@ export default defineComponent({ AvatarState }, props: { - data: Object, + data: { type: Object, default: undefined, required: false }, dense: Boolean, hasStatus: Boolean }, diff --git a/webui/src/components/_commons/PanelServiceDetails.vue b/webui/src/components/_commons/PanelServiceDetails.vue index 91708c35c..0f6758e52 100644 --- a/webui/src/components/_commons/PanelServiceDetails.vue +++ b/webui/src/components/_commons/PanelServiceDetails.vue @@ -171,7 +171,7 @@ export default defineComponent({ StickyServiceDetails }, props: { - data: Object, + data: { type: Object, default: undefined, required: false }, dense: Boolean }, computed: { diff --git a/webui/src/components/_commons/PanelTLS.vue b/webui/src/components/_commons/PanelTLS.vue index eb7af91a8..905d8878f 100644 --- a/webui/src/components/_commons/PanelTLS.vue +++ b/webui/src/components/_commons/PanelTLS.vue @@ -77,12 +77,12 @@ {{ domain.main }} - {{ domain }} + {{ sanDomain }} @@ -130,8 +130,8 @@ export default defineComponent({ BooleanState }, props: { - data: Object, - protocol: String + data: { type: Object, default: undefined, required: false }, + protocol: { type: String, default: undefined, required: false } } }) diff --git a/webui/src/components/_commons/PanelWeightedServices.vue b/webui/src/components/_commons/PanelWeightedServices.vue index 178bc8d4b..b8eeaa72a 100644 --- a/webui/src/components/_commons/PanelWeightedServices.vue +++ b/webui/src/components/_commons/PanelWeightedServices.vue @@ -66,7 +66,7 @@ export default defineComponent({ name: 'PanelWeightedServices', components: {}, props: { - data: Object, + data: { type: Object, default: undefined, required: false }, dense: Boolean }, computed: { diff --git a/webui/src/components/_commons/ProviderIcon.vue b/webui/src/components/_commons/ProviderIcon.vue index 9be76c746..4511b696b 100644 --- a/webui/src/components/_commons/ProviderIcon.vue +++ b/webui/src/components/_commons/ProviderIcon.vue @@ -9,7 +9,7 @@ import { defineComponent } from 'vue' export default defineComponent({ props: { - name: String + name: { type: String, default: undefined, required: false } }, computed: { getLogoPath () { diff --git a/webui/src/components/_commons/StickyServiceDetails.vue b/webui/src/components/_commons/StickyServiceDetails.vue index f2e53f4a9..de81f1119 100644 --- a/webui/src/components/_commons/StickyServiceDetails.vue +++ b/webui/src/components/_commons/StickyServiceDetails.vue @@ -55,7 +55,7 @@ export default defineComponent({ BooleanState }, props: { - sticky: Object, + sticky: { type: Object, default: undefined, required: false }, dense: Boolean } }) diff --git a/webui/src/components/_commons/ToolBarTable.vue b/webui/src/components/_commons/ToolBarTable.vue index 03d4b6a52..65a6e3d6b 100644 --- a/webui/src/components/_commons/ToolBarTable.vue +++ b/webui/src/components/_commons/ToolBarTable.vue @@ -42,9 +42,10 @@ import Helps from '../../_helpers/Helps' export default defineComponent({ name: 'ToolBarTable', props: { - status: String, - filter: String + status: { type: String, default: undefined, required: false }, + filter: { type: String, default: undefined, required: false } }, + emits: ['update:status', 'update:filter'], computed: { getStatus: { get () { diff --git a/webui/src/components/dashboard/PanelChart.vue b/webui/src/components/dashboard/PanelChart.vue index 411de01e6..3f2bc0a8f 100644 --- a/webui/src/components/dashboard/PanelChart.vue +++ b/webui/src/components/dashboard/PanelChart.vue @@ -118,9 +118,9 @@ export default defineComponent({ AvatarState }, props: { - name: String, - data: Object, - type: String + name: { type: String, default: undefined, required: false }, + data: { type: Object, default: undefined, required: false }, + type: { type: String, default: undefined, required: false } }, data () { return { diff --git a/webui/src/components/dashboard/PanelEntry.vue b/webui/src/components/dashboard/PanelEntry.vue index 969c321b3..3077ce157 100644 --- a/webui/src/components/dashboard/PanelEntry.vue +++ b/webui/src/components/dashboard/PanelEntry.vue @@ -28,11 +28,11 @@ import { defineComponent } from 'vue' export default defineComponent({ name: 'PanelEntry', props: { - address: String, - name: String, - type: String, + address: { type: String, default: undefined, required: false }, + name: { type: String, default: undefined, required: false }, + type: { type: String, default: undefined, required: false }, focus: Boolean, - exSize: Number + exSize: { type: Number, default: undefined, required: false } } }) diff --git a/webui/src/components/dashboard/PanelFeature.vue b/webui/src/components/dashboard/PanelFeature.vue index 9edff71c8..1b3ee5b64 100644 --- a/webui/src/components/dashboard/PanelFeature.vue +++ b/webui/src/components/dashboard/PanelFeature.vue @@ -28,7 +28,10 @@