Skip to content

Commit c807674

Browse files
authored
Merge pull request #5294 from WeDataSphere/master-feature-web
Master feature web
2 parents c0223f8 + ae9238c commit c807674

File tree

88 files changed

+3979
-568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+3979
-568
lines changed

linkis-web/.env

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
VUE_APP_HOST=
2-
BACKEND_URL=http://127.0.0.1:9001
32
VUE_APP_MN_CONFIG_PREFIX=
43
VUE_APP_MN_CONFIG_SOCKET=/ws/api/entrance/connect
54
VUE_APP_VERSION=1.8.0
5+
# Enable or disable Python Module feature (true/false)
6+
# Set to false if you cannot access @webank internal npm packages
7+
VUE_APP_ENABLE_PYTHON_MODULE=false

linkis-web/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
.vscode
33
.cache
44
.idea/
5+
.fes
56

67
node_modules/
78
dist/
89

9-
package-lock.json
1010
apache-linkis-*.tar.gz
1111
./cn.json
1212
.env.*
13+
package-lock.json
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Python Module Feature Toggle - Implementation Summary
2+
3+
## Changes Made
4+
5+
### 1. Environment Variable Configuration
6+
**File**: `.env`
7+
- Added `VUE_APP_ENABLE_PYTHON_MODULE=false` (default disabled)
8+
- This controls whether the Python Module feature is available
9+
10+
### 2. Router Configuration
11+
**File**: `src/apps/linkis/router.js`
12+
13+
**Changes**:
14+
- Added environment variable check: `export const isPythonModuleEnabled = process.env.VUE_APP_ENABLE_PYTHON_MODULE === 'true'`
15+
- Modified pythonModule route to be conditionally loaded:
16+
```javascript
17+
...(isPythonModuleEnabled ? [{
18+
name: 'pythonModule',
19+
path: 'pythonModule',
20+
component: () => import('./module/pythonModule/index.vue'),
21+
meta: {
22+
title: 'pythonModule',
23+
publicPage: true,
24+
},
25+
}] : []),
26+
```
27+
28+
### 3. View Component Updates
29+
**File**: `src/apps/linkis/view/linkis/index.vue`
30+
31+
**Changes**:
32+
- Imported `isPythonModuleEnabled` from router
33+
- Added to component data: `isPythonModuleEnabled: isPythonModuleEnabled`
34+
- Modified sidebar menu visibility condition to hide Python Module when disabled:
35+
```javascript
36+
v-if="(!isLogAdmin? ...) && (item.key !== '1-13' || isPythonModuleEnabled)"
37+
```
38+
- Updated default redirect logic in `mounted()`:
39+
```javascript
40+
if(!localStorage.getItem('hasRead')) {
41+
if (isPythonModuleEnabled) {
42+
this.clickToRoute('1-13-1') // Python Module
43+
} else {
44+
this.clickToRoute('1-1') // Global History
45+
}
46+
}
47+
```
48+
49+
## Feature Behavior
50+
51+
### When VUE_APP_ENABLE_PYTHON_MODULE=false (Default)
52+
**Recommended for users without WeBank npm registry access**
53+
54+
- Python Module route is NOT registered
55+
- Python Module menu item is HIDDEN from sidebar
56+
- After login, users are redirected to **Global History** page
57+
- Accessing `/console/pythonModule` directly will show 404 error
58+
- No dependency on internal `@webank` packages required
59+
60+
### When VUE_APP_ENABLE_PYTHON_MODULE=true
61+
⚠️ **Requires WeBank internal npm registry access**
62+
63+
- Python Module route is registered
64+
- Python Module menu item is VISIBLE in sidebar
65+
- After login, users are redirected to **Python Module** page (if first time)
66+
- Accessing `/console/pythonModule` directly works normally
67+
- Requires successful build of PythonModule sub-application
68+
69+
## Testing
70+
71+
To test the feature toggle:
72+
73+
### Test 1: Disabled State (Default)
74+
```bash
75+
# 1. Ensure .env has VUE_APP_ENABLE_PYTHON_MODULE=false
76+
cat linkis-web/.env | grep VUE_APP_ENABLE_PYTHON_MODULE
77+
78+
# 2. Rebuild
79+
cd linkis-web
80+
npm run build
81+
82+
# 3. Verify behavior:
83+
# - Python Module menu should NOT appear in sidebar
84+
# - Login should redirect to Global History
85+
# - /console/pythonModule should return 404
86+
```
87+
88+
### Test 2: Enabled State
89+
```bash
90+
# 1. Update .env
91+
echo "VUE_APP_ENABLE_PYTHON_MODULE=true" >> linkis-web/.env
92+
93+
# 2. Rebuild
94+
cd linkis-web
95+
npm run build
96+
97+
# 3. Verify behavior:
98+
# - Python Module menu should appear in sidebar
99+
# - Login should redirect to Python Module
100+
# - /console/pythonModule should work (if built)
101+
```
102+
103+
## Migration Notes
104+
105+
- **Backward Compatibility**: Default is `false`, so existing deployments won't be affected
106+
- **No Breaking Changes**: All other features remain unchanged
107+
- **Easy Rollback**: Simply set `VUE_APP_ENABLE_PYTHON_MODULE=false` and rebuild
108+
109+
## Documentation
110+
111+
- Detailed configuration guide: `PYTHON_MODULE_CONFIG.md`
112+
- This summary document: `PYTHON_MODULE_CHANGES.md`
113+
114+
## Next Steps
115+
116+
For users who want to enable Python Module:
117+
1. Obtain access to WeBank internal npm registry
118+
2. Configure `.npmrc` with registry credentials
119+
3. Set `VUE_APP_ENABLE_PYTHON_MODULE=true` in `.env`
120+
4. Run `npm run installAll` to install all dependencies
121+
5. Run `npm run buildSubModule` to build Python Module
122+
6. Run `npm run build` to build main application

