Skip to content

Commit

Permalink
test: test CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
robinji0 committed Jun 24, 2023
1 parent 9e3fc55 commit 60d6777
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 22 deletions.
10 changes: 9 additions & 1 deletion chat2db-client/src/models/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@ export default {

reducers: {
// 获取连接池列表
setConnectionList(state: ConnectionState, { payload }: { payload: ConnectionState['connectionList'] }) {
return {
...state,
connectionList: payload
}
},

// 设置当前选着的Connection
setCurConnection(
state: ConnectionState,
{ payload }: { payload: ConnectionState['curConnection'] },
) {
return { ...state, curConnection: payload }
}
},


}
}
34 changes: 26 additions & 8 deletions chat2db-client/src/pages/main/connections/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IConnectionDetails } from '@/typings/connection';
import { Button, Dropdown, Modal } from 'antd';
import { MoreOutlined } from '@ant-design/icons';
import styles from './index.less';
import { connect } from 'umi';
import { connect, history } from 'umi';
import { ConnectionState } from '@/models/connection';

interface IMenu {
Expand All @@ -21,25 +21,38 @@ interface IMenu {
icon: React.ReactNode;
meta: IConnectionDetails;
}
interface IProps { }
interface IProps {
connectionList: IConnectionDetails[];
curConnection: IConnectionDetails;
dispatch: (p: { type: string, payload: any }) => void

}

function Connections(props: IProps) {
const { connectionList } = props;
const volatileRef = useRef<any>();
const [connectionList, setConnectionList] = useState<IConnectionDetails[]>();
// const [connectionList, setConnectionList] = useState<IConnectionDetails[]>();
const [curConnection, setCurConnection] = useState<Partial<IConnectionDetails>>({});



useEffect(() => {
getConnectionList();
}, []);

function getConnectionList() {
const getConnectionList = async () => {
let p = {
pageNo: 1,
pageSize: 999,
};
connectionService.getList(p).then((res) => {
setConnectionList(res.data);
});
let res = await connectionService.getList(p)
// setConnectionList(res.data);

props.dispatch({
type: 'connection/setConnectionList',
payload: res.data,
})

}

function handleCreateConnections(database: IDatabase) {
Expand Down Expand Up @@ -87,7 +100,12 @@ function Connections(props: IProps) {
key: 'EnterWorkSpace',
label: i18n('connection.menu.enterToWorkSpace'),
onClick: () => {
window.location.replace('/workspace');
props.dispatch({
type: 'connection/setCurConnection',
payload: menu.meta,
})
history.push('/workspace')
// window.location.replace('/workspace');
},
},
{
Expand Down
28 changes: 15 additions & 13 deletions chat2db-client/src/pages/main/dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,19 @@ export default connect(({ global }: { global: GlobalState }) => ({

{
/*
<Button
onClick={() => {
props.dispatch({
type: 'global/updateSettings',
payload: {
theme: 'dark',
language: 'en',
},
});
}}
>
测试dva
</Button> */
<Button
onClick={() => {
props.dispatch({
type: 'global/updateSettings',
payload: {
theme: 'dark',
language: 'en',
},
});
}}
>
测试dva
</Button>
*/
}

0 comments on commit 60d6777

Please sign in to comment.