From 52811681f447a505b0b35579a962403c91a4f4cc Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 14 Nov 2018 00:06:03 +0200 Subject: [PATCH] Fix new plugin/instance/client pages --- .../frontend/src/pages/dashboard/BaseMainView.js | 3 +++ .../frontend/src/pages/dashboard/Client.js | 5 ++--- .../frontend/src/pages/dashboard/Instance.js | 3 +-- .../frontend/src/pages/dashboard/Plugin.js | 14 +++++++++----- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/maubot/management/frontend/src/pages/dashboard/BaseMainView.js b/maubot/management/frontend/src/pages/dashboard/BaseMainView.js index 172a302..de4d4e4 100644 --- a/maubot/management/frontend/src/pages/dashboard/BaseMainView.js +++ b/maubot/management/frontend/src/pages/dashboard/BaseMainView.js @@ -1,5 +1,6 @@ import React, { Component } from "react" import { Link } from "react-router-dom" +import Log from "./Log" class BaseMainView extends Component { constructor(props) { @@ -63,6 +64,8 @@ class BaseMainView extends Component { ))} ) + + renderLog = () => !this.isNew && } export default BaseMainView diff --git a/maubot/management/frontend/src/pages/dashboard/Client.js b/maubot/management/frontend/src/pages/dashboard/Client.js index 45bf10e..0f2b3e7 100644 --- a/maubot/management/frontend/src/pages/dashboard/Client.js +++ b/maubot/management/frontend/src/pages/dashboard/Client.js @@ -21,7 +21,6 @@ import { PrefTable, PrefSwitch, PrefInput } from "../../components/PreferenceTab import Spinner from "../../components/Spinner" import api from "../../api" import BaseMainView from "./BaseMainView" -import Log from "./Log" const ClientListEntry = ({ entry }) => { const classes = ["client", "entry"] @@ -158,7 +157,7 @@ class Client extends BaseMainView { renderPreferences = () => ( - + {this.renderLog()} } } diff --git a/maubot/management/frontend/src/pages/dashboard/Instance.js b/maubot/management/frontend/src/pages/dashboard/Instance.js index 58463be..4b4a736 100644 --- a/maubot/management/frontend/src/pages/dashboard/Instance.js +++ b/maubot/management/frontend/src/pages/dashboard/Instance.js @@ -23,7 +23,6 @@ import PrefTable, { PrefInput, PrefSelect, PrefSwitch } from "../../components/P import api from "../../api" import Spinner from "../../components/Spinner" import BaseMainView from "./BaseMainView" -import Log from "./Log" const InstanceListEntry = ({ entry }) => ( @@ -168,7 +167,7 @@ class Instance extends BaseMainView {
{this.state.error}
- + {this.renderLog()} } } diff --git a/maubot/management/frontend/src/pages/dashboard/Plugin.js b/maubot/management/frontend/src/pages/dashboard/Plugin.js index 4ca7f6a..e3f54d8 100644 --- a/maubot/management/frontend/src/pages/dashboard/Plugin.js +++ b/maubot/management/frontend/src/pages/dashboard/Plugin.js @@ -14,14 +14,13 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . import React from "react" -import { NavLink } from "react-router-dom" +import { NavLink, withRouter } from "react-router-dom" import { ReactComponent as ChevronRight } from "../../res/chevron-right.svg" import { ReactComponent as UploadButton } from "../../res/upload.svg" import PrefTable, { PrefInput } from "../../components/PreferenceTable" import Spinner from "../../components/Spinner" import api from "../../api" import BaseMainView from "./BaseMainView" -import Log from "./Log" const PluginListEntry = ({ entry }) => ( @@ -34,6 +33,11 @@ const PluginListEntry = ({ entry }) => ( class Plugin extends BaseMainView { static ListEntry = PluginListEntry + constructor(props) { + super(props) + this.deleteFunc = api.deletePlugin + } + get initialState() { return { id: "", @@ -90,10 +94,10 @@ class Plugin extends BaseMainView { }
{this.state.error}
- {!this.isNew && this.renderInstances()} - + {this.renderInstances()} + {this.renderLog()} } } -export default Plugin +export default withRouter(Plugin)