Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge hotfix/release1.0 to release 1.0 #217

Merged
merged 15 commits into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
43 changes: 22 additions & 21 deletions shell/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,34 @@ const start = (userData: ILoginUser) => {

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

startApp().then(async (App) => {
[
import('layout/entry'),
import('org/entry'),
import('app/org-home/entry'),
import('workBench/entry'),
import('runtime/entry'),
import('publisher/entry'),
import('project/entry'),
import('apiManagePlatform/entry'),
import('microService/entry'),
import('app/modules/edge/entry'),
import('application/entry'),
import('dataCenter/entry'),
import('user/entry'),
import('dcos/entry'),
import('addonPlatform/entry'),
...Object.values(modules),
].forEach((p) => p.then(m => m.default(registerModule)));
userStore.reducers.setLoginUser(userData); // 需要在app start之前初始化用户信息
// 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'),
import('publisher/entry'),
import('project/entry'),
import('apiManagePlatform/entry'),
import('microService/entry'),
import('app/modules/edge/entry'),
import('application/entry'),
import('dataCenter/entry'),
import('user/entry'),
import('dcos/entry'),
import('addonPlatform/entry'),
...Object.values(modules),
].forEach((p) => p.then(m => m.default(registerModule)));
userStore.reducers.setLoginUser(userData); // 需要在app start之前初始化用户信息
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
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
25 changes: 14 additions & 11 deletions shell/app/config-page/components/list/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,26 @@ const List = (props: CP_LIST.Props) => {
combineList: list,
});
const { total = 0, pageSize, pageNo = 1 } = state || {};
const { useLoadMore = false, visible = true, size = 'middle', rowKey, alignCenter = false,
const { isLoadMore = false, visible = true, size = 'middle', rowKey, alignCenter = false,
noBorder = false, pageSizeOptions, ...rest } = configProps || {};

// 将接口返回的list和之前的list进行拼接
React.useEffect(() => {
// if isLoadMore is true, the data will be set undefined, combineList don't need to do anything
if (data === undefined) {
return;
}
update((pre) => {
const newState = {
...pre,
...propsState,
}
};
return {
...newState,
combineList: newState.pageNo === 1 ? list : (newState.combineList || []).concat(list)
}
})
}, [propsState, list])

combineList: newState.pageNo === 1 ? list : (newState.combineList || []).concat(list),
};
});
}, [propsState, list, update, data]);

