Skip to content

Commit

Permalink
fix: web translate extension
Browse files Browse the repository at this point in the history
  • Loading branch information
scarqin committed Nov 4, 2022
1 parent ede1dfa commit 90385ef
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 14 deletions.
157 changes: 156 additions & 1 deletion src/workbench/browser/angular.json
Original file line number Diff line number Diff line change
@@ -1 +1,156 @@
{"$schema":"./node_modules/@angular/cli/lib/config/schema.json","cli":{"analytics":false,"defaultCollection":"@angular-eslint/schematics"},"version":1,"newProjectRoot":"projects","projects":{"eoapi":{"root":"","i18n":{"sourceLocale":{"code":"en"},"locales":{"zh":{"translation":"src/locale/messages.zh.xlf"}}},"sourceRoot":"src","projectType":"application","schematics":{"@schematics/angular:application":{"strict":true}},"architect":{"build":{"builder":"@angular-builders/custom-webpack:browser","options":{"localize":true,"aot":true,"outputPath":"dist","index":"src/index.html","main":"src/main.ts","tsConfig":"src/tsconfig.app.json","polyfills":"src/polyfills.ts","assets":["src/icon.ico","src/assets",{"glob":"**/*","input":"../../../node_modules/monaco-editor/min/vs","output":"/assets/vs/"}],"styles":[{"input":"src/assets/theme/classic_forest.scss","bundleName":"classic_forest","inject":false},"src/assets/theme/antd.less","src/styles.scss","src/assets/font/iconfont.css","src/ng1/index.css"],"scripts":["src/ng1/lib/angular/angular.js","src/ng1/app.module.js","src/ng1/component/select-default.js","src/ng1/component/sort-and-filter.js","src/ng1/component/auto-complete.js","src/ng1/component/list-block.js","src/ng1/directive/get-dom-length.directive.js","src/ng1/directive/drop-down-menu.directive.js","src/ng1/directive/sort.directive.js","src/ng1/directive/drop-change-space.directive.js","src/ng1/directive/inner-html.directive.js","src/ng1/directive/insert-html.directive.js","src/ng1/directive/copy-common.directive.js","src/assets/libs/protocolcheck.js"],"customWebpackConfig":{"path":"./angular.webpack.js","replaceDuplicatePlugins":true},"allowedCommonJsDependencies":["brace","qs","rxjs"]},"configurations":{"dev":{"optimization":false,"outputHashing":"none","sourceMap":true,"namedChunks":false,"localize":false,"extractLicenses":true,"vendorChunk":false,"buildOptimizer":false,"fileReplacements":[{"replace":"src/environments/environment.ts","with":"src/environments/environment.dev.ts"}]},"devCn":{"optimization":false,"outputHashing":"none","sourceMap":true,"namedChunks":false,"localize":["zh"],"extractLicenses":true,"vendorChunk":false,"buildOptimizer":false,"fileReplacements":[{"replace":"src/environments/environment.ts","with":"src/environments/environment.dev.ts"}]},"production":{"optimization":true,"outputHashing":"all","sourceMap":false,"namedChunks":false,"extractLicenses":true,"vendorChunk":false,"buildOptimizer":true,"fileReplacements":[{"replace":"src/environments/environment.ts","with":"src/environments/environment.prod.ts"}]},"docker":{"optimization":true,"outputHashing":"all","sourceMap":false,"namedChunks":false,"extractLicenses":true,"vendorChunk":false,"buildOptimizer":true,"fileReplacements":[{"replace":"src/environments/environment.ts","with":"src/environments/environment.docker.ts"}]}}},"serve":{"builder":"@angular-builders/custom-webpack:dev-server","options":{"browserTarget":"eoapi:build"},"configurations":{"dev":{"browserTarget":"eoapi:build:dev"},"devCn":{"browserTarget":"eoapi:build:devCn"},"production":{"browserTarget":"eoapi:build:production"}}},"extract-i18n":{"builder":"@angular-devkit/build-angular:extract-i18n","options":{"browserTarget":"eoapi:build"}},"test":{"builder":"@angular-builders/custom-webpack:karma","options":{"main":"src/test.ts","polyfills":"src/polyfills-test.ts","tsConfig":"src/tsconfig.spec.json","karmaConfig":"src/karma.conf.js","scripts":[],"styles":["src/styles.scss"],"assets":["src/assets"],"customWebpackConfig":{"path":"./angular.webpack.js","replaceDuplicatePlugins":true}}},"lint":{"builder":"@angular-eslint/builder:lint","options":{"lintFilePatterns":["src/**/*.ts","src/**/*.html"]}}}},"eoapi-e2e":{"root":"e2e","projectType":"application","architect":{"lint":{"builder":"@angular-eslint/builder:lint","options":{"lintFilePatterns":["e2e/**/*.ts"]}}}}},"defaultProject":"eoapi","schematics":{"@schematics/angular:component":{"prefix":"eo","style":"scss"},"@schematics/angular:directive":{"prefix":"eo"}}}
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"cli": { "analytics": false, "defaultCollection": "@angular-eslint/schematics" },
"version": 1,
"newProjectRoot": "projects",
"projects": {
"eoapi": {
"root": "",
"i18n": {
"sourceLocale": { "code": "en", "baseHref": "" },
"locales": { "zh": { "translation": "src/locale/messages.zh.xlf", "baseHref": "" } }
},
"sourceRoot": "src",
"projectType": "application",
"schematics": { "@schematics/angular:application": { "strict": true } },
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"localize": true,
"aot": true,
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/icon.ico",
"src/assets",
{ "glob": "**/*", "input": "../../../node_modules/monaco-editor/min/vs", "output": "/assets/vs/" }
],
"styles": [
{ "input": "src/assets/theme/classic_forest.scss", "bundleName": "classic_forest", "inject": false },
"src/assets/theme/antd.less",
"src/styles.scss",
"src/assets/font/iconfont.css",
"src/ng1/index.css"
],
"scripts": [
"src/ng1/lib/angular/angular.js",
"src/ng1/app.module.js",
"src/ng1/component/select-default.js",
"src/ng1/component/sort-and-filter.js",
"src/ng1/component/auto-complete.js",
"src/ng1/component/list-block.js",
"src/ng1/directive/get-dom-length.directive.js",
"src/ng1/directive/drop-down-menu.directive.js",
"src/ng1/directive/sort.directive.js",
"src/ng1/directive/drop-change-space.directive.js",
"src/ng1/directive/inner-html.directive.js",
"src/ng1/directive/insert-html.directive.js",
"src/ng1/directive/copy-common.directive.js",
"src/assets/libs/protocolcheck.js"
],
"customWebpackConfig": { "path": "./angular.webpack.js", "replaceDuplicatePlugins": true },
"allowedCommonJsDependencies": ["brace", "qs", "rxjs"]
},
"configurations": {
"dev": {
"optimization": false,
"outputHashing": "none",
"sourceMap": true,
"namedChunks": false,
"localize": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": false,
"fileReplacements": [
{ "replace": "src/environments/environment.ts", "with": "src/environments/environment.dev.ts" }
]
},
"devCn": {
"optimization": false,
"outputHashing": "none",
"sourceMap": true,
"namedChunks": false,
"localize": ["zh"],
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": false,
"fileReplacements": [
{ "replace": "src/environments/environment.ts", "with": "src/environments/environment.dev.ts" }
]
},
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{ "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts" }
]
},
"docker": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{ "replace": "src/environments/environment.ts", "with": "src/environments/environment.docker.ts" }
]
}
}
},
"serve": {
"builder": "@angular-builders/custom-webpack:dev-server",
"options": { "browserTarget": "eoapi:build" },
"configurations": {
"dev": { "browserTarget": "eoapi:build:dev" },
"devCn": { "browserTarget": "eoapi:build:devCn" },
"production": { "browserTarget": "eoapi:build:production" }
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": { "browserTarget": "eoapi:build" }
},
"test": {
"builder": "@angular-builders/custom-webpack:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills-test.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"scripts": [],
"styles": ["src/styles.scss"],
"assets": ["src/assets"],
"customWebpackConfig": { "path": "./angular.webpack.js", "replaceDuplicatePlugins": true }
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": { "lintFilePatterns": ["src/**/*.ts", "src/**/*.html"] }
}
}
},
"eoapi-e2e": {
"root": "e2e",
"projectType": "application",
"architect": {
"lint": { "builder": "@angular-eslint/builder:lint", "options": { "lintFilePatterns": ["e2e/**/*.ts"] } }
}
}
},
"defaultProject": "eoapi",
"schematics": {
"@schematics/angular:component": { "prefix": "eo", "style": "scss" },
"@schematics/angular:directive": { "prefix": "eo" }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export class ExtensionComponent implements OnInit {
title: $localize`Official`,
isLeaf: true,
},
{
key: 'installed',
title: $localize`Installed`,
isLeaf: true,
},
];
fixedTreeNode: GroupTreeItem[] | NzTreeNode[] = [
{
Expand Down Expand Up @@ -53,11 +58,6 @@ export class ExtensionComponent implements OnInit {
ngOnInit(): void {
this.watchRouterChange();
this.setSelectedKeys();
this.treeNodes.push({
key: 'installed',
title: $localize`Installed`,
isLeaf: true,
});
}

onSeachChange(keyword) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ export class ExtensionService {
result.data = [
...result.data.filter((val) => installList.every((childVal) => childVal.name !== val.name)),
//Local debug package
...installList,
...installList.map((module) => {
if (installList.find((it) => it.name === module.name)) {
module.i18n = result.data.find((it) => it.name === module.name)?.i18n;
}
return module;
}),
];
result.data = result.data.map((module) => this.translateModule(module));
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class ExtensionListComponent implements OnInit {
const timeStart = Date.now();
try {
if (this.type === 'installed') {
const installedList = new ExtensionList(this.extensionService.getInstalledList());
const installedList = new ExtensionList(this.extensionService.getInstalledList());
return installedList.search(keyword).map((n) => {
n.isEnable = this.extensionService.isEnable(n.name);
return n;
Expand All @@ -66,11 +66,6 @@ export class ExtensionListComponent implements OnInit {
}
return new ExtensionList(res.data).search(keyword);
} catch (error) {
this.modal.confirm({
nzTitle: $localize`Extension list failed to load`,
nzOkText: $localize`Retry`,
nzOnOk: () => this.getPluginList(keyword),
});
} finally {
clearTimeout(timer);
const timeout = Date.now() - timeStart > 300 ? 0 : 300;
Expand Down
1 change: 1 addition & 0 deletions src/workbench/browser/src/assets/libs/iconpark.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/workbench/browser/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>Eoapi - Easy & Open Source API Ecosystem</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_12799_49.fbb796628e8cb1d44594ff6ad86c1ef8.js"></script>
<script async src="assets/libs/iconpark.js"></script>
<link rel="icon" type="image/x-icon" href="assets/icons/icon.ico" />
</head>
<!-- Angular Cli need for node modules -->
Expand Down

0 comments on commit 90385ef

Please sign in to comment.