From 87177155d5380fc0e6274063fc4108c564c2ac9c Mon Sep 17 00:00:00 2001 From: tristanliu <37809633+sevenliu1896@users.noreply.github.com> Date: Tue, 11 Jun 2024 15:46:38 +0800 Subject: [PATCH] [improvement]supersonic-fe] Added support for starting in development mode. (#1127) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [improvement][semantic-fe] Add model alias setting & Add view permission restrictions to the model permission management tab. [improvement][semantic-fe] Add permission control to the action buttons for the main domain; apply high sensitivity filtering to the authorization of metrics/dimensions. [improvement][semantic-fe] Optimize the editing mode in the dimension/metric/datasource components to use the modelId stored in the database for data, instead of relying on the data from the state manager. * [improvement][semantic-fe] Add time granularity setting in the data source configuration. * [improvement][semantic-fe] Dictionary import for dimension values supported in Q&A visibility * [improvement][semantic-fe] Modification of data source creation prompt wording" * [improvement][semantic-fe] metric market experience optimization * [improvement][semantic-fe] enhance the analysis of metric trends * [improvement][semantic-fe] optimize the presentation of metric trend permissions * [improvement][semantic-fe] add metric trend download functionality * [improvement][semantic-fe] fix the dimension initialization issue in metric correlation * [improvement][semantic-fe] Fix the issue of database changes not taking effect when creating based on an SQL data source. * [improvement][semantic-fe] Optimizing pagination logic and some CSS styles * [improvement][semantic-fe] Fixing the API for the indicator list by changing "current" to "pageNum" * [improvement][semantic-fe] Fixing the default value setting for the indicator list * [improvement][semantic-fe] Adding batch operations for indicators/dimensions/models * [improvement][semantic-fe] Replacing the single status update API for indicators/dimensions with a batch update API * [improvement][semantic-fe] Redesigning the indicator homepage to incorporate trend charts and table functionality for indicators * [improvement][semantic-fe] Optimizing the logic for setting dimension values and editing data sources, and adding system settings functionality * [improvement][semantic-fe] Upgrading antd version to 5.x, extracting the batch operation button component, optimizing the interaction for system settings, and expanding the configuration generation types for list-to-select component. * [improvement][semantic-fe] Adding the ability to filter dimensions based on whether they are tags or not. * [improvement][semantic-fe] Adding the ability to edit relationships between models in the canvas. * [improvement][semantic-fe] Updating the datePicker component to use dayjs instead. * [improvement][semantic-fe] Fixing the issue with passing the model ID for dimensions in the indicator market. * [improvement][semantic-fe] Fixing the abnormal state of the popup when creating a model. * [improvement][semantic-fe] Adding permission logic for bulk operations in the indicator market. * [improvement][semantic-fe] Adding the ability to download and transpose data. * [improvement][semantic-fe] Fixing the initialization issue with the date selection component in the indicator details page when switching time granularity. * [improvement][semantic-fe] Fixing the logic error in the dimension value setting. * [improvement][semantic-fe] Fixing the synchronization issue with the question and answer settings information. * [improvement][semantic-fe] Optimizing the canvas functionality for better performance and user experience. * [improvement][semantic-fe] Optimizing the update process for drawing model relationship edges in the canvas. * [improvement][semantic-fe] Changing the line type for canvas connections. * [improvement][semantic-fe] Replacing the initialization variable from "semantic" to "headless". * [improvement][semantic-fe] Fixing the missing migration issue for default drill-down dimension configuration in model editing. Additionally, optimizing the data retrieval method for initializing fields in the model. * [improvement][semantic-fe] Updating the logic for the fieldName. * [improvement][semantic-fe] Adjusting the position of the metrics tab. * [improvement][semantic-fe] Changing the 字段名称 to 英文名称. * [improvement][semantic-fe] Fix metric measurement deletion. * [improvement][semantic-fe] UI optimization for metric details page. * [improvement][semantic-fe] UI optimization for metric details page. * [improvement][semantic-fe] UI adjustment for metric details page. * [improvement][semantic-fe] The granularity field in the time type of model editing now supports setting it as empty. * [improvement][semantic-fe] Added field type and metric type to the metric creation options. * [improvement][semantic-fe] The organization structure selection feature has been added to the permission management. * [improvement][semantic-fe] Improved user experience for the metric list. * [improvement][semantic-fe] fix update the metric list. * [improvement][headless-fe] Added view management functionality. * [improvement][headless-fe] The view management functionality has been added. This feature allows users to create, edit, and manage different views within the system. * [improvement][headless-fe] Added model editing side effect detection. * [improvement][headless-fe] Fixed the logic error in view editing. * [improvement][headless-fe] Fixed the issue with initializing dimension associations in metric settings. * [improvement][headless-fe] Added the ability to hide the Q&A settings entry point. * [improvement][headless-fe] Fixed the issue with selecting search results in metric field creation. * [improvement][headless-fe] Added search functionality to the field list in model editing. * [improvement][headless-fe] fix the field list in model editing * [improvement][headless-fe] Restructured the data for the dimension value settings interface. * [improvement][headless-fe] Added dynamic variable functionality to model creation based on SQL scripts. * [improvement][headless-fe] Added support for passing dynamic variables as parameters in the executeSql function. * [improvement][headless-fe] Resolved the issue where users were unable to select all options for dimensions, metrics, and fields in the metric generation process. * [improvement][headless-fe] Replaced the term "view" with "dataset" * [improvement][headless-fe] Added the ability to export metrics and dimensions to a specific target. * [improvement][headless-fe] Enhanced dataset creation to support the tag mode. * [improvement][headless-fe] Added tag value setting. * [improvement][headless-fe] Optimized the tag setting system. * [improvement][headless-fe] Optimized the tag setting system. * [improvement][headless-fe] Updated the data initialization for model editing to use API requests instead. * [improvement][headless-fe] Added search functionality to model management. * [improvement][headless-fe] Removed field null validation during model editing. * [improvement][headless-fe] Updated the batch operation button component. * [improvement][headless-fe] Optimized the logic for initializing indicators in dimension value settings. * [improvement][headless-fe] Adjusted the length of the input field for model editing names. * [improvement][headless-fe] Lock the version of the @ant-design/pro-table component and replace it with @ant-design/pro-components. * [improvement][headless-fe] Optimized the style of the metrics market and tags market. * [improvement][headless-fe] The quick creation of model fields now defaults to using the "comment" field for filling. * [improvement][headless-fe] The quick creation of model fields now defaults to using the "comment" field for filling * [improvement][headless-fe] The quick creation of model fields now defaults to using the "comment" field for filling. * [improvement][headless-fe] Fixed the issue where the conditions for metric measurement creation were not being saved correctly. * [improvement][headless-fe] Default value setting for hiding dimensions. * [improvement][headless-fe] Updated the file imports in the project. * [improvement][headless-fe] Adjusted the logic for displaying the tab in the theme domain. * [improvement][headless-fe] Added term management functionality. * [improvement][headless-fe] When creating a model, the current metric operator now allows for clearance. * [improvement][headless-fe] Term management interface transformation * [improvement][headless-fe] Migrating scaffold version to @umi/max * [improvement][headless-fe] remove modle column * [improvement][headless-fe] 1.Added configuration for the large language model in the agent; 2.upgraded React version from 17 to 18; 3.modified some UI effects. * [improvement][headless-fe] Added a simplified mode to the question-answering system. * [improvement][headless-fe] remove pnpm-lock * [improvement][headless-fe] add pnpm-lock * [improvement][headless-fe] Fixed the issue with passing the modelId during initialization. * [improvement][headless-fe] Fixed the issue with abnormal comments during model creation. * [improvement][headless-fe] fix build bugs * [improvement][headless-fe] change build config * [improvement][headless-fe] route config change * [improvement][headless-fe] Optimized data updating when switching domains. * [improvement][headless-fe] css change * [improvement][semantic-fe] logo css change * [improvement][semantic-fe] system config add defaultValue support * [improvement][semantic-fe] tag mode wording change * [improvement][semantic-fe] fix metric edit page init error * [improvement][supersonic-fe] Updated the way chat projects are imported in supersonic-fe. * [improvement][supersonic-fe] Added a background silent mode for watching chat projects. --- webapp/packages/chat-sdk/package.json | 10 +++-- .../packages/supersonic-fe/config/config.ts | 5 ++- webapp/packages/supersonic-fe/config/proxy.ts | 3 +- webapp/packages/supersonic-fe/package.json | 5 +-- webapp/pnpm-lock.yaml | 24 +++++------- webapp/start-fe-pnpm-workspace-dev.bat | 39 +++++++++++++++++++ webapp/start-fe-pnpm-workspace-dev.sh | 27 +++++++++++++ 7 files changed, 88 insertions(+), 25 deletions(-) create mode 100644 webapp/start-fe-pnpm-workspace-dev.bat create mode 100755 webapp/start-fe-pnpm-workspace-dev.sh diff --git a/webapp/packages/chat-sdk/package.json b/webapp/packages/chat-sdk/package.json index 0e9780605..dda58c264 100644 --- a/webapp/packages/chat-sdk/package.json +++ b/webapp/packages/chat-sdk/package.json @@ -35,6 +35,8 @@ "scripts": { "start": "npm run start:dev", "start:dev": "node scripts/start.js", + "watch": "rollup -c rollup/rollup.esm.config.mjs --watch", + "watch:bg": "rollup -c rollup/rollup.esm.config.mjs --watch &", "clean": "rimraf ./dist", "build": "npm run clean && npm run build-es", "test": "node scripts/test.js", @@ -85,8 +87,8 @@ "@types/jest": "^27.5.2", "@types/lodash": "^4.14.198", "@types/node": "^16.18.31", - "@types/react": "^18.2.6", - "@types/react-dom": "^18.2.4", + "@types/react": "^18.3.0", + "@types/react-dom": "^18.3.0", "autoprefixer": "^10.4.14", "babel-jest": "^27.4.2", "babel-loader": "^8.2.3", @@ -122,10 +124,10 @@ "postcss-normalize": "^10.0.1", "postcss-preset-env": "^7.0.1", "prompts": "^2.4.2", - "react": "^18.2.0", + "react": "^18.3.1", "react-app-polyfill": "^3.0.0", "react-dev-utils": "^12.0.1", - "react-dom": "^18.2.0", + "react-dom": "^18.3.0", "react-refresh": "^0.11.0", "resolve": "^1.20.0", "resolve-url-loader": "^4.0.0", diff --git a/webapp/packages/supersonic-fe/config/config.ts b/webapp/packages/supersonic-fe/config/config.ts index 8554def86..95fa5d527 100644 --- a/webapp/packages/supersonic-fe/config/config.ts +++ b/webapp/packages/supersonic-fe/config/config.ts @@ -1,6 +1,6 @@ // https://umijs.org/config/ import { defineConfig } from '@umijs/max'; -// import { join } from 'path'; +import path from 'path'; import defaultSettings, { publicPath, basePath } from './defaultSettings'; import proxy from './proxy'; import routes from './routes'; @@ -180,5 +180,8 @@ export default defineConfig({ }, requestRecord: {}, exportStatic: {}, + alias: { + 'supersonic-chat-sdk': path.resolve(__dirname, '../../chat-sdk/src/'), + }, // esbuildMinifyIIFE: true, }); diff --git a/webapp/packages/supersonic-fe/config/proxy.ts b/webapp/packages/supersonic-fe/config/proxy.ts index 166919713..8ab959470 100644 --- a/webapp/packages/supersonic-fe/config/proxy.ts +++ b/webapp/packages/supersonic-fe/config/proxy.ts @@ -1,7 +1,8 @@ export default { dev: { '/api/': { - target: 'http://localhost:9080', + // target: 'http://localhost:9080', + target: 'http://supersonic-pre.tmeoa.com/', changeOrigin: true, }, }, diff --git a/webapp/packages/supersonic-fe/package.json b/webapp/packages/supersonic-fe/package.json index fa2a5cc2f..c9277eaba 100644 --- a/webapp/packages/supersonic-fe/package.json +++ b/webapp/packages/supersonic-fe/package.json @@ -95,7 +95,7 @@ "react-split-pane": "^2.0.3", "react-syntax-highlighter": "^15.4.3", "sql-formatter": "^2.3.3", - "supersonic-chat-sdk": "0.0.0", + "supersonic-chat-sdk": "workspace:*", "supersonic-insights-flow-components": "^1.4.9", "umi-request": "1.4.0" }, @@ -137,8 +137,5 @@ "engines": { "node": ">=16.0.0 <20.0.0" }, - "resolutions": { - "@types/react": "18.3.1" - }, "__npminstall_done": false } \ No newline at end of file diff --git a/webapp/pnpm-lock.yaml b/webapp/pnpm-lock.yaml index 8a1303a28..f4a6ded1d 100644 --- a/webapp/pnpm-lock.yaml +++ b/webapp/pnpm-lock.yaml @@ -52,7 +52,7 @@ importers: version: 1.4.4(react-dom@18.3.1)(react@18.3.1) react-markdown: specifier: ^9.0.1 - version: 9.0.1(@types/react@18.3.2)(react@18.3.1) + version: 9.0.1(@types/react@18.3.1)(react@18.3.1) react-spinners: specifier: ^0.13.8 version: 0.13.8(react-dom@18.3.1)(react@18.3.1) @@ -115,10 +115,10 @@ importers: specifier: ^16.18.31 version: 16.18.97 '@types/react': - specifier: ^18.2.6 - version: 18.3.2 + specifier: ^18.3.0 + version: 18.3.1 '@types/react-dom': - specifier: ^18.2.4 + specifier: ^18.3.0 version: 18.3.0 autoprefixer: specifier: ^10.4.14 @@ -226,7 +226,7 @@ importers: specifier: ^2.4.2 version: 2.4.2 react: - specifier: ^18.2.0 + specifier: ^18.3.1 version: 18.3.1 react-app-polyfill: specifier: ^3.0.0 @@ -235,7 +235,7 @@ importers: specifier: ^12.0.1 version: 12.0.1(eslint@8.57.0)(typescript@4.9.5)(webpack@5.91.0) react-dom: - specifier: ^18.2.0 + specifier: ^18.3.0 version: 18.3.1(react@18.3.1) react-refresh: specifier: ^0.11.0 @@ -427,7 +427,7 @@ importers: specifier: ^2.3.3 version: 2.3.4 supersonic-chat-sdk: - specifier: 0.0.0 + specifier: workspace:* version: link:../chat-sdk supersonic-insights-flow-components: specifier: ^1.4.9 @@ -6449,12 +6449,6 @@ packages: '@types/prop-types': 15.7.12 csstype: 3.1.3 - /@types/react@18.3.2: - resolution: {integrity: sha512-Btgg89dAnqD4vV7R3hlwOxgqobUQKgx3MmrQRi0yYbs/P0ym8XozIAlkqVilPqHQwXs4e9Tf63rrCgl58BcO4w==} - dependencies: - '@types/prop-types': 15.7.12 - csstype: 3.1.3 - /@types/resolve@1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: @@ -22759,14 +22753,14 @@ packages: /react-lifecycles-compat@3.0.4: resolution: {integrity: sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==} - /react-markdown@9.0.1(@types/react@18.3.2)(react@18.3.1): + /react-markdown@9.0.1(@types/react@18.3.1)(react@18.3.1): resolution: {integrity: sha512-186Gw/vF1uRkydbsOIkcGXw7aHq0sZOCRFFjGrr7b9+nVZg4UfA4enXCaxm4fUzecU38sWfrNDitGhshuU7rdg==} peerDependencies: '@types/react': '>=18' react: '>=18' dependencies: '@types/hast': 3.0.4 - '@types/react': 18.3.2 + '@types/react': 18.3.1 devlop: 1.1.0 hast-util-to-jsx-runtime: 2.3.0 html-url-attributes: 3.0.0 diff --git a/webapp/start-fe-pnpm-workspace-dev.bat b/webapp/start-fe-pnpm-workspace-dev.bat new file mode 100644 index 000000000..4fe9129b2 --- /dev/null +++ b/webapp/start-fe-pnpm-workspace-dev.bat @@ -0,0 +1,39 @@ +@echo off + +for /f "delims=" %%i in ('node -v') do set "node_version=%%i" + +for /f "tokens=2 delims=v." %%i in ("%node_version%") do set "major_version=%%i" + +if %major_version% GEQ 17 ( + set "NODE_OPTIONS=--openssl-legacy-provider" + echo Node.js version is greater than or equal to 17. NODE_OPTIONS has been set to --openssl-legacy-provider. +) +where /q pnpm +if errorlevel 1 ( + echo pnpm is not installed. Installing... + npm install -g pnpm + if errorlevel 1 ( + echo Failed to install pnpm. Please check if npm is installed and the network connection is working. + ) else ( + echo pnpm installed successfully. + ) +) else ( + echo pnpm is already installed. +) + +rmdir /s /q ".\packages\supersonic-fe\src\.umi" +rmdir /s /q ".\packages\supersonic-fe\src\.umi-production" + +cd ./packages/chat-sdk + +call pnpm i + +call pnpm run build + +call npm run watch:bg + +cd ../supersonic-fe + +call pnpm i + +call npm run start \ No newline at end of file diff --git a/webapp/start-fe-pnpm-workspace-dev.sh b/webapp/start-fe-pnpm-workspace-dev.sh new file mode 100755 index 000000000..adebe227f --- /dev/null +++ b/webapp/start-fe-pnpm-workspace-dev.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +node_version=$(node -v) + +major_version=$(echo $node_version | cut -d'.' -f1 | tr -d 'v') + +if [ $major_version -ge 17 ]; then + export NODE_OPTIONS=--openssl-legacy-provider +fi + +if ! command -v pnpm >/dev/null 2>&1; then + npm i -g pnpm +fi + +rm -rf ./packages/supersonic-fe/src/.umi ./packages/supersonic-fe/src/.umi-production + +cd ./packages/chat-sdk + +pnpm i + +npm run watch:bg + +cd ../supersonic-fe + +pnpm i + +npm run start