setup routes for apps code

This commit is contained in:
Connor Turland 2018-03-10 08:25:18 -05:00
parent 48fb750560
commit ffc0deeaf5
8 changed files with 157 additions and 10 deletions

View file

@ -0,0 +1,11 @@
import React, { Component } from 'react'
class AppForm extends Component {
render = () => {
return (
null
)
}
}
export default AppForm

50
src/routes/Apps/Apps.js Normal file
View file

@ -0,0 +1,50 @@
import React, { Component } from 'react'
import { Link } from 'react-router'
import AppsHeader from './AppsHeader'
class Apps extends Component {
render = () => {
return (
<div>
<div id="yield">
<div className="centerContent">
<div className="page-header">
<h2>Registered Apps</h2>
</div>
<table className="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Redirect URIs</th>
<th></th>
</tr>
</thead>
<tbody>
{this.props.apps.map(app => {
return (
<tr id={`application_${app.id}`}>
<td><Link to="/oauth/applications/1">{app.name}</Link></td>
<td>{app.uris}</td>
<td>
<form action={`/oauth/applications/${app.id}`} acceptCharset="UTF-8" method="post">
<input name="utf8" type="hidden" value="✓" />
<input type="hidden" name="_method" value="delete" />
<input type="submit" name="commit" value="remove" onclick="return confirm('Are you sure?')" className="button red-button" data-disable-with="remove" />
</form>
</td>
</tr>
)
})}
</tbody>
</table>
<Link className="button link-button" to="/oauth/applications/new">New App</Link>
</div>
</div>
<AppsHeader />
</div>
)
}
}
export default Apps

View file

@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import NavBar from '../components/NavBar'
import NavBarLink from '../components/NavBarLink'
class Apps extends Component {
class AppsHeader extends Component {
render = () => {
const { currentUser } = this.props
@ -21,4 +21,4 @@ class Apps extends Component {
}
}
export default Apps
export default AppsHeader

View file

@ -0,0 +1,11 @@
import React, { Component } from 'react'
class EditApp extends Component {
render = () => {
return (
null
)
}
}
export default EditApp

11
src/routes/Apps/NewApp.js Normal file
View file

@ -0,0 +1,11 @@
import React, { Component } from 'react'
class NewApp extends Component {
render = () => {
return (
null
)
}
}
export default NewApp

View file

@ -0,0 +1,47 @@
import React, { Component } from 'react'
class NewAuthorization extends Component {
render = () => {
return (
<div id="yield">
<div className="centerContent">
<header className="page-header" role="banner">
<h1>Authorization required</h1>
</header>
<main role="main">
<p className="h4">
Authorize <strong className="text-info">Test</strong> to use your account?
</p>
<div className="actions">
<div className="inline-button button-margin-top">
<form action="/oauth/authorize" accept-charset="UTF-8" method="post">
<input name="utf8" type="hidden" value="✓" />
<input type="hidden" name="client_id" id="client_id" value="61b402af2af8671ae8c282cb32938de3aac7b8241e0c4c5a89af488a97c6157c" />
<input type="hidden" name="redirect_uri" id="redirect_uri" value="urn:ietf:wg:oauth:2.0:oob" />
<input type="hidden" name="state" id="state" />
<input type="hidden" name="response_type" id="response_type" value="code" />
<input type="hidden" name="scope" id="scope" value="" />
<input type="submit" name="commit" value="Authorize" className="button" data-disable-with="Authorize" />
</form>
</div>
<div className="inline-button button-margin-top">
<form action="/oauth/authorize" accept-charset="UTF-8" method="post">
<input name="utf8" type="hidden" value="✓" />
<input type="hidden" name="_method" value="delete" />
<input type="hidden" name="client_id" id="client_id" value="61b402af2af8671ae8c282cb32938de3aac7b8241e0c4c5a89af488a97c6157c" />
<input type="hidden" name="redirect_uri" id="redirect_uri" value="urn:ietf:wg:oauth:2.0:oob" />
<input type="hidden" name="state" id="state" />
<input type="hidden" name="response_type" id="response_type" value="code" />
<input type="hidden" name="scope" id="scope" value="" />
<input type="submit" name="commit" value="Deny" className="button red-button" data-disable-with="Deny" />
</form>
</div>
</div>
</main>
</div>
</div>
)
}
}
export default NewAuthorization

View file

@ -0,0 +1,11 @@
import React, { Component } from 'react'
class App extends Component {
render = () => {
return (
<div></div>
)
}
}
export default App

View file

@ -1,7 +1,14 @@
import React from 'react'
import { Route, IndexRoute, Redirect } from 'react-router'
import App from './App'
import Apps from './Apps'
import Apps from './Apps/Apps'
import ShowApp from './Apps/ShowApp'
import NewApp from './Apps/NewApp'
import EditApp from './Apps/EditApp'
import Authorizations from './Apps/Authorizations'
import NewAuthorization from './Apps/NewAuthorization'
import ShowAuthorization from './Apps/ShowAuthorization'
import Authorized from './Apps/Authorized'
import Maps from './Maps'
import MapView from './MapView'
import Metacodes from './Admin/Metacodes'
@ -70,18 +77,17 @@ export default function makeRoutes (currentUser) {
<Route path="oauth">
<Route path="token/info" component={Apps} />
<Route path="authorize">
<IndexRoute component={nullComponent} />
<Route path=":code" component={nullComponent} />
<IndexRoute component={NewAuthorization} />
<Route path=":code" component={ShowAuthorization} />
</Route>
<Route path="authorized_applications">
<IndexRoute component={Apps} />
<Route path=":id" component={Apps} />
<IndexRoute component={Authorized} />
</Route>
<Route path="applications">
<IndexRoute component={Apps} />
<Route path="new" component={Apps} />
<Route path=":id" component={Apps} />
<Route path=":id/edit" component={Apps} />
<Route path="new" component={NewApp} />
<Route path=":id" component={ShowApp} />
<Route path=":id/edit" component={EditApp} />
</Route>
</Route>
</Route>