From ee1e08ae209832bf6c32059c04cc0e6cf01eb0f4 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Fri, 12 Feb 2021 00:31:53 +0800 Subject: [PATCH] Use react links. --- web/src/App.js | 48 ++++++++++++--------------------- web/src/ApplicationListPage.js | 15 ++++++----- web/src/OrganizationListPage.js | 7 +++-- web/src/ProviderListPage.js | 7 +++-- web/src/UserListPage.js | 7 +++-- 5 files changed, 40 insertions(+), 44 deletions(-) diff --git a/web/src/App.js b/web/src/App.js index 28ba3d1d..e15e989b 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -17,7 +17,7 @@ import './App.css'; import * as Setting from "./Setting"; import {DownOutlined, LogoutOutlined, SettingOutlined} from '@ant-design/icons'; 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 OrganizationListPage from "./OrganizationListPage"; import OrganizationEditPage from "./OrganizationEditPage"; @@ -80,16 +80,9 @@ class App extends Component { AccountBackend.getAccount() .then((res) => { const account = Setting.parseJson(res.data); - if (window.location.pathname === '/' && account === null) { - Setting.goToLink("/"); - } this.setState({ account: account, }); - - if (account !== undefined && account !== null) { - window.mouselogUserId = account.username; - } }); } @@ -161,24 +154,17 @@ class App extends Component { res.push(this.renderRightDropdown()); } else { res.push( - - + + Register - + ); res.push( - - + + Login - - - ); - res.push( - - - Home - + ); } @@ -195,37 +181,37 @@ class App extends Component { res.push( - + Home - + ); res.push( - + Organizations - + ); res.push( - + Users - + ); res.push( - + Providers - + ); res.push( - + Applications - + ); diff --git a/web/src/ApplicationListPage.js b/web/src/ApplicationListPage.js index c1afff0c..1184834b 100644 --- a/web/src/ApplicationListPage.js +++ b/web/src/ApplicationListPage.js @@ -1,4 +1,5 @@ import React from "react"; +import {Link} from "react-router-dom"; import {Button, Col, Popconfirm, Row, Table} from 'antd'; import moment from "moment"; import * as Setting from "./Setting"; @@ -76,7 +77,9 @@ class ApplicationListPage extends React.Component { sorter: (a, b) => a.name.localeCompare(b.name), render: (text, record, index) => { return ( - {text} + + {text} + ) } }, @@ -104,11 +107,9 @@ class ApplicationListPage extends React.Component { width: '100px', render: (text, record, index) => { return ( -
- - {text} - -
+ + {text} + ) } }, @@ -127,7 +128,7 @@ class ApplicationListPage extends React.Component { render: (text, record, index) => { return (
- + this.deleteApplication(index)} diff --git a/web/src/OrganizationListPage.js b/web/src/OrganizationListPage.js index 85eb8ee4..926f0bd7 100644 --- a/web/src/OrganizationListPage.js +++ b/web/src/OrganizationListPage.js @@ -1,4 +1,5 @@ import React from "react"; +import {Link} from "react-router-dom"; import {Button, Col, Popconfirm, Row, Table} from 'antd'; import moment from "moment"; import * as Setting from "./Setting"; @@ -75,7 +76,9 @@ class OrganizationListPage extends React.Component { sorter: (a, b) => a.name.localeCompare(b.name), render: (text, record, index) => { return ( - {text} + + {text} + ) } }, @@ -111,7 +114,7 @@ class OrganizationListPage extends React.Component { render: (text, record, index) => { return (
- + this.deleteOrganization(index)} diff --git a/web/src/ProviderListPage.js b/web/src/ProviderListPage.js index 35a67f7b..ed3a8523 100644 --- a/web/src/ProviderListPage.js +++ b/web/src/ProviderListPage.js @@ -1,4 +1,5 @@ import React from "react"; +import {Link} from "react-router-dom"; import {Button, Col, Popconfirm, Row, Table} from 'antd'; import moment from "moment"; import * as Setting from "./Setting"; @@ -78,7 +79,9 @@ class ProviderListPage extends React.Component { sorter: (a, b) => a.name.localeCompare(b.name), render: (text, record, index) => { return ( - {text} + + {text} + ) } }, @@ -135,7 +138,7 @@ class ProviderListPage extends React.Component { render: (text, record, index) => { return (
- + this.deleteProvider(index)} diff --git a/web/src/UserListPage.js b/web/src/UserListPage.js index 7649b87a..b77ad15c 100644 --- a/web/src/UserListPage.js +++ b/web/src/UserListPage.js @@ -1,4 +1,5 @@ import React from "react"; +import {Link} from "react-router-dom"; import {Button, Col, Popconfirm, Row, Table} from 'antd'; import moment from "moment"; import * as Setting from "./Setting"; @@ -78,7 +79,9 @@ class UserListPage extends React.Component { sorter: (a, b) => a.name.localeCompare(b.name), render: (text, record, index) => { return ( - {text} + + {text} + ) } }, @@ -135,7 +138,7 @@ class UserListPage extends React.Component { render: (text, record, index) => { return (
- + this.deleteUser(index)}