Put system stuff on home page
This commit is contained in:
@@ -15,8 +15,8 @@ export const config = {
|
|||||||
homeRegionDelta: 0.005,
|
homeRegionDelta: 0.005,
|
||||||
geocodeDelayMilliseconds: 500,
|
geocodeDelayMilliseconds: 500,
|
||||||
|
|
||||||
defaultUser: "john@lyon-smith.org",
|
//defaultUser: "john@lyon-smith.org",
|
||||||
// defaultUser: "",
|
defaultUser: "",
|
||||||
|
|
||||||
// This region is downtown Toronto
|
// This region is downtown Toronto
|
||||||
initialRegion: {
|
initialRegion: {
|
||||||
@@ -27,12 +27,12 @@ export const config = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// This region is Bainbridge Island
|
// This region is Bainbridge Island
|
||||||
initialRegion: {
|
// initialRegion: {
|
||||||
latitude: 47.629536,
|
// latitude: 47.629536,
|
||||||
longitude: -122.524162,
|
// longitude: -122.524162,
|
||||||
latitudeDelta: 0.0922,
|
// latitudeDelta: 0.0922,
|
||||||
longitudeDelta: 0.0421,
|
// longitudeDelta: 0.0421,
|
||||||
},
|
// },
|
||||||
|
|
||||||
// alwaysShowWorkItemInAR: true,
|
// alwaysShowWorkItemInAR: true,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import { Home } from "./Home"
|
|||||||
import { Profile } from "./Profile"
|
import { Profile } from "./Profile"
|
||||||
import { Users } from "./Users"
|
import { Users } from "./Users"
|
||||||
import { Teams } from "./Teams"
|
import { Teams } from "./Teams"
|
||||||
import { System } from "./System"
|
|
||||||
import { Header, Column, Footer } from "ui"
|
import { Header, Column, Footer } from "ui"
|
||||||
import { BrowserRouter, Route, Switch } from "react-router-dom"
|
import { BrowserRouter, Route, Switch } from "react-router-dom"
|
||||||
import { sizeInfo } from "ui/style"
|
import { sizeInfo } from "ui/style"
|
||||||
@@ -84,12 +83,6 @@ export class App extends Component {
|
|||||||
/>
|
/>
|
||||||
<ProtectedRoute exact admin path="/admin/home" component={Home} />
|
<ProtectedRoute exact admin path="/admin/home" component={Home} />
|
||||||
<ProtectedRoute exact admin path="/admin/teams" component={Teams} />
|
<ProtectedRoute exact admin path="/admin/teams" component={Teams} />
|
||||||
<ProtectedRoute
|
|
||||||
exact
|
|
||||||
admin
|
|
||||||
path="/admin/system"
|
|
||||||
component={System}
|
|
||||||
/>
|
|
||||||
<ProtectedRoute exact admin path="/admin/users" component={Users} />
|
<ProtectedRoute exact admin path="/admin/users" component={Users} />
|
||||||
<DefaultRoute user="/user/profile" admin="/admin/home" />
|
<DefaultRoute user="/user/profile" admin="/admin/home" />
|
||||||
</Switch>
|
</Switch>
|
||||||
|
|||||||
@@ -1,47 +1,217 @@
|
|||||||
import React, { Component, Fragment } from "react"
|
import React, { Component, Fragment } from "react"
|
||||||
import PropTypes from "prop-types"
|
import PropTypes from "prop-types"
|
||||||
import { Row, Column, PanelButton } from "ui"
|
import { Box, Image, Column, Row, Button, Link } from "ui"
|
||||||
import { sizeInfo } from "ui/style"
|
import { MessageModal, WaitModal, YesNoMessageModal } from "../Modal"
|
||||||
|
import { sizeInfo, colorInfo } from "ui/style"
|
||||||
|
import headerLogo from "images/logo.png"
|
||||||
|
import autobind from "autobind-decorator"
|
||||||
|
import { api } from "../API"
|
||||||
|
|
||||||
export class Home extends Component {
|
export class Home extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
history: PropTypes.object,
|
changeTitle: PropTypes.func.isRequired,
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props)
|
||||||
|
this.state = {
|
||||||
|
messageModal: null,
|
||||||
|
waitModal: null,
|
||||||
|
yesNoModal: null,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@autobind
|
||||||
|
handleDeleteActivities() {
|
||||||
|
this.setState({
|
||||||
|
yesNoModal: {
|
||||||
|
question:
|
||||||
|
"Are you sure you want to delete all activities in the system?",
|
||||||
|
onDismiss: this.handleDeleteActivitiesDismiss,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@autobind
|
||||||
|
handleDeleteActivitiesDismiss(yes) {
|
||||||
|
if (yes) {
|
||||||
|
this.setState({ waitModal: { message: "Deleting All Activities..." } })
|
||||||
|
api
|
||||||
|
.deleteAllActivities()
|
||||||
|
.then(() => {
|
||||||
|
this.setState({
|
||||||
|
waitModal: null,
|
||||||
|
messageModal: {
|
||||||
|
icon: "thumb",
|
||||||
|
message: "All logged activities have been deleted",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.setState({
|
||||||
|
waitModal: null,
|
||||||
|
messageModal: {
|
||||||
|
icon: "hand",
|
||||||
|
message: "Unable to request delete activities.",
|
||||||
|
detail: error.message,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
yesNoModal: null,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@autobind
|
||||||
|
handleDeleteWorkItems() {
|
||||||
|
this.setState({
|
||||||
|
yesNoModal: {
|
||||||
|
question:
|
||||||
|
"Are you sure you want to delete all work items & activities in the system?",
|
||||||
|
onDismiss: this.handleDeleteWorkItemsDismiss,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@autobind
|
||||||
|
handleDeleteWorkItemsDismiss(yes) {
|
||||||
|
if (yes) {
|
||||||
|
this.setState({
|
||||||
|
waitModal: { message: "Deleting All Work Items & Activities..." },
|
||||||
|
})
|
||||||
|
api
|
||||||
|
.deleteAllWorkItems()
|
||||||
|
.then(() => {
|
||||||
|
this.setState({
|
||||||
|
waitModal: null,
|
||||||
|
messageModal: {
|
||||||
|
icon: "thumb",
|
||||||
|
message: "All work items and logged activities have been deleted",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.setState({
|
||||||
|
waitModal: null,
|
||||||
|
messageModal: {
|
||||||
|
icon: "hand",
|
||||||
|
message: "Unable to delete work items and activities.",
|
||||||
|
detail: error.message,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
yesNoModal: null,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@autobind
|
||||||
|
handleMessageModalDismiss() {
|
||||||
|
this.setState({ messageModal: null })
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { messageModal, yesNoModal, waitModal } = this.state
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<Column.Item grow />
|
<Column.Item grow />
|
||||||
<Column.Item>
|
<Column.Item>
|
||||||
<Row>
|
<Row>
|
||||||
<Row.Item grow />
|
<Row.Item grow />
|
||||||
<Row.Item>
|
<Row.Item width={sizeInfo.formRowSpacing} />
|
||||||
<PanelButton
|
<Row.Item width={sizeInfo.modalWidth}>
|
||||||
icon="users"
|
<Box
|
||||||
text="Users"
|
border={{
|
||||||
onClick={() => this.props.history.push("/admin/users")}
|
width: sizeInfo.headerBorderWidth,
|
||||||
/>
|
color: colorInfo.headerBorder,
|
||||||
</Row.Item>
|
}}
|
||||||
<Row.Item width={sizeInfo.panelButtonSpacing} />
|
radius={sizeInfo.formBoxRadius}>
|
||||||
<Row.Item>
|
<Column>
|
||||||
<PanelButton
|
<Column.Item minHeight={sizeInfo.formColumnSpacing} />
|
||||||
icon="teams"
|
<Column.Item>
|
||||||
text="Teams"
|
<Row>
|
||||||
onClick={() => this.props.history.push("/admin/teams")}
|
<Row.Item grow />
|
||||||
/>
|
<Row.Item>
|
||||||
</Row.Item>
|
<Image
|
||||||
<Row.Item width={sizeInfo.panelButtonSpacing} />
|
source={headerLogo}
|
||||||
<Row.Item>
|
width={sizeInfo.loginLogoWidth}
|
||||||
<PanelButton
|
/>
|
||||||
icon="system"
|
</Row.Item>
|
||||||
text="System"
|
<Row.Item grow />
|
||||||
onClick={() => this.props.history.push("/admin/system")}
|
</Row>
|
||||||
/>
|
</Column.Item>
|
||||||
|
<Column.Item minHeight={sizeInfo.formColumnSpacing} />
|
||||||
|
<Column.Item>
|
||||||
|
<Row>
|
||||||
|
<Row.Item grow />
|
||||||
|
<Row.Item>
|
||||||
|
<Button
|
||||||
|
text="Delete All Activities"
|
||||||
|
width={sizeInfo.buttonWideWidth}
|
||||||
|
onClick={this.handleDeleteActivities}
|
||||||
|
/>
|
||||||
|
</Row.Item>
|
||||||
|
<Row.Item grow />
|
||||||
|
</Row>
|
||||||
|
</Column.Item>
|
||||||
|
<Column.Item minHeight={sizeInfo.formColumnSpacing} />
|
||||||
|
<Column.Item>
|
||||||
|
<Row>
|
||||||
|
<Row.Item grow />
|
||||||
|
<Row.Item>
|
||||||
|
<Button
|
||||||
|
text="Delete All Work Items"
|
||||||
|
width={sizeInfo.buttonWideWidth}
|
||||||
|
onClick={this.handleDeleteWorkItems}
|
||||||
|
/>
|
||||||
|
</Row.Item>
|
||||||
|
<Row.Item grow />
|
||||||
|
</Row>
|
||||||
|
</Column.Item>
|
||||||
|
<Column.Item minHeight={sizeInfo.formColumnSpacing} />
|
||||||
|
<Column.Item>
|
||||||
|
<Row>
|
||||||
|
<Row.Item grow />
|
||||||
|
<Row.Item>
|
||||||
|
<Link to={api.makeTeamStatusUrl()}>
|
||||||
|
Download Team Data
|
||||||
|
</Link>
|
||||||
|
</Row.Item>
|
||||||
|
<Row.Item grow />
|
||||||
|
</Row>
|
||||||
|
</Column.Item>
|
||||||
|
<Column.Item height={sizeInfo.formColumnSpacing} />
|
||||||
|
</Column>
|
||||||
|
</Box>
|
||||||
</Row.Item>
|
</Row.Item>
|
||||||
<Row.Item grow />
|
<Row.Item grow />
|
||||||
</Row>
|
</Row>
|
||||||
</Column.Item>
|
</Column.Item>
|
||||||
<Column.Item grow />
|
<Column.Item grow>
|
||||||
|
<YesNoMessageModal
|
||||||
|
open={!!yesNoModal}
|
||||||
|
question={yesNoModal ? yesNoModal.question : ""}
|
||||||
|
onDismiss={yesNoModal && yesNoModal.onDismiss}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<MessageModal
|
||||||
|
open={!!messageModal}
|
||||||
|
icon={messageModal ? messageModal.icon : ""}
|
||||||
|
message={messageModal ? messageModal.message : ""}
|
||||||
|
detail={messageModal ? messageModal.title : ""}
|
||||||
|
onDismiss={this.handleMessageModalDismiss}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<WaitModal
|
||||||
|
open={!!waitModal}
|
||||||
|
message={waitModal ? waitModal.message : ""}
|
||||||
|
/>
|
||||||
|
</Column.Item>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,218 +0,0 @@
|
|||||||
import React, { Component, Fragment } from "react"
|
|
||||||
import PropTypes from "prop-types"
|
|
||||||
import { Box, Image, Column, Row, Button, Link } from "ui"
|
|
||||||
import { MessageModal, WaitModal, YesNoMessageModal } from "../Modal"
|
|
||||||
import { sizeInfo, colorInfo } from "ui/style"
|
|
||||||
import headerLogo from "images/logo.png"
|
|
||||||
import autobind from "autobind-decorator"
|
|
||||||
import { api } from "../API"
|
|
||||||
|
|
||||||
export class System extends Component {
|
|
||||||
static propTypes = {
|
|
||||||
changeTitle: PropTypes.func.isRequired,
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(props) {
|
|
||||||
super(props)
|
|
||||||
this.state = {
|
|
||||||
messageModal: null,
|
|
||||||
waitModal: null,
|
|
||||||
yesNoModal: null,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
handleDeleteActivities() {
|
|
||||||
this.setState({
|
|
||||||
yesNoModal: {
|
|
||||||
question:
|
|
||||||
"Are you sure you want to delete all activities in the system?",
|
|
||||||
onDismiss: this.handleDeleteActivitiesDismiss,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
handleDeleteActivitiesDismiss(yes) {
|
|
||||||
if (yes) {
|
|
||||||
this.setState({ waitModal: { message: "Deleting All Activities..." } })
|
|
||||||
api
|
|
||||||
.deleteAllActivities()
|
|
||||||
.then(() => {
|
|
||||||
this.setState({
|
|
||||||
waitModal: null,
|
|
||||||
messageModal: {
|
|
||||||
icon: "thumb",
|
|
||||||
message: "All logged activities have been deleted",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
this.setState({
|
|
||||||
waitModal: null,
|
|
||||||
messageModal: {
|
|
||||||
icon: "hand",
|
|
||||||
message: "Unable to request delete activities.",
|
|
||||||
detail: error.message,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
yesNoModal: null,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
handleDeleteWorkItems() {
|
|
||||||
this.setState({
|
|
||||||
yesNoModal: {
|
|
||||||
question:
|
|
||||||
"Are you sure you want to delete all work items & activities in the system?",
|
|
||||||
onDismiss: this.handleDeleteWorkItemsDismiss,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
handleDeleteWorkItemsDismiss(yes) {
|
|
||||||
if (yes) {
|
|
||||||
this.setState({
|
|
||||||
waitModal: { message: "Deleting All Work Items & Activities..." },
|
|
||||||
})
|
|
||||||
api
|
|
||||||
.deleteAllWorkItems()
|
|
||||||
.then(() => {
|
|
||||||
this.setState({
|
|
||||||
waitModal: null,
|
|
||||||
messageModal: {
|
|
||||||
icon: "thumb",
|
|
||||||
message: "All work items and logged activities have been deleted",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
this.setState({
|
|
||||||
waitModal: null,
|
|
||||||
messageModal: {
|
|
||||||
icon: "hand",
|
|
||||||
message: "Unable to delete work items and activities.",
|
|
||||||
detail: error.message,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
yesNoModal: null,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
handleMessageModalDismiss() {
|
|
||||||
this.setState({ messageModal: null })
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const { messageModal, yesNoModal, waitModal } = this.state
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Fragment>
|
|
||||||
<Column.Item grow />
|
|
||||||
<Column.Item>
|
|
||||||
<Row>
|
|
||||||
<Row.Item grow />
|
|
||||||
<Row.Item width={sizeInfo.formRowSpacing} />
|
|
||||||
<Row.Item width={sizeInfo.modalWidth}>
|
|
||||||
<Box
|
|
||||||
border={{
|
|
||||||
width: sizeInfo.headerBorderWidth,
|
|
||||||
color: colorInfo.headerBorder,
|
|
||||||
}}
|
|
||||||
radius={sizeInfo.formBoxRadius}>
|
|
||||||
<Column>
|
|
||||||
<Column.Item minHeight={sizeInfo.formColumnSpacing} />
|
|
||||||
<Column.Item>
|
|
||||||
<Row>
|
|
||||||
<Row.Item grow />
|
|
||||||
<Row.Item>
|
|
||||||
<Image
|
|
||||||
source={headerLogo}
|
|
||||||
width={sizeInfo.loginLogoWidth}
|
|
||||||
/>
|
|
||||||
</Row.Item>
|
|
||||||
<Row.Item grow />
|
|
||||||
</Row>
|
|
||||||
</Column.Item>
|
|
||||||
<Column.Item minHeight={sizeInfo.formColumnSpacing} />
|
|
||||||
<Column.Item>
|
|
||||||
<Row>
|
|
||||||
<Row.Item grow />
|
|
||||||
<Row.Item>
|
|
||||||
<Button
|
|
||||||
text="Delete All Activities"
|
|
||||||
width={sizeInfo.buttonWideWidth}
|
|
||||||
onClick={this.handleDeleteActivities}
|
|
||||||
/>
|
|
||||||
</Row.Item>
|
|
||||||
<Row.Item grow />
|
|
||||||
</Row>
|
|
||||||
</Column.Item>
|
|
||||||
<Column.Item minHeight={sizeInfo.formColumnSpacing} />
|
|
||||||
<Column.Item>
|
|
||||||
<Row>
|
|
||||||
<Row.Item grow />
|
|
||||||
<Row.Item>
|
|
||||||
<Button
|
|
||||||
text="Delete All Work Items"
|
|
||||||
width={sizeInfo.buttonWideWidth}
|
|
||||||
onClick={this.handleDeleteWorkItems}
|
|
||||||
/>
|
|
||||||
</Row.Item>
|
|
||||||
<Row.Item grow />
|
|
||||||
</Row>
|
|
||||||
</Column.Item>
|
|
||||||
<Column.Item minHeight={sizeInfo.formColumnSpacing} />
|
|
||||||
<Column.Item>
|
|
||||||
<Row>
|
|
||||||
<Row.Item grow />
|
|
||||||
<Row.Item>
|
|
||||||
<Link to={api.makeTeamStatusUrl()}>
|
|
||||||
Download Team Data
|
|
||||||
</Link>
|
|
||||||
</Row.Item>
|
|
||||||
<Row.Item grow />
|
|
||||||
</Row>
|
|
||||||
</Column.Item>
|
|
||||||
<Column.Item height={sizeInfo.formColumnSpacing} />
|
|
||||||
</Column>
|
|
||||||
</Box>
|
|
||||||
</Row.Item>
|
|
||||||
<Row.Item grow />
|
|
||||||
</Row>
|
|
||||||
</Column.Item>
|
|
||||||
<Column.Item grow>
|
|
||||||
<YesNoMessageModal
|
|
||||||
open={!!yesNoModal}
|
|
||||||
question={yesNoModal ? yesNoModal.question : ""}
|
|
||||||
onDismiss={yesNoModal && yesNoModal.onDismiss}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<MessageModal
|
|
||||||
open={!!messageModal}
|
|
||||||
icon={messageModal ? messageModal.icon : ""}
|
|
||||||
message={messageModal ? messageModal.message : ""}
|
|
||||||
detail={messageModal ? messageModal.title : ""}
|
|
||||||
onDismiss={this.handleMessageModalDismiss}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<WaitModal
|
|
||||||
open={!!waitModal}
|
|
||||||
message={waitModal ? waitModal.message : ""}
|
|
||||||
/>
|
|
||||||
</Column.Item>
|
|
||||||
</Fragment>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { System } from './System'
|
|
||||||
@@ -127,6 +127,8 @@ Header.TextButton = Radium(
|
|||||||
|
|
||||||
static style = {
|
static style = {
|
||||||
display: "inline-block",
|
display: "inline-block",
|
||||||
|
position: "relative",
|
||||||
|
top: 3,
|
||||||
fontSize: fontInfo.size.header,
|
fontSize: fontInfo.size.header,
|
||||||
fontFamily: fontInfo.family,
|
fontFamily: fontInfo.family,
|
||||||
color: fontInfo.color.normal,
|
color: fontInfo.color.normal,
|
||||||
|
|||||||
Reference in New Issue
Block a user