Skip to content

Commit

Permalink
feat: merge release 1.0 to develop
Browse files Browse the repository at this point in the history
  • Loading branch information
laojun committed May 20, 2021
2 parents 775046e + 67d54c1 commit 3105c19
Show file tree
Hide file tree
Showing 123 changed files with 844 additions and 18,426 deletions.
17,651 changes: 23 additions & 17,628 deletions core/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@terminus/nusi": "^3.10.79",
"antd": "^3.25.0",
"css-loader": "^5.0.1",
"cube-state": "^1.5.0",
"cube-state": "^1.5.1",
"i18next": "^17.0.13",
"immer": "^3.2.0",
"less": "^3.8.1",
Expand Down
6 changes: 4 additions & 2 deletions core/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { IGetRouter, registRouters } from './framework/regist-router';
import i18n, { initI18n } from './i18n';
import { setConfig } from './config';
import routeInfoStore from './stores/route';
import { emit } from './utils/event-hub';

const holderDractDom = ReactDom; // if not use it, minified build file will cause infinite loop when use ReactDom.render. errMsg: Cannot set property 'getCurrentStack' of undefined
const browserHistory = createBrowserHistory();
Expand All @@ -31,7 +32,7 @@ const App = () => {

React.useEffect(() => {
browserHistory.listen((loc) => {
routeInfoStore.reducers.$_updateRouteInfo(loc);
emit('@routeChange', routeInfoStore.reducers.$_updateRouteInfo(loc));
});
}, []);

Expand Down Expand Up @@ -78,7 +79,8 @@ export const registerModule = ({ key, stores, routers, locales, Root, NotFound }
}
if (routers) {
const routeData = registRouters(key, routers, { Root, NotFound });
routeInfoStore.reducers.$_updateRouteInfo(browserHistory.location, routeData);
const latestRouteInfo = routeInfoStore.reducers.$_updateRouteInfo(browserHistory.location, routeData);
emit('@routeChange', latestRouteInfo);
}

typeof cb === 'function' && cb();
Expand Down
7 changes: 4 additions & 3 deletions core/src/nusi/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ import {
Ellipsis,
SelectCategory,
SelectCombo,
Switch as NusiSwitch,
ConfigProvider as NusiConfigProvider,
Tree as NusiTree,
Popover as NusiPopover,
Tree as NusiTree,
Popover as NusiPopover,
Select as NusiSelect,
Icon as NusiIcon,
Empty as NusiEmpty,
Expand Down Expand Up @@ -197,4 +198,4 @@ export {
NusiEmpty,
NusiCascader,
NusiTag,
}
};
1 change: 0 additions & 1 deletion core/src/stores/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ const routeInfoStore = createStore({
isEntering: (level: string) => routeMarks.includes(level) && !prevRouteInfo.routeMarks.includes(level),
isLeaving: (level: string) => !routeMarks.includes(level) && prevRouteInfo.routeMarks.includes(level),
};
emit('@routeChange', routeInfo);
return routeInfo;
},
},
Expand Down
1 change: 1 addition & 0 deletions core/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ module.exports = () => {
'./config': './src/config.ts',
'./stores/route': './src/stores/route.ts',
'./stores/loading': './src/stores/loading.ts',
'./utils/ws': './src/utils/ws.ts',
'./nusi':'./src/nusi/index.tsx',
},
shared: {
Expand Down
21 changes: 0 additions & 21 deletions nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,6 @@ server {
return 302 /-$request_uri;
}

location ^~ /uc {
index index.html;
try_files /static/uc/index.html /index.html =404;
}

location ^~ /api/uc {
proxy_pass http://${KRATOS_ADDR};
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $my_scheme;
proxy_set_header Host $http_host;
}

location ^~ /api/uc/private {
proxy_pass http://${KRATOS_PRIVATE_ADDR};
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $my_scheme;
proxy_set_header Host $http_host;
}

location /api/dice-env {
default_type application/javascript;
return 200 'window.diceEnv={
Expand Down
15 changes: 8 additions & 7 deletions shell/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ const start = (userData: ILoginUser) => {

const IconConfig = {
...DEFAULT_ICON_CONFIGS,
prefix: 'erda'
prefix: 'erda',
};

startApp().then(async (App) => {
// get the organization info first, or will get org is undefined when need org info (like issueStore)
if (!userData.isSysAdmin) {
const orgName = get(location.pathname.split('/'), '[1]');
await orgStore.effects.getOrgByDomain({ orgName });
}
[
import('layout/entry'),
import('org/entry'),
import('app/org-home/entry'),
import('workBench/entry'),
import('runtime/entry'),
Expand All @@ -60,15 +66,10 @@ const start = (userData: ILoginUser) => {
import('dataCenter/entry'),
import('user/entry'),
import('dcos/entry'),
import('org/entry'),
import('addonPlatform/entry'),
...Object.values(modules),
].forEach((p) => p.then(m => m.default(registerModule)));
userStore.reducers.setLoginUser(userData); // 需要在app start之前初始化用户信息
if (!userData.isSysAdmin) {
const orgName = get(location.pathname.split('/'), '[1]');
await orgStore.effects.getOrgByDomain({ orgName });
}
const Wrap = () => {
const currentLocale = getCurrentLocale();
return (
Expand Down Expand Up @@ -147,7 +148,7 @@ const init = (userData: ILoginUser) => {
window.location.href = lastPath;
return;
}
start({ ...userData })
start({ ...userData });
} else {
// 验证系统管理员相关路由
setSysAdminLocationByAuth({
Expand Down
21 changes: 10 additions & 11 deletions shell/app/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ import { getGlobal } from 'app/global-space';
import { some } from 'lodash';
import errorHandler from './error-handler';

/**
* set accept header
*/

const isExcludeOrgHeaderApi = (url) => {
const excludeApis = ['/api/files'];
Expand All @@ -40,12 +37,9 @@ function handleUrl(req) {

const curOrg = getOrgFromPath();
curOrg && req.set('org', curOrg);
// mf_share导出的模块内部会引用这里的agent,导致use方法被执行两次,添加markedOrg避免多次重复添加
if (!req.markedOrg && !isExcludeOrgHeaderApi(req.url)) {
if (!isExcludeOrgHeaderApi(req.url)) {
req.url = setApiWithOrg(req.url);
req.markedOrg = true;
}
return req;
}

function handleError(req) {
Expand Down Expand Up @@ -130,8 +124,13 @@ const reqKeyList = [];
// }
// }

agent.use(handleUrl);
agent.use(handelPagingNull);
agent.use(handleError);

// mf_share导出的模块内部会引用这里的agent,导致use方法被执行两次
agent.use(req => {
if (!req._marked) {
req._marked = true;
handleUrl(req);
handelPagingNull(req);
handleError(req);
}
});
export default agent;
19 changes: 19 additions & 0 deletions shell/app/common/components/edit-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@
opacity: 0;
}

.switch-type-selector {
.ant-select-selection {
margin-right: 4px;
border-color: $color-border;

&:hover {
border-color: $color-active;

.ant-select-arrow-icon {
color: $color-active;
}
}
}

.ant-select-arrow-icon {
opacity: 1;
}
}

.member-selector {
.results {
border: 1px solid transparent;
Expand Down
7 changes: 4 additions & 3 deletions shell/app/common/components/markdown-editor/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import MdEditor from '@erda-ui/react-markdown-editor-lite';
import { itemInfo } from '@erda-ui/react-markdown-editor-lite/share/var';
import { EditorProps } from '@erda-ui/react-markdown-editor-lite/editor';
import UploadPlugin from './upload-plugin';
import commonStore from 'common/stores/common';
import { uploadFile } from '../../services';
import { convertToFormData } from 'common/utils';
import { getFormatter } from 'charts/utils';
import '@erda-ui/react-markdown-editor-lite/lib/index.css';
Expand All @@ -40,8 +40,9 @@ export const Editor = React.forwardRef((props: Omit<EditorProps, 'renderHTML'>,
newFile = new window.File([file], fileName, { type: file.type });
}
return new Promise(resolve => {
commonStore.effects.uploadFile(convertToFormData({ file: newFile }))
.then(({ size, url }) => {
uploadFile(convertToFormData({ file: newFile }))
.then((res) => {
const { size, url } = res?.data || {};
let imageUrl = imageText;
imageUrl = imageText.replace('{url}', url)
.replace(/\[(.+)\]/, `[${fileName}(${getFormatter('STORAGE', 'B').format(size)})]`);
Expand Down
4 changes: 2 additions & 2 deletions shell/app/common/utils/go-to.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const changeBrowserHistory = throttle((action, _path) => {
action === 'replace' ? history.replace(_path) : history.push(_path);
}, 1000, { trailing: false });

interface IOptions {
export interface IOptions {
[pathName: string]: any;
append?: boolean;
replace?: boolean;
Expand Down Expand Up @@ -97,7 +97,7 @@ const pathFormat = (url: string) => (params: object) => {
const lostArg = filter(necessaryArg, (arg: string) => params[arg] === undefined);
if (lostArg.length) {
// eslint-disable-next-line no-console
console.error('Jump missing parameters:', lostArg);
console.error('Jump missing parameters:', lostArg, `in url: ${url}`);
return undefined;
}
if (!_query) {
Expand Down
12 changes: 9 additions & 3 deletions shell/app/common/utils/query-string.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import queryString from 'query-string';
import { goTo } from './go-to';
import { goTo, IOptions as IGotoOptions } from './go-to';
import { pick } from 'lodash';

// 设置默认option,区分a=b和a[]=b的情况,也为了避免影响依赖中的queryString
Expand Down Expand Up @@ -78,8 +78,14 @@ export function mergeSearch(obj?: { [prop: string]: any }, toString?: boolean, i
* 合并参数并更新到当前url上
* @param obj 需合并的query对象
*/
export function updateSearch(search?: { [prop: string]: any }, opt?: Obj) {
goTo(`${location.pathname}?${mergeSearch(search, true, false, opt)}`);

interface IOpt {
gotoOption?: IGotoOptions;
[pro: string]: any;
}
export function updateSearch(search?: { [prop: string]: any }, opt?: IOpt) {
const { gotoOption = {}, ...rest } = opt || { };
goTo(`${location.pathname}?${mergeSearch(search, true, false, rest)}`, gotoOption);
}

/**
Expand Down
70 changes: 0 additions & 70 deletions shell/app/common/utils/ws.ts

This file was deleted.

2 changes: 1 addition & 1 deletion shell/app/config-page/components/list/list.spec.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ declare namespace CP_LIST {
rowKey?: string;
visible?: boolean;
size?: ISize;
useLoadMore?: boolean;
isLoadMore?: boolean;
alignCenter?: boolean;
noBorder?: boolean;
pageSizeOptions?: string[]
Expand Down
Loading

0 comments on commit 3105c19

Please sign in to comment.