mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Use react links.
This commit is contained in:
parent
8790e95147
commit
ee1e08ae20
@ -17,7 +17,7 @@ import './App.css';
|
|||||||
import * as Setting from "./Setting";
|
import * as Setting from "./Setting";
|
||||||
import {DownOutlined, LogoutOutlined, SettingOutlined} from '@ant-design/icons';
|
import {DownOutlined, LogoutOutlined, SettingOutlined} from '@ant-design/icons';
|
||||||
import {Avatar, BackTop, Dropdown, Layout, Menu} from 'antd';
|
import {Avatar, BackTop, Dropdown, Layout, Menu} from 'antd';
|
||||||
import {Switch, Route, withRouter, Redirect} from 'react-router-dom'
|
import {Switch, Route, withRouter, Redirect, Link} from 'react-router-dom'
|
||||||
import * as AccountBackend from "./backend/AccountBackend";
|
import * as AccountBackend from "./backend/AccountBackend";
|
||||||
import OrganizationListPage from "./OrganizationListPage";
|
import OrganizationListPage from "./OrganizationListPage";
|
||||||
import OrganizationEditPage from "./OrganizationEditPage";
|
import OrganizationEditPage from "./OrganizationEditPage";
|
||||||
@ -80,16 +80,9 @@ class App extends Component {
|
|||||||
AccountBackend.getAccount()
|
AccountBackend.getAccount()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const account = Setting.parseJson(res.data);
|
const account = Setting.parseJson(res.data);
|
||||||
if (window.location.pathname === '/' && account === null) {
|
|
||||||
Setting.goToLink("/");
|
|
||||||
}
|
|
||||||
this.setState({
|
this.setState({
|
||||||
account: account,
|
account: account,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (account !== undefined && account !== null) {
|
|
||||||
window.mouselogUserId = account.username;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,24 +154,17 @@ class App extends Component {
|
|||||||
res.push(this.renderRightDropdown());
|
res.push(this.renderRightDropdown());
|
||||||
} else {
|
} else {
|
||||||
res.push(
|
res.push(
|
||||||
<Menu.Item key="1" style={{float: 'right', marginRight: '20px'}}>
|
<Menu.Item key="100" style={{float: 'right', marginRight: '20px'}}>
|
||||||
<a href="/register">
|
<Link to="/register">
|
||||||
Register
|
Register
|
||||||
</a>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
);
|
);
|
||||||
res.push(
|
res.push(
|
||||||
<Menu.Item key="2" style={{float: 'right'}}>
|
<Menu.Item key="101" style={{float: 'right'}}>
|
||||||
<a href="/login">
|
<Link to="/login">
|
||||||
Login
|
Login
|
||||||
</a>
|
</Link>
|
||||||
</Menu.Item>
|
|
||||||
);
|
|
||||||
res.push(
|
|
||||||
<Menu.Item key="4" style={{float: 'right'}}>
|
|
||||||
<a href="/">
|
|
||||||
Home
|
|
||||||
</a>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -195,37 +181,37 @@ class App extends Component {
|
|||||||
|
|
||||||
res.push(
|
res.push(
|
||||||
<Menu.Item key="0">
|
<Menu.Item key="0">
|
||||||
<a href="/">
|
<Link to="/">
|
||||||
Home
|
Home
|
||||||
</a>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
);
|
);
|
||||||
res.push(
|
res.push(
|
||||||
<Menu.Item key="1">
|
<Menu.Item key="1">
|
||||||
<a href="/organizations">
|
<Link to="/organizations">
|
||||||
Organizations
|
Organizations
|
||||||
</a>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
);
|
);
|
||||||
res.push(
|
res.push(
|
||||||
<Menu.Item key="2">
|
<Menu.Item key="2">
|
||||||
<a href="/users">
|
<Link to="/users">
|
||||||
Users
|
Users
|
||||||
</a>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
);
|
);
|
||||||
res.push(
|
res.push(
|
||||||
<Menu.Item key="3">
|
<Menu.Item key="3">
|
||||||
<a href="/providers">
|
<Link to="/providers">
|
||||||
Providers
|
Providers
|
||||||
</a>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
);
|
);
|
||||||
res.push(
|
res.push(
|
||||||
<Menu.Item key="4">
|
<Menu.Item key="4">
|
||||||
<a href="/applications">
|
<Link to="/applications">
|
||||||
Applications
|
Applications
|
||||||
</a>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
import {Link} from "react-router-dom";
|
||||||
import {Button, Col, Popconfirm, Row, Table} from 'antd';
|
import {Button, Col, Popconfirm, Row, Table} from 'antd';
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import * as Setting from "./Setting";
|
import * as Setting from "./Setting";
|
||||||
@ -76,7 +77,9 @@ class ApplicationListPage extends React.Component {
|
|||||||
sorter: (a, b) => a.name.localeCompare(b.name),
|
sorter: (a, b) => a.name.localeCompare(b.name),
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<a href={`/applications/${text}`}>{text}</a>
|
<Link to={`/applications/${text}`}>
|
||||||
|
{text}
|
||||||
|
</Link>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -104,11 +107,9 @@ class ApplicationListPage extends React.Component {
|
|||||||
width: '100px',
|
width: '100px',
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
|
||||||
<a target="_blank" href={text}>
|
<a target="_blank" href={text}>
|
||||||
<img src={text} alt={text} width={150} style={{marginBottom: '20px'}}/>
|
<img src={text} alt={text} width={150} />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -127,7 +128,7 @@ class ApplicationListPage extends React.Component {
|
|||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => Setting.goToLink(`/applications/${record.name}`)}>Edit</Button>
|
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => this.props.history.push(`/applications/${record.name}`)}>Edit</Button>
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={`Sure to delete application: ${record.name} ?`}
|
title={`Sure to delete application: ${record.name} ?`}
|
||||||
onConfirm={() => this.deleteApplication(index)}
|
onConfirm={() => this.deleteApplication(index)}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
import {Link} from "react-router-dom";
|
||||||
import {Button, Col, Popconfirm, Row, Table} from 'antd';
|
import {Button, Col, Popconfirm, Row, Table} from 'antd';
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import * as Setting from "./Setting";
|
import * as Setting from "./Setting";
|
||||||
@ -75,7 +76,9 @@ class OrganizationListPage extends React.Component {
|
|||||||
sorter: (a, b) => a.name.localeCompare(b.name),
|
sorter: (a, b) => a.name.localeCompare(b.name),
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<a href={`/organizations/${text}`}>{text}</a>
|
<Link to={`/organizations/${text}`}>
|
||||||
|
{text}
|
||||||
|
</Link>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -111,7 +114,7 @@ class OrganizationListPage extends React.Component {
|
|||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => Setting.goToLink(`/organizations/${record.name}`)}>Edit</Button>
|
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => this.props.history.push(`/organizations/${record.name}`)}>Edit</Button>
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={`Sure to delete organization: ${record.name} ?`}
|
title={`Sure to delete organization: ${record.name} ?`}
|
||||||
onConfirm={() => this.deleteOrganization(index)}
|
onConfirm={() => this.deleteOrganization(index)}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
import {Link} from "react-router-dom";
|
||||||
import {Button, Col, Popconfirm, Row, Table} from 'antd';
|
import {Button, Col, Popconfirm, Row, Table} from 'antd';
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import * as Setting from "./Setting";
|
import * as Setting from "./Setting";
|
||||||
@ -78,7 +79,9 @@ class ProviderListPage extends React.Component {
|
|||||||
sorter: (a, b) => a.name.localeCompare(b.name),
|
sorter: (a, b) => a.name.localeCompare(b.name),
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<a href={`/providers/${text}`}>{text}</a>
|
<Link to={`/providers/${text}`}>
|
||||||
|
{text}
|
||||||
|
</Link>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -135,7 +138,7 @@ class ProviderListPage extends React.Component {
|
|||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => Setting.goToLink(`/providers/${record.name}`)}>Edit</Button>
|
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => this.props.history.push(`/providers/${record.name}`)}>Edit</Button>
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={`Sure to delete provider: ${record.name} ?`}
|
title={`Sure to delete provider: ${record.name} ?`}
|
||||||
onConfirm={() => this.deleteProvider(index)}
|
onConfirm={() => this.deleteProvider(index)}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
import {Link} from "react-router-dom";
|
||||||
import {Button, Col, Popconfirm, Row, Table} from 'antd';
|
import {Button, Col, Popconfirm, Row, Table} from 'antd';
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import * as Setting from "./Setting";
|
import * as Setting from "./Setting";
|
||||||
@ -78,7 +79,9 @@ class UserListPage extends React.Component {
|
|||||||
sorter: (a, b) => a.name.localeCompare(b.name),
|
sorter: (a, b) => a.name.localeCompare(b.name),
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<a href={`/users/${text}`}>{text}</a>
|
<Link to={`/users/${text}`}>
|
||||||
|
{text}
|
||||||
|
</Link>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -135,7 +138,7 @@ class UserListPage extends React.Component {
|
|||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => Setting.goToLink(`/users/${record.name}`)}>Edit</Button>
|
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => this.props.history.push(`/users/${record.name}`)}>Edit</Button>
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={`Sure to delete user: ${record.name} ?`}
|
title={`Sure to delete user: ${record.name} ?`}
|
||||||
onConfirm={() => this.deleteUser(index)}
|
onConfirm={() => this.deleteUser(index)}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user