const pagination = React.useMemo(() => {
return isNumber(pageNo) ? {
Expand All @@ -74,8 +77,8 @@ const List = (props: CP_LIST.Props) => {
};

const loadMore = () => {
operations?.changePageNo && execOperation(operations.changePageNo, { pageNo: pageNo + 1 }, { data: { list: [] } });
}
operations?.changePageNo && execOperation(operations.changePageNo, { pageNo: pageNo + 1 });
};

const changePageSize = (pSize: number) => {
operations?.changePageSize && execOperation(operations.changePageSize, { pageNo: 1, pageSize: pSize });
Expand All @@ -93,11 +96,11 @@ const List = (props: CP_LIST.Props) => {
{(state.combineList || []).map((item, idx) => {
return <Item size={size} customProps={customProps} execOperation={execOperation} key={getKey(item, idx)} data={item} alignCenter={alignCenter} noBorder={noBorder} />;
})}
{!useLoadMore && pagination ? (
{!isLoadMore && pagination ? (
<Pagination className='right-flex-box mt12' {...pagination} />
) : null
}
{useLoadMore && total > Math.max(state.combineList?.length, 0)
{isLoadMore && total > Math.max(state.combineList?.length, 0)
&& <div className='hover-active load-more' onClick={loadMore}>{i18n.t('more')}</div>}
</>
) : <EmptyHolder relative />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
.cp-dice-table-group {
position: relative;
margin-bottom: 24px;

.table-board {
margin-top: 16px;
Expand Down Expand Up @@ -42,7 +43,7 @@
display: flex;
justify-content: center;
margin-top: 24px;
margin-bottom: 48px;
margin-bottom: 24px;
color: $color-text-desc;
font-size: 14px;
cursor: pointer;
Expand Down
10 changes: 7 additions & 3 deletions shell/app/config-page/components/table-group/table-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,21 @@ const TableBoard = (props: CP_TABLE_GROUP.ITableBoardProps) => {

const TableGroup = (props: CP_TABLE_GROUP.Props) => {
const { props: configProps, state: propsState, data = {} as CP_TABLE_GROUP.IData, operations, execOperation = noop, updateState = noop } = props;
const [{ pageNo, list: combineList = [], total, pageSize }, updater, update] = useUpdate({
const [{ pageNo, combineList = [], total, pageSize }, updater, update] = useUpdate({
pageNo: propsState?.pageNo || 1,
total: propsState?.total || 0,
pageSize: propsState?.pageSize || 3,
list: data.list,
combineList: data.list,
} || {}) as any;
const { visible } = configProps;
const showLoadMore = total > Math.max(combineList?.length, 0)

// 将接口返回的list和之前的list进行拼接
React.useEffect(() => {
// if isLoadMore is true, the data will be set undefined, combineList don't need to do anything
if (data === undefined) {
return;
}
update((pre) => {
const newState = {
...pre,
Expand All @@ -90,7 +94,7 @@ const TableGroup = (props: CP_TABLE_GROUP.Props) => {

// 加载更多
const loadMore = () => {
operations?.changePageNo && execOperation(operations.changePageNo, { pageNo: pageNo + 1 }, { data: { list: [] } })
operations?.changePageNo && execOperation(operations.changePageNo, { pageNo: pageNo + 1 })
}

if (!visible) {
Expand Down
21 changes: 18 additions & 3 deletions shell/app/config-page/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import * as React from 'react';
import { useMount, useUpdateEffect } from 'react-use';
import { isEmpty, get, set, isEqual } from 'lodash';
import { isEmpty, get, set, isEqual, forEach } from 'lodash';
import { produce } from 'immer';
import { Spin } from 'app/nusi';
import { useUpdate } from 'common';
Expand Down Expand Up @@ -171,14 +171,29 @@ const ConfigPage = React.forwardRef((props: IProps, ref: any) => {
operationData: _rest,
};
});
queryPageConfig(newConfig, partial, op.showLoading);

const formatConfig = clearLoadMoreData(newConfig);
queryPageConfig(formatConfig, partial, op.showLoading);
} else if (updateInfo) {
updateState(updateInfo.dataKey, updateInfo.dataVal);
}
};

const pageProtocol = React.useMemo(() => get(pageConfig, 'protocol'), [pageConfig]);
const clearLoadMoreData = (newConfig: CONFIG_PAGE.RenderConfig) => {
const formatConfig = produce(newConfig, (draft) => {
const comps = get(draft, 'protocol.components');
forEach(comps, (comp) => {
if (comp?.props?.isLoadMore) {
comps[comp?.name] = { ...comp, data: undefined };
}
});
});

return formatConfig;
};


const pageProtocol = React.useMemo(() => get(pageConfig, 'protocol'), [pageConfig]);
const Content = React.useMemo(() => {
return (
<ConfigPageRender
Expand Down
3 changes: 1 addition & 2 deletions shell/app/config-page/page-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const ConfigPageRender = (props: IProps) => {
return updateState(`${compPrefixKey}.${_cId}.state`, val);
};

const reExecOperation = (_cId: string) => (_op: any, val: any, extraVal: any) => {
const reExecOperation = (_cId: string) => (_op: any, val: any) => {
if (!_op || isEmpty(_op)) return;
const op = cloneDeep({ ..._op });
let updateVal = cloneDeep(val) as any;
Expand Down Expand Up @@ -97,7 +97,6 @@ const ConfigPageRender = (props: IProps) => {
_cId,
op,
isEmpty(updateVal) ? undefined : { dataKey: `${compPrefixKey}.${_cId}.state`, dataVal: updateVal },
isEmpty(extraVal) ? undefined : { dataKey: `${compPrefixKey}.${_cId}`, dataVal: extraVal }
);
};

Expand Down
4 changes: 2 additions & 2 deletions shell/app/layout/common/invite-to-org.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default () => {
if (domain.startsWith('local')) {
domain = domain.split('.').slice(1).join('.');
}

getOrgByDomain({ domain, orgName }).then((res: any) => {
res.success && !isEmpty(res.data) && updater.domainData(res.data);
});
Expand All @@ -58,7 +58,7 @@ export default () => {
}).then(() => {
message.success(i18n.t('join org success'));
setTimeout(() => {
window.location.reload();
location.href = `/${orgName}`;
}, 200);
});
};
Expand Down
2 changes: 1 addition & 1 deletion shell/app/layout/stores/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import { createStore } from 'app/cube';
import { getDiceVersion, inviteToOrg } from 'layout/services';
import * as DiceWebSocket from 'common/utils/ws';
import * as DiceWebSocket from 'core/utils/ws';
import { enableIconfont, setApiWithOrg } from 'common/utils';
import routeInfoStore from 'app/common/stores/route';
import { find, merge } from 'lodash';
Expand Down
7 changes: 5 additions & 2 deletions shell/app/modules/dataCenter/pages/cloud-source/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,14 +334,17 @@ const CloudSource = () => {
{i18n.t('dataCenter:Bucket Count')}
</div>
</div>
<div className='part hover-active' onClick={() => { goTo(goTo.pages.cloudSourceOss); }}>
{
// ref issue: 59066
}
{/* <div className='part hover-active' onClick={() => { goTo(goTo.pages.cloudSourceOss); }}>
<div className="count">
{getFormatter('STORAGE', 'B').format(bucket.storageUsage || 0)}
</div>
<div className="name">
{i18n.t('dataCenter:Storage Count')}
</div>
</div>
</div> */}
</div>
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ const ClusterManage = () => {

const toggleAddModalVis = (isCancel = false) => {
if (addModalVis) {
isCancel && !addClusterType && toggleTypeModalVis();
updater.addClusterType('');
isCancel && toggleTypeModalVis();
}
updater.addModalVis(!addModalVis);
};
Expand Down
2 changes: 1 addition & 1 deletion shell/app/modules/dcos/pages/cluster-dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ const ClusterDashboard = () => {
map(machines, ({ ip, clusterName, ...rest }) => {
const { name: colourName, value: colourValue } = getMachineColourValue(rest);
return (
<Tooltip placement="bottom" title={`${ip} (${colourName}: ${colourValue})`} key={`${clusterName}-${ip}`}>
<Tooltip placement="bottom" title={`${ip} (${colourName}: ${colourValue}%)`} key={`${clusterName}-${ip}`}>
<div
className={classnames({
'machine-item': true,
Expand Down
Loading