Skip to content

Commit

Permalink
merge hotfix/release1.0 to release 1.0 (#217)
Browse files Browse the repository at this point in the history
* fix: delete oss storage count (#195)

* fix: some chart page loop error (#197)

* fix: redirect to orgRoot when auth check failed (#200)

* fix publish announcement not update immediately and api gateway problem (#196)

* fix(ms): fix limit type doesn't popup when editing api gateway

* fix(org): update published announcement list immediately after pub/stop

* fix: get org info before registerModule (#201)

* fix: jump to personal home page after joining it (#203)

* feat: comment unused mobile artifact bgImage and preview image (#202)

* feat: add copy in test pipeline result (#205)

* Hotfix/fix release (#204)

* fix: some chart page loop error

* fix: update dc

* fix: set remainingTime defautl value 0 (#206)

* fix: synchronize url query to test case search (#207)

* fix websocket not work (#209)

* fix: fix websocket not work

* fix: delete useless ws

* feat: cluster overview display coloring percentage (#211)

* Hotfix: fix loadmore in list component (#210)

* fix: fix loadMore in protocol component of list

* refactor: refactor code

* refactor: refactor code

* refactor: refactor code

* refactor: remove isLoadMore that is out of props

* refactor: remove redundant isLoadMore

* refactor: remove redundant code

Co-authored-by: Lang LEE <liangyuqin1212@gmail.com>
Co-authored-by: 戣蓦 <mcdaddychen@126.com>
Co-authored-by: sherotree <wytreeshero@163.com>
Co-authored-by: 随风 <daskyrk@users.noreply.github.com>
Co-authored-by: Zero <mobius_pan@yeah.net>
  • Loading branch information
6 people authored May 20, 2021
1 parent 9778f0e commit 67d54c1
Show file tree
Hide file tree
Showing 27 changed files with 285 additions and 342 deletions.
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

0 comments on commit 67d54c1

Please sign in to comment.