linkis-web/PYTHON_MODULE_CONFIG.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Python Module Feature Configuration
2+
3+
## Overview
4+
5+
The Python Module feature can be enabled or disabled via environment variable configuration. This feature depends on internal WeBank npm packages (`@webank/fes-design-material`, `@webank/letgo-components`) which are not publicly available.
6+
7+
## Configuration
8+
9+
### Environment Variable
10+
11+
Edit the `.env` file in the `linkis-web` root directory:
12+
13+
```bash
14+
# Enable or disable Python Module feature (true/false)
15+
# Set to false if you cannot access @webank internal npm packages
16+
VUE_APP_ENABLE_PYTHON_MODULE=false
17+
```
18+
19+
### Options
20+
21+
- `VUE_APP_ENABLE_PYTHON_MODULE=true`: Enable Python Module feature
22+
- The Python Module menu item will be displayed in the sidebar
23+
- After login, users will be redirected to the Python Module page
24+
- Requires access to WeBank internal npm registry to build
25+
26+
- `VUE_APP_ENABLE_PYTHON_MODULE=false`: Disable Python Module feature (Default)
27+
- The Python Module menu item will be hidden from the sidebar
28+
- After login, users will be redirected to the Global History page
29+
- No special npm registry access required
30+
31+
## Implementation Details
32+
33+
### Modified Files
34+
35+
1. **`.env`**: Added `VUE_APP_ENABLE_PYTHON_MODULE` environment variable
36+
2. **`src/apps/linkis/router.js`**:
37+
- Added `isPythonModuleEnabled` constant
38+
- Conditionally load pythonModule route
39+
3. **`src/apps/linkis/view/linkis/index.vue`**:
40+
- Import `isPythonModuleEnabled` from router
41+
- Conditionally display pythonModule in sidebar menu
42+
- Modified default redirect logic based on feature flag
43+
44+
### Behavior
45+
46+
When `VUE_APP_ENABLE_PYTHON_MODULE=false`:
47+
- ❌ Python Module route is not registered
48+
- ❌ Python Module menu item is hidden
49+
- ✅ Users are redirected to Global History page after login
50+
- ✅ Direct access to `/console/pythonModule` will show 404
51+
52+
When `VUE_APP_ENABLE_PYTHON_MODULE=true`:
53+
- ✅ Python Module route is registered
54+
- ✅ Python Module menu item is visible
55+
- ✅ Users are redirected to Python Module page after login (if not `hasRead`)
56+
- ✅ Direct access to `/console/pythonModule` works
57+
58+
## Building
59+
60+
After changing the environment variable:
61+
62+
```bash
63+
# Rebuild the project
64+
cd linkis-web
65+
npm run build
66+
```
67+
68+
## For Internal Users
69+
70+
If you have access to WeBank's internal npm registry:
71+
72+
1. Set `VUE_APP_ENABLE_PYTHON_MODULE=true` in `.env`
73+
2. Configure npm registry (contact your administrator for registry URL)
74+
3. Install dependencies: `npm run installAll`
75+
4. Build PythonModule: `npm run buildSubModule`
76+
5. Build main application: `npm run build`
77+
78+
## Troubleshooting
79+
80+
### Issue: 404 Error when accessing Python Module
81+
82+
**Solution**: Check that `VUE_APP_ENABLE_PYTHON_MODULE=true` and rebuild the application
83+
84+
### Issue: Python Module menu not showing
85+
86+
**Solution**:
87+
1. Verify `.env` has `VUE_APP_ENABLE_PYTHON_MODULE=true`
88+
2. Clear browser cache
89+
3. Rebuild: `npm run build`
90+
91+
### Issue: Cannot install dependencies for PythonModule
92+
93+
**Solution**:
94+
1. Set `VUE_APP_ENABLE_PYTHON_MODULE=false` to disable the feature
95+
2. Or configure access to WeBank internal npm registry

