Skip to content

Commit

Permalink
Merge pull request #533 from garden-io/fix-server-routes
Browse files Browse the repository at this point in the history
Fix server routes
  • Loading branch information
thsig authored Feb 12, 2019
2 parents c92626d + 5abf580 commit d44f4b3
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
5 changes: 4 additions & 1 deletion dashboard/src/components/logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ class Logs extends Component<Props, State> {

return (
<div>
<div className={cls(css`width: 30%;`, "mb-1")}>
<div className={cls(css`
min-width: 12rem;
width: 30%;
`, "mb-1")}>
<Select
value={this.state.selectedService}
options={options}
Expand Down
33 changes: 33 additions & 0 deletions garden-service/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions garden-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"klaw": "^3.0.0",
"koa": "^2.6.2",
"koa-bodyparser": "^4.2.1",
"koa-mount": "^4.0.0",
"koa-router": "^7.4.0",
"koa-static": "^5.0.0",
"koa-websocket": "^5.0.1",
Expand Down Expand Up @@ -113,6 +114,7 @@
"@types/klaw": "^2.1.1",
"@types/koa": "^2.0.47",
"@types/koa-bodyparser": "^4.2.1",
"@types/koa-mount": "^3.0.1",
"@types/koa-router": "^7.0.35",
"@types/koa-websocket": "^5.0.3",
"@types/lodash": "^4.14.119",
Expand Down
9 changes: 7 additions & 2 deletions garden-service/src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import chalk from "chalk"
import Koa = require("koa")
import mount = require("koa-mount")
import serve = require("koa-static")
import Router = require("koa-router")
import websockify = require("koa-websocket")
Expand Down Expand Up @@ -79,8 +80,12 @@ export async function createApp(garden: Garden, log: LogEntry) {
app.use(http.routes())
app.use(http.allowedMethods())

// TODO: Bundle the dashboard with the NPM / Zeit packages
app.use(serve(DASHBOARD_STATIC_DIR))
// This enables navigating straight to a nested route, e.g. "localhost:<PORT>/graph".
// FIXME: We need to be able to do this for any route, instead of hard coding the routes like this.
const routes = ["/", "/graph", "/logs"]
for (const route of routes) {
app.use(mount(route, serve(DASHBOARD_STATIC_DIR)))
}

addWebsocketEndpoint(app, garden, log, commands)

Expand Down

0 comments on commit d44f4b3

Please sign in to comment.