未验证 提交 af0ad122 编写于 作者: P Peter Pan 提交者: GitHub

Minor bug fix (#626)

* fix: navbar items order

* feat: refresh components when click refresh button

* v2.0.0-beta.41

* bump 2.0.0-alpha.3

* fix: language change support public path

* v2.0.0-beta.42

* bump 2.0.0-alpha.4
上级 afc15b2c
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"packages": [ "packages": [
"packages/*" "packages/*"
], ],
"version": "2.0.0-beta.40", "version": "2.0.0-beta.42",
"npmClient": "yarn", "npmClient": "yarn",
"useWorkspaces": true, "useWorkspaces": true,
"command": { "command": {
......
{ {
"name": "@visualdl/cli", "name": "@visualdl/cli",
"version": "2.0.0-beta.40", "version": "2.0.0-beta.42",
"description": "A platform to visualize the deep learning process and result.", "description": "A platform to visualize the deep learning process and result.",
"keywords": [ "keywords": [
"visualdl", "visualdl",
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
"dist" "dist"
], ],
"dependencies": { "dependencies": {
"@visualdl/server": "2.0.0-beta.40", "@visualdl/server": "2.0.0-beta.42",
"open": "7.0.3", "open": "7.0.3",
"ora": "4.0.4", "ora": "4.0.4",
"pm2": "4.4.0", "pm2": "4.4.0",
......
...@@ -131,7 +131,7 @@ const Navbar: FunctionComponent = () => { ...@@ -131,7 +131,7 @@ const Navbar: FunctionComponent = () => {
<NavItem onClick={changeLanguage}> <NavItem onClick={changeLanguage}>
<Language /> <Language />
</NavItem> </NavItem>
<NavItem onClick={() => ee.emit('refresh-running')}> <NavItem onClick={() => ee.emit('refresh')}>
<Icon type="refresh" /> <Icon type="refresh" />
</NavItem> </NavItem>
</div> </div>
......
import {useEffect, useMemo} from 'react';
import ee from '~/utils/event';
import {fetcher} from '~/utils/fetch'; import {fetcher} from '~/utils/fetch';
import intersection from 'lodash/intersection'; import intersection from 'lodash/intersection';
import {useMemo} from 'react';
import useRequest from '~/hooks/useRequest'; import useRequest from '~/hooks/useRequest';
const allNavItems = ['scalars', 'samples', 'high-dimensional']; const allNavItems = ['scalars', 'samples', 'high-dimensional'];
...@@ -11,7 +13,7 @@ export const navMap = { ...@@ -11,7 +13,7 @@ export const navMap = {
} as const; } as const;
const useNavItems = () => { const useNavItems = () => {
const {data: components} = useRequest<(keyof typeof navMap)[]>('/components', fetcher, { const {data: components, mutate} = useRequest<(keyof typeof navMap)[]>('/components', fetcher, {
refreshInterval: 61 * 1000, refreshInterval: 61 * 1000,
dedupingInterval: 29 * 1000, dedupingInterval: 29 * 1000,
errorRetryInterval: 29 * 1000, errorRetryInterval: 29 * 1000,
...@@ -22,7 +24,14 @@ const useNavItems = () => { ...@@ -22,7 +24,14 @@ const useNavItems = () => {
refreshWhenOffline: false refreshWhenOffline: false
}); });
const navItems = useMemo(() => intersection(components?.map(component => navMap[component]) ?? [], allNavItems), [ useEffect(() => {
ee.on('refresh', mutate);
return () => {
ee.off('refresh', mutate);
};
}, [mutate]);
const navItems = useMemo(() => intersection(allNavItems, components?.map(component => navMap[component]) ?? []), [
components components
]); ]);
......
...@@ -63,9 +63,9 @@ function useRunningRequest<D = unknown, E = unknown>( ...@@ -63,9 +63,9 @@ function useRunningRequest<D = unknown, E = unknown>(
}, [running, mutate]); }, [running, mutate]);
useEffect(() => { useEffect(() => {
ee.on('refresh-running', mutate); ee.on('refresh', mutate);
return () => { return () => {
ee.off('refresh-running', mutate); ee.off('refresh', mutate);
}; };
}, [mutate]); }, [mutate]);
......
{ {
"name": "@visualdl/core", "name": "@visualdl/core",
"version": "2.0.0-beta.40", "version": "2.0.0-beta.42",
"title": "VisualDL", "title": "VisualDL",
"description": "A platform to visualize the deep learning process and result.", "description": "A platform to visualize the deep learning process and result.",
"keywords": [ "keywords": [
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
"test": "echo \"Error: no test specified\" && exit 0" "test": "echo \"Error: no test specified\" && exit 0"
}, },
"dependencies": { "dependencies": {
"@visualdl/i18n": "2.0.0-beta.40", "@visualdl/i18n": "2.0.0-beta.42",
"@visualdl/wasm": "2.0.0-beta.40", "@visualdl/wasm": "2.0.0-beta.42",
"bignumber.js": "9.0.0", "bignumber.js": "9.0.0",
"dagre-d3": "0.6.4", "dagre-d3": "0.6.4",
"echarts": "4.7.0", "echarts": "4.7.0",
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
"@types/react": "16.9.34", "@types/react": "16.9.34",
"@types/react-dom": "16.9.7", "@types/react-dom": "16.9.7",
"@types/styled-components": "5.1.0", "@types/styled-components": "5.1.0",
"@visualdl/mock": "2.0.0-beta.40", "@visualdl/mock": "2.0.0-beta.42",
"babel-plugin-emotion": "10.0.33", "babel-plugin-emotion": "10.0.33",
"babel-plugin-styled-components": "1.10.7", "babel-plugin-styled-components": "1.10.7",
"babel-plugin-typescript-to-proptypes": "1.3.2", "babel-plugin-typescript-to-proptypes": "1.3.2",
......
{ {
"name": "@visualdl/i18n", "name": "@visualdl/i18n",
"version": "2.0.0-beta.40", "version": "2.0.0-beta.42",
"description": "A platform to visualize the deep learning process and result.", "description": "A platform to visualize the deep learning process and result.",
"keywords": [ "keywords": [
"visualdl", "visualdl",
......
...@@ -52,7 +52,19 @@ export const appWithTranslation = function (this: NextI18Next, WrappedComponent: ...@@ -52,7 +52,19 @@ export const appWithTranslation = function (this: NextI18Next, WrappedComponent:
if (!isServer()) { if (!isServer()) {
const changeLanguageCallback = (prevLng: string, newLng: string) => { const changeLanguageCallback = (prevLng: string, newLng: string) => {
const {router} = props; const {router} = props;
const {pathname, asPath, query} = router; const {query} = router;
let {pathname, asPath} = router;
if (process.env.PUBLIC_PATH) {
const publicPath = process.env.PUBLIC_PATH;
if (pathname.indexOf(publicPath) === 0) {
pathname = pathname.replace(publicPath, '');
}
if (asPath.indexOf(publicPath) === 0) {
asPath = asPath.replace(publicPath, '');
}
}
const routeInfo = {pathname, query}; const routeInfo = {pathname, query};
if ((i18n as any).initializedLanguageOnce && typeof newLng === 'string' && prevLng !== newLng) { if ((i18n as any).initializedLanguageOnce && typeof newLng === 'string' && prevLng !== newLng) {
......
export default ['scalar', 'image', 'embeddings']; export default ['embeddings', 'scalar', 'image'];
{ {
"name": "@visualdl/mock", "name": "@visualdl/mock",
"version": "2.0.0-beta.40", "version": "2.0.0-beta.42",
"description": "A platform to visualize the deep learning process and result.", "description": "A platform to visualize the deep learning process and result.",
"keywords": [ "keywords": [
"visualdl", "visualdl",
......
{ {
"name": "@visualdl/server", "name": "@visualdl/server",
"version": "2.0.0-beta.40", "version": "2.0.0-beta.42",
"description": "A platform to visualize the deep learning process and result.", "description": "A platform to visualize the deep learning process and result.",
"keywords": [ "keywords": [
"visualdl", "visualdl",
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
"ecosystem.config.d.ts" "ecosystem.config.d.ts"
], ],
"dependencies": { "dependencies": {
"@visualdl/core": "2.0.0-beta.40", "@visualdl/core": "2.0.0-beta.42",
"@visualdl/i18n": "2.0.0-beta.40", "@visualdl/i18n": "2.0.0-beta.42",
"express": "4.17.1", "express": "4.17.1",
"http-proxy-middleware": "1.0.3", "http-proxy-middleware": "1.0.3",
"next": "9.3.6", "next": "9.3.6",
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
"@types/shelljs": "0.8.7", "@types/shelljs": "0.8.7",
"@types/webpack": "4.41.12", "@types/webpack": "4.41.12",
"@types/webpack-dev-middleware": "3.7.0", "@types/webpack-dev-middleware": "3.7.0",
"@visualdl/mock": "2.0.0-beta.40", "@visualdl/mock": "2.0.0-beta.42",
"cross-env": "7.0.2", "cross-env": "7.0.2",
"nodemon": "2.0.3", "nodemon": "2.0.3",
"shelljs": "0.8.4", "shelljs": "0.8.4",
......
{ {
"name": "@visualdl/serverless", "name": "@visualdl/serverless",
"version": "2.0.0-beta.40", "version": "2.0.0-beta.42",
"description": "A platform to visualize the deep learning process and result.", "description": "A platform to visualize the deep learning process and result.",
"keywords": [ "keywords": [
"visualdl", "visualdl",
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
"devDependencies": { "devDependencies": {
"@types/node": "13.13.5", "@types/node": "13.13.5",
"@types/rimraf": "3.0.0", "@types/rimraf": "3.0.0",
"@visualdl/core": "2.0.0-beta.40", "@visualdl/core": "2.0.0-beta.42",
"cross-env": "7.0.2", "cross-env": "7.0.2",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"ts-node": "8.10.1", "ts-node": "8.10.1",
......
{ {
"name": "@visualdl/wasm", "name": "@visualdl/wasm",
"version": "2.0.0-beta.40", "version": "2.0.0-beta.42",
"title": "VisualDL", "title": "VisualDL",
"description": "A platform to visualize the deep learning process and result.", "description": "A platform to visualize the deep learning process and result.",
"keywords": [ "keywords": [
......
...@@ -13,5 +13,4 @@ ...@@ -13,5 +13,4 @@
# limitations under the License. # limitations under the License.
# ======================================================================= # =======================================================================
vdl_version = '2.0.0-alpha.2' vdl_version = '2.0.0-alpha.4'
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册