linkis-web/package.json

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"lint": "vue-cli-service lint --no-fix",
99
"fix": "eslint --ext .js,.vue src --fix",
1010
"precommit": "lint-staged",
11-
"preinstall": "npm install --package-lock-only --ignore-scripts && npx npm-force-resolutions"
11+
"preinstall": "npm install --package-lock-only --ignore-scripts && npx npm-force-resolutions",
12+
"buildSubModule": "cd src/apps/PythonModule && npm run build:prod && cd ../../..",
13+
"installAll": "npm install && cd src/apps/PythonModule && npm install --legacy-peer-deps && cd ../../.."
1214
},
1315
"husky": {
1416
"hooks": {
@@ -23,62 +25,65 @@
2325
},
2426
"dependencies": {
2527
"@form-create/iview": "2.5.27",
26-
"axios": "1.12.0",
27-
"babel-polyfill": "6.26.0",
28-
"core-js": "3.27.2",
28+
"axios": "1.12.2",
2929
"dexie": "3.2.3",
3030
"dt-sql-parser": "3.0.5",
31-
"eslint": "7.21.0",
32-
"eslint-plugin-vue": "9.6.0",
31+
"echarts": "^5.6.0",
3332
"highlight.js": "10.7.0",
33+
"hint.css": "^2.7.0",
3434
"iview": "3.5.4",
3535
"jsencrypt": "3.2.1",
3636
"lodash": "4.17.21",
3737
"md5": "2.3.0",
38-
"mitt": "1.2.0",
3938
"moment": "2.29.4",
4039
"monaco-editor": "0.30.1",
4140
"object-to-formdata": "4.2.2",
4241
"path-browserify": "1.0.1",
43-
"postcss": "8.4.31",
4442
"qs": "6.11.0",
4543
"reconnecting-websocket": "4.4.0",
44+
"sass": "1.77.8",
4645
"sql-formatter": "2.3.3",
4746
"svgo": "3.0.2",
4847
"v-jsoneditor": "1.4.5",
49-
"vue": "3.0.0",
48+
"vue": "2.6.12",
5049
"vue-i18n": "8.22.1",
5150
"vue-router": "3.4.8",
5251
"vuedraggable": "2.24.3",
5352
"vuescroll": "4.16.1",
5453
"worker-loader": "3.0.8",
55-
"echarts": "^5.1.1"
54+
"xterm": "5.3.0",
55+
"xterm-addon-fit": "0.8.0"
5656
},
5757
"devDependencies": {
5858
"@intlify/vue-i18n-loader": "1.0.0",
59-
"@vue/cli-plugin-babel": "5.0.8",
59+
"@vue/cli-plugin-babel": "5.0.1",
6060
"@vue/cli-plugin-eslint": "5.0.8",
6161
"@vue/cli-service": "5.0.8",
6262
"@vue/eslint-config-standard": "4.0.0",
6363
"archiver": "3.1.1",
6464
"autoprefixer": "10.4.14",
6565
"babel-eslint": "10.1.0",
66+
"babel-polyfill": "6.26.0",
6667
"copy-webpack-plugin": "9.1.0",
68+
"core-js": "3.27.2",
6769
"csp-html-webpack-plugin": "5.1.0",
70+
"eslint": "7.21.0",
71+
"eslint-plugin-vue": "9.6.0",
6872
"filemanager-webpack-plugin": "7.0.0",
6973
"husky": "1.3.1",
7074
"lint-staged": "13.1.1",
7175
"material-design-icons": "3.0.1",
76+
"mitt": "1.2.0",
7277
"monaco-editor-webpack-plugin": "6.0.0",
73-
"node-sass": "8.0.0",
7478
"npm-force-resolutions": "0.0.10",
79+
"postcss": "8.4.21",
7580
"sass-loader": "10.4.1",
7681
"svg-sprite-loader": "6.0.0",
7782
"vue-cli-plugin-mockjs": "0.1.3",
7883
"vue-template-compiler": "2.6.12",
7984
"webpack-virtual-modules": "0.3.2"
8085
},
8186
"resolutions": {
82-
"postcss": "8.4.31"
87+
"postcss": "8.4.21"
8388
}
8489
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
* text=auto
2+
* text eol=lf
3+
*.png binary
4+
*.gif binary
5+
*.ttf binary
6+
*.woff binary
7+
*.eot binary
8+
*.woff binary
9+
*.otf binary

linkis-web/src/apps/PythonModule/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
~ limitations under the License.
1616
-->
1717

18-
<!DOCTYPE html>
18+
<!DOCTYPE html>
1919
<html lang="en">
2020
<head>
2121
<meta charset="UTF-8">
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"dependencies": {
3+
"core-js": "3.35.1",
4+
"vue": "3.3.9",
5+
"@vueuse/core": "10.9.0",
6+
"lodash-es": "4.17.21",
7+
"@qlin/request": "0.2.6",
8+
"@webank/letgo-components": "1.1.4",
9+
"@fesjs/fes-design": "0.8.60",
10+
"@webank/fes-design-material": "0.2.31",
11+
"@fesjs/traction-widget": "1.9.1",
12+
"dayjs": "1.11.9",
13+
"lodash": "4.17.21",
14+
"@fesjs/fes": "3.1.10",
15+
"@fesjs/plugin-model": "3.0.1",
16+
"@fesjs/plugin-request": "4.0.0-rc.3",
17+
"@fesjs/plugin-locale": "4.2.5",
18+
"@fesjs/builder-vite": "4.0.2"
19+
},
20+
"name": "linkis",
21+
"version": "1.0.0",
22+
"scripts": {
23+
"build:test": "cross-env FES_ENV=test fes build",
24+
"build:prod": "cross-env FES_ENV=prod fes build",
25+
"analyze": "cross-env ANALYZE=1 fes build",
26+
"dev": "fes dev"
27+
},
28+
"devDependencies": {
29+
"typescript": "5.3.3",
30+
"cross-env": "7.0.3"
31+
}
32+
}

0 commit comments

Comments
 (0)