From 9b8a5a08e49f2473c67205afe16836fb06216796 Mon Sep 17 00:00:00 2001 From: medcl Date: Sun, 22 Mar 2020 20:04:42 +0800 Subject: [PATCH 1/9] remove umi files --- .../pages/.umi-production/LocaleWrapper.jsx | 166 ---- app/web/src/pages/.umi-production/dva.js | 42 - app/web/src/pages/.umi-production/history.js | 6 - .../src/pages/.umi-production/polyfills.js | 6 - app/web/src/pages/.umi-production/router.js | 883 ------------------ app/web/src/pages/.umi-production/umi.js | 225 ----- .../src/pages/.umi-production/umiExports.ts | 0 7 files changed, 1328 deletions(-) delete mode 100644 app/web/src/pages/.umi-production/LocaleWrapper.jsx delete mode 100644 app/web/src/pages/.umi-production/dva.js delete mode 100644 app/web/src/pages/.umi-production/history.js delete mode 100644 app/web/src/pages/.umi-production/polyfills.js delete mode 100644 app/web/src/pages/.umi-production/router.js delete mode 100644 app/web/src/pages/.umi-production/umi.js delete mode 100644 app/web/src/pages/.umi-production/umiExports.ts diff --git a/app/web/src/pages/.umi-production/LocaleWrapper.jsx b/app/web/src/pages/.umi-production/LocaleWrapper.jsx deleted file mode 100644 index 169fcfde..00000000 --- a/app/web/src/pages/.umi-production/LocaleWrapper.jsx +++ /dev/null @@ -1,166 +0,0 @@ -import React from 'react'; -import { - _setIntlObject, - addLocaleData, - IntlProvider, - intlShape, - LangContext, - _setLocaleContext -} from 'umi-plugin-locale/lib/locale'; - -const InjectedWrapper = (() => { - let sfc = (props, context) => { - _setIntlObject(context.intl); - return props.children; - }; - sfc.contextTypes = { - intl: intlShape, - }; - return sfc; -})(); - -import 'moment/locale/pt-br'; -import 'moment/locale/zh-cn'; -import 'moment/locale/zh-tw'; - -const baseNavigator = true; -const baseSeparator = '-'; -const useLocalStorage = true; - -import { LocaleProvider, version } from 'antd'; -import moment from 'moment'; -import 'moment/locale/zh-cn'; -let defaultAntd = require('antd/lib/locale-provider/zh_CN'); -defaultAntd = defaultAntd.default || defaultAntd; - -const localeInfo = { - 'en-US': { - messages: { - ...((locale) => locale.__esModule ? locale.default : locale)(require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/locales/en-US.js')), - }, - locale: 'en-US', - antd: require('antd/lib/locale-provider/en_US'), - data: require('react-intl/locale-data/en'), - momentLocale: '', - }, - 'pt-BR': { - messages: { - ...((locale) => locale.__esModule ? locale.default : locale)(require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/locales/pt-BR.js')), - }, - locale: 'pt-BR', - antd: require('antd/lib/locale-provider/pt_BR'), - data: require('react-intl/locale-data/pt'), - momentLocale: 'pt-br', - }, - 'zh-CN': { - messages: { - ...((locale) => locale.__esModule ? locale.default : locale)(require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/locales/zh-CN.js')), - }, - locale: 'zh-CN', - antd: require('antd/lib/locale-provider/zh_CN'), - data: require('react-intl/locale-data/zh'), - momentLocale: 'zh-cn', - }, - 'zh-TW': { - messages: { - ...((locale) => locale.__esModule ? locale.default : locale)(require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/locales/zh-TW.js')), - }, - locale: 'zh-TW', - antd: require('antd/lib/locale-provider/zh_TW'), - data: require('react-intl/locale-data/zh'), - momentLocale: 'zh-tw', - }, -}; - -class LocaleWrapper extends React.Component{ - state = { - locale: 'zh-CN', - }; - getAppLocale(){ - let appLocale = { - locale: 'zh-CN', - messages: {}, - data: require('react-intl/locale-data/zh'), - momentLocale: 'zh-cn', - }; - - const runtimeLocale = require('umi/_runtimePlugin').mergeConfig('locale') || {}; - const runtimeLocaleDefault = typeof runtimeLocale.default === 'function' ? runtimeLocale.default() : runtimeLocale.default; - if ( - useLocalStorage - && typeof localStorage !== 'undefined' - && localStorage.getItem('umi_locale') - && localeInfo[localStorage.getItem('umi_locale')] - ) { - appLocale = localeInfo[localStorage.getItem('umi_locale')]; - } else if ( - typeof navigator !== 'undefined' - && localeInfo[navigator.language] - && baseNavigator - ) { - appLocale = localeInfo[navigator.language]; - } else if(localeInfo[runtimeLocaleDefault]){ - appLocale = localeInfo[runtimeLocaleDefault]; - } else { - appLocale = localeInfo['zh-CN'] || appLocale; - } - window.g_lang = appLocale.locale; - window.g_langSeparator = baseSeparator || '-'; - appLocale.data && addLocaleData(appLocale.data); - - // support dynamic add messages for umi ui - // { 'zh-CN': { key: value }, 'en-US': { key: value } } - const runtimeLocaleMessagesType = typeof runtimeLocale.messages; - if (runtimeLocaleMessagesType === 'object' || runtimeLocaleMessagesType === 'function') { - const runtimeMessage = runtimeLocaleMessagesType === 'object' - ? runtimeLocale.messages[appLocale.locale] - : runtimeLocale.messages()[appLocale.locale]; - Object.assign(appLocale.messages, runtimeMessage || {}); - } - - return appLocale; - } - reloadAppLocale = () => { - const appLocale = this.getAppLocale(); - this.setState({ - locale: appLocale.locale, - }); - }; - - render(){ - const appLocale = this.getAppLocale(); - // react-intl must use `-` separator - const reactIntlLocale = appLocale.locale.split(baseSeparator).join('-'); - const LangContextValue = { - locale: reactIntlLocale, - reloadAppLocale: this.reloadAppLocale, - }; - let ret = this.props.children; - ret = ( - - - {(value) => { - _setLocaleContext(value); - return this.props.children - }} - - - ) - // avoid antd ConfigProvider not found - let AntdProvider = LocaleProvider; - const [major, minor] = `${version || ''}`.split('.'); - // antd 3.21.0 use ConfigProvider not LocaleProvider - const isConfigProvider = Number(major) > 3 || (Number(major) >= 3 && Number(minor) >= 21); - if (isConfigProvider) { - try { - AntdProvider = require('antd/lib/config-provider').default; - } catch (e) {} - } - - return ( - {ret} - ); - return ret; - } -} -export default LocaleWrapper; diff --git a/app/web/src/pages/.umi-production/dva.js b/app/web/src/pages/.umi-production/dva.js deleted file mode 100644 index 1d05bcff..00000000 --- a/app/web/src/pages/.umi-production/dva.js +++ /dev/null @@ -1,42 +0,0 @@ -import dva from 'dva'; -import { Component } from 'react'; -import createLoading from 'dva-loading'; -import history from '@tmp/history'; - -let app = null; - -export function _onCreate() { - const plugins = require('umi/_runtimePlugin'); - const runtimeDva = plugins.mergeConfig('dva'); - app = dva({ - history, - - ...(runtimeDva.config || {}), - ...(window.g_useSSR ? { initialState: window.g_initialData } : {}), - }); - - app.use(createLoading()); - (runtimeDva.plugins || []).forEach(plugin => { - app.use(plugin); - }); - - app.model({ namespace: 'global', ...(require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/models/global.js').default) }); -app.model({ namespace: 'list', ...(require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/models/list.js').default) }); -app.model({ namespace: 'login', ...(require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/models/login.js').default) }); -app.model({ namespace: 'project', ...(require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/models/project.js').default) }); -app.model({ namespace: 'setting', ...(require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/models/setting.js').default) }); -app.model({ namespace: 'user', ...(require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/models/user.js').default) }); - return app; -} - -export function getApp() { - return app; -} - -export class _DvaContainer extends Component { - render() { - const app = getApp(); - app.router(() => this.props.children); - return app.start()(); - } -} diff --git a/app/web/src/pages/.umi-production/history.js b/app/web/src/pages/.umi-production/history.js deleted file mode 100644 index 26941fab..00000000 --- a/app/web/src/pages/.umi-production/history.js +++ /dev/null @@ -1,6 +0,0 @@ -// create history -const history = require('umi/lib/createHistory').default({ - basename: window.routerBase, -}); -window.g_history = history; -export default history; diff --git a/app/web/src/pages/.umi-production/polyfills.js b/app/web/src/pages/.umi-production/polyfills.js deleted file mode 100644 index 60d14410..00000000 --- a/app/web/src/pages/.umi-production/polyfills.js +++ /dev/null @@ -1,6 +0,0 @@ -import 'core-js'; -import 'regenerator-runtime/runtime'; - -// Include this seperatly since it's not included in core-js -// ref: https://github.com/zloirock/core-js/issues/117 -import '../../../../../../infini-logging-center/node_modules/_url-polyfill@1.1.5@url-polyfill/url-polyfill.js'; diff --git a/app/web/src/pages/.umi-production/router.js b/app/web/src/pages/.umi-production/router.js deleted file mode 100644 index 722decb6..00000000 --- a/app/web/src/pages/.umi-production/router.js +++ /dev/null @@ -1,883 +0,0 @@ -import React from 'react'; -import { - Router as DefaultRouter, - Route, - Switch, - StaticRouter, -} from 'react-router-dom'; -import dynamic from 'umi/dynamic'; -import renderRoutes from 'umi/lib/renderRoutes'; -import history from '@@/history'; -import RendererWrapper0 from 'C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/.umi-production/LocaleWrapper.jsx'; -import { routerRedux, dynamic as _dvaDynamic } from 'dva'; - -const Router = routerRedux.ConnectedRouter; - -const routes = [ - { - path: '/user', - component: __IS_BROWSER - ? _dvaDynamic({ - component: () => import('../../layouts/UserLayout'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../../layouts/UserLayout').default, - routes: [ - { - path: '/user', - redirect: '/user/login', - exact: true, - }, - { - path: '/user/login', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/User/models/register.js').then( - m => { - return { namespace: 'register', ...m.default }; - }, - ), - ], - component: () => import('../User/Login'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../User/Login').default, - exact: true, - }, - { - path: '/user/register', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/User/models/register.js').then( - m => { - return { namespace: 'register', ...m.default }; - }, - ), - ], - component: () => import('../User/Register'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../User/Register').default, - exact: true, - }, - { - path: '/user/register-result', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/User/models/register.js').then( - m => { - return { namespace: 'register', ...m.default }; - }, - ), - ], - component: () => import('../User/RegisterResult'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../User/RegisterResult').default, - exact: true, - }, - ], - }, - { - path: '/', - component: __IS_BROWSER - ? _dvaDynamic({ - component: () => import('../../layouts/BasicLayout'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../../layouts/BasicLayout').default, - Routes: [require('../Authorized').default], - authority: ['admin', 'user'], - routes: [ - { - path: '/', - redirect: '/dashboard/analysis', - exact: true, - }, - { - path: '/dashboard', - name: 'dashboard', - icon: 'dashboard', - routes: [ - { - path: '/dashboard/analysis', - name: 'analysis', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Dashboard/models/activities.js').then( - m => { - return { namespace: 'activities', ...m.default }; - }, - ), - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Dashboard/models/chart.js').then( - m => { - return { namespace: 'chart', ...m.default }; - }, - ), - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Dashboard/models/monitor.js').then( - m => { - return { namespace: 'monitor', ...m.default }; - }, - ), - ], - component: () => import('../Dashboard/Analysis'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Dashboard/Analysis').default, - exact: true, - }, - { - path: '/dashboard/monitor', - name: 'monitor', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Dashboard/models/activities.js').then( - m => { - return { namespace: 'activities', ...m.default }; - }, - ), - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Dashboard/models/chart.js').then( - m => { - return { namespace: 'chart', ...m.default }; - }, - ), - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Dashboard/models/monitor.js').then( - m => { - return { namespace: 'monitor', ...m.default }; - }, - ), - ], - component: () => import('../Dashboard/Monitor'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Dashboard/Monitor').default, - exact: true, - }, - { - path: '/dashboard/workplace', - name: 'workplace', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Dashboard/models/activities.js').then( - m => { - return { namespace: 'activities', ...m.default }; - }, - ), - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Dashboard/models/chart.js').then( - m => { - return { namespace: 'chart', ...m.default }; - }, - ), - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Dashboard/models/monitor.js').then( - m => { - return { namespace: 'monitor', ...m.default }; - }, - ), - ], - component: () => import('../Dashboard/Workplace'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Dashboard/Workplace').default, - exact: true, - }, - ], - }, - { - path: '/form', - icon: 'form', - name: 'form', - routes: [ - { - path: '/form/basic-form', - name: 'basicform', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Forms/models/form.js').then( - m => { - return { namespace: 'form', ...m.default }; - }, - ), - ], - component: () => import('../Forms/BasicForm'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Forms/BasicForm').default, - exact: true, - }, - { - path: '/form/step-form', - name: 'stepform', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Forms/models/form.js').then( - m => { - return { namespace: 'form', ...m.default }; - }, - ), - ], - component: () => import('../Forms/StepForm'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Forms/StepForm').default, - hideChildrenInMenu: true, - routes: [ - { - path: '/form/step-form', - name: 'stepform', - redirect: '/form/step-form/info', - exact: true, - }, - { - path: '/form/step-form/info', - name: 'info', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Forms/models/form.js').then( - m => { - return { namespace: 'form', ...m.default }; - }, - ), - ], - component: () => import('../Forms/StepForm/Step1'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Forms/StepForm/Step1').default, - exact: true, - }, - { - path: '/form/step-form/confirm', - name: 'confirm', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Forms/models/form.js').then( - m => { - return { namespace: 'form', ...m.default }; - }, - ), - ], - component: () => import('../Forms/StepForm/Step2'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Forms/StepForm/Step2').default, - exact: true, - }, - { - path: '/form/step-form/result', - name: 'result', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Forms/models/form.js').then( - m => { - return { namespace: 'form', ...m.default }; - }, - ), - ], - component: () => import('../Forms/StepForm/Step3'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Forms/StepForm/Step3').default, - exact: true, - }, - ], - }, - { - path: '/form/advanced-form', - name: 'advancedform', - authority: ['admin'], - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Forms/models/form.js').then( - m => { - return { namespace: 'form', ...m.default }; - }, - ), - ], - component: () => import('../Forms/AdvancedForm'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Forms/AdvancedForm').default, - exact: true, - }, - ], - }, - { - path: '/list', - icon: 'table', - name: 'list', - routes: [ - { - path: '/list/table-list', - name: 'searchtable', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/List/models/rule.js').then( - m => { - return { namespace: 'rule', ...m.default }; - }, - ), - ], - component: () => import('../List/TableList'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../List/TableList').default, - exact: true, - }, - { - path: '/list/basic-list', - name: 'basiclist', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/List/models/rule.js').then( - m => { - return { namespace: 'rule', ...m.default }; - }, - ), - ], - component: () => import('../List/BasicList'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../List/BasicList').default, - exact: true, - }, - { - path: '/list/card-list', - name: 'cardlist', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/List/models/rule.js').then( - m => { - return { namespace: 'rule', ...m.default }; - }, - ), - ], - component: () => import('../List/CardList'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../List/CardList').default, - exact: true, - }, - { - path: '/list/search', - name: 'searchlist', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/List/models/rule.js').then( - m => { - return { namespace: 'rule', ...m.default }; - }, - ), - ], - component: () => import('../List/List'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../List/List').default, - routes: [ - { - path: '/list/search', - redirect: '/list/search/articles', - exact: true, - }, - { - path: '/list/search/articles', - name: 'articles', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/List/models/rule.js').then( - m => { - return { namespace: 'rule', ...m.default }; - }, - ), - ], - component: () => import('../List/Articles'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../List/Articles').default, - exact: true, - }, - { - path: '/list/search/projects', - name: 'projects', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/List/models/rule.js').then( - m => { - return { namespace: 'rule', ...m.default }; - }, - ), - ], - component: () => import('../List/Projects'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../List/Projects').default, - exact: true, - }, - { - path: '/list/search/applications', - name: 'applications', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/List/models/rule.js').then( - m => { - return { namespace: 'rule', ...m.default }; - }, - ), - ], - component: () => import('../List/Applications'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../List/Applications').default, - exact: true, - }, - ], - }, - ], - }, - { - path: '/profile', - name: 'profile', - icon: 'profile', - routes: [ - { - path: '/profile/basic', - name: 'basic', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Profile/models/profile.js').then( - m => { - return { namespace: 'profile', ...m.default }; - }, - ), - ], - component: () => import('../Profile/BasicProfile'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Profile/BasicProfile').default, - exact: true, - }, - { - path: '/profile/advanced', - name: 'advanced', - authority: ['admin'], - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Profile/models/profile.js').then( - m => { - return { namespace: 'profile', ...m.default }; - }, - ), - ], - component: () => import('../Profile/AdvancedProfile'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Profile/AdvancedProfile').default, - exact: true, - }, - ], - }, - { - name: 'result', - icon: 'check-circle-o', - path: '/result', - routes: [ - { - path: '/result/success', - name: 'success', - component: __IS_BROWSER - ? _dvaDynamic({ - component: () => import('../Result/Success'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Result/Success').default, - exact: true, - }, - { - path: '/result/fail', - name: 'fail', - component: __IS_BROWSER - ? _dvaDynamic({ - component: () => import('../Result/Error'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Result/Error').default, - exact: true, - }, - ], - }, - { - name: 'exception', - icon: 'warning', - path: '/exception', - routes: [ - { - path: '/exception/403', - name: 'not-permission', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Exception/models/error.js').then( - m => { - return { namespace: 'error', ...m.default }; - }, - ), - ], - component: () => import('../Exception/403'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Exception/403').default, - exact: true, - }, - { - path: '/exception/404', - name: 'not-find', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Exception/models/error.js').then( - m => { - return { namespace: 'error', ...m.default }; - }, - ), - ], - component: () => import('../Exception/404'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Exception/404').default, - exact: true, - }, - { - path: '/exception/500', - name: 'server-error', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Exception/models/error.js').then( - m => { - return { namespace: 'error', ...m.default }; - }, - ), - ], - component: () => import('../Exception/500'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Exception/500').default, - exact: true, - }, - { - path: '/exception/trigger', - name: 'trigger', - hideInMenu: true, - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Exception/models/error.js').then( - m => { - return { namespace: 'error', ...m.default }; - }, - ), - ], - component: () => import('../Exception/TriggerException'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Exception/TriggerException').default, - exact: true, - }, - ], - }, - { - name: 'account', - icon: 'user', - path: '/account', - routes: [ - { - path: '/account/center', - name: 'center', - component: __IS_BROWSER - ? _dvaDynamic({ - component: () => import('../Account/Center/Center'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Account/Center/Center').default, - routes: [ - { - path: '/account/center', - redirect: '/account/center/articles', - exact: true, - }, - { - path: '/account/center/articles', - component: __IS_BROWSER - ? _dvaDynamic({ - component: () => import('../Account/Center/Articles'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Account/Center/Articles').default, - exact: true, - }, - { - path: '/account/center/applications', - component: __IS_BROWSER - ? _dvaDynamic({ - component: () => import('../Account/Center/Applications'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Account/Center/Applications').default, - exact: true, - }, - { - path: '/account/center/projects', - component: __IS_BROWSER - ? _dvaDynamic({ - component: () => import('../Account/Center/Projects'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Account/Center/Projects').default, - exact: true, - }, - ], - }, - { - path: '/account/settings', - name: 'settings', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Account/Settings/models/geographic.js').then( - m => { - return { namespace: 'geographic', ...m.default }; - }, - ), - ], - component: () => import('../Account/Settings/Info'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Account/Settings/Info').default, - routes: [ - { - path: '/account/settings', - redirect: '/account/settings/base', - exact: true, - }, - { - path: '/account/settings/base', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Account/Settings/models/geographic.js').then( - m => { - return { namespace: 'geographic', ...m.default }; - }, - ), - ], - component: () => import('../Account/Settings/BaseView'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Account/Settings/BaseView').default, - exact: true, - }, - { - path: '/account/settings/security', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Account/Settings/models/geographic.js').then( - m => { - return { namespace: 'geographic', ...m.default }; - }, - ), - ], - component: () => - import('../Account/Settings/SecurityView'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Account/Settings/SecurityView').default, - exact: true, - }, - { - path: '/account/settings/binding', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Account/Settings/models/geographic.js').then( - m => { - return { namespace: 'geographic', ...m.default }; - }, - ), - ], - component: () => - import('../Account/Settings/BindingView'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Account/Settings/BindingView').default, - exact: true, - }, - { - path: '/account/settings/notification', - component: __IS_BROWSER - ? _dvaDynamic({ - app: require('@tmp/dva').getApp(), - models: () => [ - import('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/pages/Account/Settings/models/geographic.js').then( - m => { - return { namespace: 'geographic', ...m.default }; - }, - ), - ], - component: () => - import('../Account/Settings/NotificationView'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../Account/Settings/NotificationView').default, - exact: true, - }, - ], - }, - ], - }, - { - component: __IS_BROWSER - ? _dvaDynamic({ - component: () => import('../404'), - LoadingComponent: require('C:/Users/Administrator/Documents/infini/logging-center/app/web/src/components/PageLoading/index') - .default, - }) - : require('../404').default, - exact: true, - }, - ], - }, -]; -window.g_routes = routes; -const plugins = require('umi/_runtimePlugin'); -plugins.applyForEach('patchRoutes', { initialValue: routes }); - -export { routes }; - -export default class RouterWrapper extends React.Component { - unListen() {} - - constructor(props) { - super(props); - - // route change handler - function routeChangeHandler(location, action) { - plugins.applyForEach('onRouteChange', { - initialValue: { - routes, - location, - action, - }, - }); - } - this.unListen = history.listen(routeChangeHandler); - // dva 中 history.listen 会初始执行一次 - // 这里排除掉 dva 的场景,可以避免 onRouteChange 在启用 dva 后的初始加载时被多执行一次 - const isDva = - history.listen - .toString() - .indexOf('callback(history.location, history.action)') > -1; - if (!isDva) { - routeChangeHandler(history.location); - } - } - - componentWillUnmount() { - this.unListen(); - } - - render() { - const props = this.props || {}; - return ( - - {renderRoutes(routes, props)} - - ); - } -} diff --git a/app/web/src/pages/.umi-production/umi.js b/app/web/src/pages/.umi-production/umi.js deleted file mode 100644 index ba67da2e..00000000 --- a/app/web/src/pages/.umi-production/umi.js +++ /dev/null @@ -1,225 +0,0 @@ -import './polyfills'; -import history from './history'; - -import React from 'react'; -import ReactDOM from 'react-dom'; -import findRoute, { - getUrlQuery, -} from 'C:/Users/Administrator/Documents/infini/infini-logging-center/node_modules/_umi-build-dev@1.17.1@umi-build-dev/lib/findRoute.js'; - -// runtime plugins -const plugins = require('umi/_runtimePlugin'); -window.g_plugins = plugins; -plugins.init({ - validKeys: [ - 'patchRoutes', - 'render', - 'rootContainer', - 'modifyRouteProps', - 'onRouteChange', - 'modifyInitialProps', - 'initialProps', - 'dva', - 'locale', - ], -}); -plugins.use( - require('../../../../../node_modules/_umi-plugin-dva@1.11.0@umi-plugin-dva/lib/runtime'), -); - -const app = require('@tmp/dva')._onCreate(); -window.g_app = app; - -// render -let clientRender = async () => { - window.g_isBrowser = true; - let props = {}; - // Both support SSR and CSR - if (window.g_useSSR) { - // 如果开启服务端渲染则客户端组件初始化 props 使用服务端注入的数据 - props = window.g_initialData; - } else { - const pathname = location.pathname; - const activeRoute = findRoute(require('@@/router').routes, pathname); - // 在客户端渲染前,执行 getInitialProps 方法 - // 拿到初始数据 - if ( - activeRoute && - activeRoute.component && - activeRoute.component.getInitialProps - ) { - const initialProps = plugins.apply('modifyInitialProps', { - initialValue: {}, - }); - props = activeRoute.component.getInitialProps - ? await activeRoute.component.getInitialProps({ - route: activeRoute, - isServer: false, - location, - ...initialProps, - }) - : {}; - } - } - const rootContainer = plugins.apply('rootContainer', { - initialValue: React.createElement(require('./router').default, props), - }); - ReactDOM[window.g_useSSR ? 'hydrate' : 'render']( - rootContainer, - document.getElementById('root'), - ); -}; -const render = plugins.compose( - 'render', - { initialValue: clientRender }, -); - -const moduleBeforeRendererPromises = []; -// client render -if (__IS_BROWSER) { - Promise.all(moduleBeforeRendererPromises) - .then(() => { - render(); - }) - .catch(err => { - window.console && window.console.error(err); - }); -} - -// export server render -let serverRender, ReactDOMServer; -if (!__IS_BROWSER) { - const { matchRoutes } = require('react-router-config'); - const { StaticRouter } = require('react-router'); - // difference: umi-history has query object - const { createLocation } = require('umi-history'); - // don't remove, use stringify html map - const stringify = require('serialize-javascript'); - const router = require('./router'); - - /** - * 1. Load dynamicImport Component - * 2. Get Component initialProps function data - * return Component props - * @param pathname - * @param props - */ - const getInitialProps = async (pathname, props) => { - const { routes } = router; - const matchedComponents = matchRoutes(routes, pathname) - .map(({ route }) => { - if (route.component) { - return !route.component.preload - ? // 同步 - route.component - : // 异步,支持 dynamicImport - route.component.preload().then(component => component.default); - } - }) - .filter(c => c); - const loadedComponents = await Promise.all(matchedComponents); - - // get Store - const initialProps = plugins.apply('modifyInitialProps', { - initialValue: {}, - }); - // support getInitialProps - const promises = loadedComponents.map(component => { - if (component && component.getInitialProps) { - return component.getInitialProps({ - isServer: true, - ...props, - ...initialProps, - }); - } - return Promise.resolve(null); - }); - - return Promise.all(promises); - }; - - serverRender = async (ctx = {}) => { - // ctx.req.url may be `/bar?locale=en-US` - const [pathname] = (ctx.req.url || '').split('?'); - // global - global.req = { - url: ctx.req.url, - }; - const location = createLocation(ctx.req.url); - const activeRoute = findRoute(router.routes, pathname); - // omit component - const { component, ...restRoute } = activeRoute || {}; - // router context hook - // get current router status 40x / 30x, share with server - const context = {}; - // TODO: getInitialProps timeout handle - const initialData = await getInitialProps(pathname, { - route: restRoute, - // only exist in server - req: ctx.req || {}, - res: ctx.res || {}, - context, - location, - }); - - // 当前路由(不包含 Layout)的 getInitialProps 有返回值 - // Page 值为 undefined 时,有 getInitialProps 无返回,此时 return dva model - const pageData = initialData[initialData.length - 1]; - if (pageData === undefined) { - initialData[initialData.length - 1] = plugins.apply('initialProps', { - initialValue: pageData, - }); - } - - // reduce all match component getInitialProps - // in the same object key - // page data key will override layout key - const props = Array.isArray(initialData) - ? initialData.reduce( - (acc, curr) => ({ - ...acc, - ...curr, - }), - {}, - ) - : {}; - - const App = React.createElement( - StaticRouter, - { - location: ctx.req.url, - context, - }, - React.createElement(router.default, props), - ); - - // render rootContainer for htmlTemplateMap - const rootContainer = plugins.apply('rootContainer', { - initialValue: App, - }); - const htmlTemplateMap = {}; - const matchPath = activeRoute ? activeRoute.path : undefined; - return { - htmlElement: matchPath ? htmlTemplateMap[matchPath] : '', - rootContainer, - matchPath, - g_initialData: props, - context, - }; - }; - // using project react-dom version - // https://github.com/facebook/react/issues/13991 - ReactDOMServer = require('react-dom/server'); -} - -export { ReactDOMServer }; -export default (__IS_BROWSER ? null : serverRender); - -require('../../global.less'); - -// hot module replacement -if (__IS_BROWSER && module.hot) { - module.hot.accept('./router', () => { - clientRender(); - }); -} diff --git a/app/web/src/pages/.umi-production/umiExports.ts b/app/web/src/pages/.umi-production/umiExports.ts deleted file mode 100644 index e69de29b..00000000 From a690e5706897d4b15a2c026cecf9e3129b2ba84b Mon Sep 17 00:00:00 2001 From: medcl Date: Sun, 22 Mar 2020 22:09:09 +0800 Subject: [PATCH 2/9] add favicon and localize sitename --- app/view/index.html | 1 + app/web/src/layouts/BasicLayout.js | 4 ++-- app/web/src/layouts/UserLayout.js | 18 +++++------------- app/web/src/locales/en-US.js | 4 ++++ app/web/src/locales/zh-CN.js | 7 +++++++ app/web/src/pages/document.ejs | 4 ++-- 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/app/view/index.html b/app/view/index.html index e5c3d9cd..e49f3008 100644 --- a/app/view/index.html +++ b/app/view/index.html @@ -6,6 +6,7 @@ + {{ helper.assets.getStyle('umi.css') | safe }} diff --git a/app/web/src/layouts/BasicLayout.js b/app/web/src/layouts/BasicLayout.js index aa29acc7..71853bf2 100644 --- a/app/web/src/layouts/BasicLayout.js +++ b/app/web/src/layouts/BasicLayout.js @@ -178,13 +178,13 @@ class BasicLayout extends React.PureComponent { const currRouterData = this.matchParamsPath(pathname); if (!currRouterData) { - return 'Ant Design Pro'; + return 'INFINI'; } const message = formatMessage({ id: currRouterData.locale || currRouterData.name, defaultMessage: currRouterData.name, }); - return `${message} - Ant Design Pro`; + return `${message} - INFINI`; }; getLayoutStyle = () => { diff --git a/app/web/src/layouts/UserLayout.js b/app/web/src/layouts/UserLayout.js index 7a911a9f..48b88e95 100644 --- a/app/web/src/layouts/UserLayout.js +++ b/app/web/src/layouts/UserLayout.js @@ -31,22 +31,14 @@ const copyright = ( ); +const appname = formatMessage({ id: 'layout.user.appname' }); +const appslogon = formatMessage({ id: 'layout.user.appslogon' }); + class UserLayout extends React.PureComponent { - // @TODO title - // getPageTitle() { - // const { routerData, location } = this.props; - // const { pathname } = location; - // let title = 'Ant Design Pro'; - // if (routerData[pathname] && routerData[pathname].name) { - // title = `${routerData[pathname].name} - Ant Design Pro`; - // } - // return title; - // } render() { const { children } = this.props; return ( - // @TODO
@@ -56,10 +48,10 @@ class UserLayout extends React.PureComponent {
logo - 极限日志分析中心 + {appname}
-
极限科技的日志分析中心是东半球最好用的日志分析平台
+
{appslogon}
{children}
diff --git a/app/web/src/locales/en-US.js b/app/web/src/locales/en-US.js index 48ff3b66..1db47158 100644 --- a/app/web/src/locales/en-US.js +++ b/app/web/src/locales/en-US.js @@ -1,5 +1,9 @@ export default { 'navBar.lang': 'Languages', + + 'layout.user.appname':"INFINI LOGGING CENTER", + 'layout.user.appslogon':"INFINI logging center is the best log analysis platform in the world", + 'layout.user.link.help': 'Help', 'layout.user.link.privacy': 'Privacy', 'layout.user.link.terms': 'Terms', diff --git a/app/web/src/locales/zh-CN.js b/app/web/src/locales/zh-CN.js index 4b227086..c60d212c 100644 --- a/app/web/src/locales/zh-CN.js +++ b/app/web/src/locales/zh-CN.js @@ -1,8 +1,13 @@ export default { 'navBar.lang': '语言', + + 'layout.user.appname':"极限日志分析中心", + 'layout.user.appslogon':"极限科技的日志分析中心是东半球最好用的日志分析平台", + 'layout.user.link.help': '帮助', 'layout.user.link.privacy': '隐私', 'layout.user.link.terms': '条款', + 'validation.email.required': '请输入邮箱地址!', 'validation.email.wrong-format': '邮箱地址格式错误!', 'validation.password.required': '请输入密码!', @@ -180,6 +185,8 @@ export default { 'app.setting.appname':"日志分析中心", + 'app.login.appname':"日志分析中心", + 'app.settings.menuMap.basic': '基本设置', 'app.settings.menuMap.security': '安全设置', 'app.settings.menuMap.binding': '账号绑定', diff --git a/app/web/src/pages/document.ejs b/app/web/src/pages/document.ejs index e3aeb263..c5992413 100644 --- a/app/web/src/pages/document.ejs +++ b/app/web/src/pages/document.ejs @@ -4,8 +4,8 @@ - Ant Design Pro - + INFINI + From a71e0a2af3cf19fa7b61e97dc0769dc6fc27cdf5 Mon Sep 17 00:00:00 2001 From: medcl Date: Sun, 22 Mar 2020 22:13:24 +0800 Subject: [PATCH 3/9] update gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a97da8a7..95360a3d 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,6 @@ app/public config/manifest.json app/web/.temp .umi -docker/.node_modules/* \ No newline at end of file +docker/.node_modules/* +.vscode/ +.umi* \ No newline at end of file From 83d41131937ead5a3eee3d490080c99474e6a1f6 Mon Sep 17 00:00:00 2001 From: medcl Date: Fri, 27 Mar 2020 00:02:33 +0800 Subject: [PATCH 4/9] add release docker settings --- docker/docker-compose.release.yml | 25 +++++++++++++++++++++++++ docker/entrypoint-release.sh | 18 ++++++++++++++++++ package.json | 10 +++++++--- 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 docker/docker-compose.release.yml create mode 100644 docker/entrypoint-release.sh diff --git a/docker/docker-compose.release.yml b/docker/docker-compose.release.yml new file mode 100644 index 00000000..783e4953 --- /dev/null +++ b/docker/docker-compose.release.yml @@ -0,0 +1,25 @@ +version: "3.5" + +services: + infini-logging-release: + # option 1: pull image from infini docker registry + image: docker.infini.ltd:64443/nodejs-release:latest + + # option 2: build image locally + # build: + # context: ../ + # dockerfile: docker/Dockerfile + + ports: + - 3000:3000 + - 7001:7001 + - 10000:10000 + container_name: "infini-nodejs-release" + volumes: + - ../app:/usr/src/app/app + - ../config:/usr/src/app/config + - ../package.json:/usr/src/app/package.json + - ./entrypoint-release.sh:/entrypoint.sh + +volumes: + dist: \ No newline at end of file diff --git a/docker/entrypoint-release.sh b/docker/entrypoint-release.sh new file mode 100644 index 00000000..e03429b6 --- /dev/null +++ b/docker/entrypoint-release.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +lockPath="/tmp/init.lock" + +npm config set registry http://registry.npm.taobao.org/; + +cd /usr/src/app + +echo "START BUILD INFINI-LOGGING-CENTER v1.0" + +if [ ! -f "$lockPath" ]; then + npm install --registry=https://registry.npm.taobao.org + npm run build + npm run start +else + npm run build + npm run start +fi diff --git a/package.json b/package.json index e4c32357..dcbb59d2 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "node": ">=8.9.0" }, "scripts": { - "start": "egg-scripts start --daemon --title=infini-logging-center --env prod", + "start": "egg-scripts start --title=infini-logging-center --env prod", "stop": "egg-scripts stop --title=infini-logging-center", "dev": "SOCKET_SERVER=none UMI_UI=none egg-bin dev", "local-dev": "egg-bin dev", @@ -85,9 +85,13 @@ "ci": "npm run lint && npm run cov", "autod": "autod", "sync": "./script/sync.js", - "docker:build": "docker-compose -f ./docker/docker-compose.dev.yml build", + "docker:build-dev-images": "docker-compose -f ./docker/docker-compose.dev.yml build", "docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up -d", - "docker:stop": "docker-compose -f ./docker/docker-compose.dev.yml down" + "docker:stop-dev": "docker-compose -f ./docker/docker-compose.dev.yml down", + "docker:build-release-images": "docker-compose -f ./docker/docker-compose.release.yml build", + "docker:prod": "docker-compose -f ./docker/docker-compose.release.yml up -d", + "docker:stop-prod": "docker-compose -f ./docker/docker-compose.release.yml up down" + }, "ci": { "version": "8", From cdec440220745bcc948a1411da46efa917e68c25 Mon Sep 17 00:00:00 2001 From: medcl Date: Fri, 27 Mar 2020 11:38:30 +0800 Subject: [PATCH 5/9] Update docker command --- README.md | 12 +++++++++--- docker/docker-compose.release.yml | 6 +++--- package.json | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a98861b6..4218f054 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ npm run docker:build cnpm run docker:dev ``` -启动完成,稍等片刻,打开 http://localhost:10000/,手动刷新即可看到最新的更改。 +启动完成,稍等片刻,打开 http://localhost:7001/,手动刷新即可看到最新的更改。 #### 手动更新开发镜像 @@ -70,7 +70,7 @@ cnpm install cnpm run dev ``` -在浏览器中访问:[http://localhost:8000](http://localhost:8000) +在浏览器中访问:[http://localhost:8000](http://localhost:7001) ### 构建和部署 @@ -79,7 +79,13 @@ cnpm run dev cnpm run build ``` -执行该命令后会生成最终的 HTML、CSS 和 JS 到 `dist` 目录下。它们是浏览器可以直接识别并运行的代码,这样你就可以将它们部署到你想要的服务器上了。 +执行该命令后会生成最终的 HTML、CSS 和 JS 到 `app/public` 目录下。它们是浏览器可以直接识别并运行的代码,这样你就可以将它们部署到你想要的服务器上了。 + +或者使用 Docker 来运行最终的程序。 +``` +cnpm run docker:prod +``` +启动完成,稍等片刻,打开 http://localhost:8001/,即可看到最终的程序界面。 ### 新增项目依赖包 ``` diff --git a/docker/docker-compose.release.yml b/docker/docker-compose.release.yml index 783e4953..b146ca3a 100644 --- a/docker/docker-compose.release.yml +++ b/docker/docker-compose.release.yml @@ -11,9 +11,9 @@ services: # dockerfile: docker/Dockerfile ports: - - 3000:3000 - - 7001:7001 - - 10000:10000 + # - 3000:3000 + - 8001:7001 + # - 10000:10000 container_name: "infini-nodejs-release" volumes: - ../app:/usr/src/app/app diff --git a/package.json b/package.json index dcbb59d2..be600cf7 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "docker:stop-dev": "docker-compose -f ./docker/docker-compose.dev.yml down", "docker:build-release-images": "docker-compose -f ./docker/docker-compose.release.yml build", "docker:prod": "docker-compose -f ./docker/docker-compose.release.yml up -d", - "docker:stop-prod": "docker-compose -f ./docker/docker-compose.release.yml up down" + "docker:stop-prod": "docker-compose -f ./docker/docker-compose.release.yml down" }, "ci": { From aca449a2cbf0a8b0c818a472af2b5746c3112cff Mon Sep 17 00:00:00 2001 From: medcl Date: Fri, 27 Mar 2020 12:06:52 +0800 Subject: [PATCH 6/9] update readme, add comments about servers --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4218f054..e3e30c38 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,9 @@ cnpm install cnpm run dev ``` -在浏览器中访问:[http://localhost:8000](http://localhost:7001) +后端开发:在浏览器中访问:[http://localhost:7001](http://localhost:7001) ,使用真实接口实现; + +前端开发:在浏览器中访问:[http://localhost:10000](http://localhost:10000),使用 Mock 接口数据。 ### 构建和部署 From 36297464b484cac9b090d59e09a2e2b001a24df1 Mon Sep 17 00:00:00 2001 From: medcl Date: Fri, 27 Mar 2020 12:09:37 +0800 Subject: [PATCH 7/9] remove test menu --- app/web/config/router.config.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/app/web/config/router.config.js b/app/web/config/router.config.js index 642f58cd..e98dff32 100644 --- a/app/web/config/router.config.js +++ b/app/web/config/router.config.js @@ -17,15 +17,6 @@ export default [ Routes: ['src/pages/Authorized'], authority: ['admin', 'user'], routes: [ - - //测试专用 - { - path: '/test', - name: 'test', - icon: 'AppstoreAdd', - component: './Endpoints/Execute', - }, - // dashboard { path: '/', redirect: '/platform' }, { From f7ac436b951f4f041e3b029b641e0e48f906a9d2 Mon Sep 17 00:00:00 2001 From: medcl Date: Fri, 27 Mar 2020 23:09:53 +0800 Subject: [PATCH 8/9] add mysql docker service --- .gitignore | 4 +++- README.md | 6 ++++++ docker/docker-compose-mysql.dev.yml | 12 ++++++++++++ package.json | 3 ++- 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 docker/docker-compose-mysql.dev.yml diff --git a/.gitignore b/.gitignore index 95360a3d..c16a990e 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,6 @@ app/web/.temp .umi docker/.node_modules/* .vscode/ -.umi* \ No newline at end of file +.umi* + +data \ No newline at end of file diff --git a/README.md b/README.md index e3e30c38..384b52a0 100644 --- a/README.md +++ b/README.md @@ -93,3 +93,9 @@ cnpm run docker:prod ``` cnpm install --save md5 ``` + +### 启动 MySQL 服务器 +``` +npm run docker:start-mysql +``` +端口 3306,默认 root 密码 admin \ No newline at end of file diff --git a/docker/docker-compose-mysql.dev.yml b/docker/docker-compose-mysql.dev.yml new file mode 100644 index 00000000..a2cd1a6e --- /dev/null +++ b/docker/docker-compose-mysql.dev.yml @@ -0,0 +1,12 @@ +version: '3' + +services: + infini-logging-db: + image: mariadb:10.1.19 + # volumes: + # - ../data/db_data:/var/lib/mysql + restart: always + environment: + MYSQL_ROOT_PASSWORD: admin + ports: + - "3306:3306" diff --git a/package.json b/package.json index be600cf7..4c967ce5 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,8 @@ "docker:stop-dev": "docker-compose -f ./docker/docker-compose.dev.yml down", "docker:build-release-images": "docker-compose -f ./docker/docker-compose.release.yml build", "docker:prod": "docker-compose -f ./docker/docker-compose.release.yml up -d", - "docker:stop-prod": "docker-compose -f ./docker/docker-compose.release.yml down" + "docker:stop-prod": "docker-compose -f ./docker/docker-compose.release.yml down", + "docker:start-mysql": "docker-compose -f ./docker/docker-compose-mysql.dev.yml up -d" }, "ci": { From 1fee316d4a2ce7bab305c8b7365b5ee186401391 Mon Sep 17 00:00:00 2001 From: medcl Date: Fri, 27 Mar 2020 23:16:15 +0800 Subject: [PATCH 9/9] add db script folder --- db/README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 db/README.md diff --git a/db/README.md b/db/README.md new file mode 100644 index 00000000..3bb285cb --- /dev/null +++ b/db/README.md @@ -0,0 +1,2 @@ +## 数据库初始化脚本 +