diff --git a/maubot/management/frontend/src/api.js b/maubot/management/frontend/src/api.js
index 7e1ef7f..d0acbb6 100644
--- a/maubot/management/frontend/src/api.js
+++ b/maubot/management/frontend/src/api.js
@@ -68,11 +68,21 @@ export async function getPlugin(id) {
return await resp.json()
}
-export async function uploadPlugin(data) {
- const resp = await fetch(`${BASE_PATH}/plugins/upload`, {
- headers: getHeaders("application/zip"),
- body: data,
- })
+export async function uploadPlugin(data, id) {
+ let resp
+ if (id) {
+ resp = await fetch(`${BASE_PATH}/plugin/${id}`, {
+ headers: getHeaders("applcation/zip"),
+ body: data,
+ method: "PUT",
+ })
+ } else {
+ resp = await fetch(`${BASE_PATH}/plugins/upload`, {
+ headers: getHeaders("application/zip"),
+ body: data,
+ method: "POST",
+ })
+ }
return await resp.json()
}
diff --git a/maubot/management/frontend/src/dashboard/client/View.js b/maubot/management/frontend/src/dashboard/client/View.js
index 5256549..b63d58f 100644
--- a/maubot/management/frontend/src/dashboard/client/View.js
+++ b/maubot/management/frontend/src/dashboard/client/View.js
@@ -17,7 +17,7 @@ import React, { Component } from "react"
class ClientView extends Component {
render() {
- return
{this.props.client.displayname}
+ return {this.props.displayname}
}
}
diff --git a/maubot/management/frontend/src/dashboard/index.js b/maubot/management/frontend/src/dashboard/index.js
index 6e40a8f..77ea69b 100644
--- a/maubot/management/frontend/src/dashboard/index.js
+++ b/maubot/management/frontend/src/dashboard/index.js
@@ -14,8 +14,9 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
import React, { Component } from "react"
-import { Route, Redirect } from "react-router-dom"
+import { Route, Switch, Link } from "react-router-dom"
import api from "../api"
+import { ReactComponent as Plus } from "../res/plus.svg"
import InstanceListEntry from "./instance/ListEntry"
import InstanceView from "./instance/View"
import ClientListEntry from "./client/ListEntry"
@@ -62,41 +63,55 @@ class Dashboard extends Component {
if (!entry) {
return "Not found :("
}
- return React.createElement(type, { [field]: entry })
+ return React.createElement(type, entry)
}
render() {
return
-
+
Maubot Manager
-
+
{localStorage.username}
-
Instances
+
{this.renderList("instance", InstanceListEntry)}
-
Clients
+
{this.renderList("client", ClientListEntry)}
-
Plugins
+
{this.renderList("plugin", PluginListEntry)}
-
- "Hello, World!"}/>
-
- this.renderView("instance", InstanceView, match.params.id)}/>
-
- this.renderView("client", ClientView, match.params.id)}/>
-
- this.renderView("plugin", PluginView, match.params.id)}/>
- }/>
+
+
+ "Hello, World!"}/>
+ }/>
+ }/>
+ }/>
+
+ this.renderView("instance", InstanceView, match.params.id)}/>
+
+ this.renderView("client", ClientView, match.params.id)}/>
+
+ this.renderView("plugin", PluginView, match.params.id)}/>
+ "Not found :("}/>
+
}
diff --git a/maubot/management/frontend/src/dashboard/instance/View.js b/maubot/management/frontend/src/dashboard/instance/View.js
index 69bdf9f..9a82cba 100644
--- a/maubot/management/frontend/src/dashboard/instance/View.js
+++ b/maubot/management/frontend/src/dashboard/instance/View.js
@@ -17,7 +17,7 @@ import React, { Component } from "react"
class InstanceView extends Component {
render() {
- return {this.props.instance.id}
+ return {this.props.id}
}
}
diff --git a/maubot/management/frontend/src/dashboard/plugin/View.js b/maubot/management/frontend/src/dashboard/plugin/View.js
index 5b8ccbc..fbcf2c3 100644
--- a/maubot/management/frontend/src/dashboard/plugin/View.js
+++ b/maubot/management/frontend/src/dashboard/plugin/View.js
@@ -17,7 +17,7 @@ import React, { Component } from "react"
class PluginView extends Component {
render() {
- return {this.props.plugin.id}
+ return {this.props.id}
}
}
diff --git a/maubot/management/frontend/src/res/plus.svg b/maubot/management/frontend/src/res/plus.svg
new file mode 100644
index 0000000..8030204
--- /dev/null
+++ b/maubot/management/frontend/src/res/plus.svg
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/maubot/management/frontend/src/style/pages/dashboard.sass b/maubot/management/frontend/src/style/pages/dashboard.sass
index 4be4111..dd001a0 100644
--- a/maubot/management/frontend/src/style/pages/dashboard.sass
+++ b/maubot/management/frontend/src/style/pages/dashboard.sass
@@ -19,7 +19,7 @@
display: grid
height: 100%
- > .title
+ > a.title
grid-area: title
display: flex
align-items: center
@@ -29,6 +29,7 @@
font-weight: bold
color: $text-color
+ text-decoration: none
z-index: 1
@@ -40,7 +41,7 @@
max-width: 2rem
margin-right: .5rem
- > .topbar
+ > div.topbar
grid-area: topbar
display: flex
align-items: center
@@ -53,5 +54,5 @@
@import "sidebar"
- > .dashboard
+ > main.dashboard
grid-area: main
diff --git a/maubot/management/frontend/src/style/pages/sidebar.sass b/maubot/management/frontend/src/style/pages/sidebar.sass
index a96a2cd..47bbfd7 100644
--- a/maubot/management/frontend/src/style/pages/sidebar.sass
+++ b/maubot/management/frontend/src/style/pages/sidebar.sass
@@ -24,8 +24,16 @@
div.list
margin-bottom: 1.5rem
- h3.title
- margin: 0
+ div.title
+ h2
+ margin: 0
+ display: inline-block
+
+ font-size: 1.25rem
+
+ a
+ display: inline-block
+ float: right
a.entry
display: block