Fix new plugin/instance/client pages
This commit is contained in:
parent
a3dea42b1a
commit
52811681f4
@ -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 {
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
|
||||
renderLog = () => !this.isNew && <Log showName={false} lines={this.props.log}/>
|
||||
}
|
||||
|
||||
export default BaseMainView
|
||||
|
@ -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 = () => (
|
||||
<PrefTable>
|
||||
<PrefInput rowName="User ID" type="text" disabled={!this.isNew} fullWidth={true}
|
||||
name={!this.isNew ? "id" : ""} value={this.state.id} className="id"
|
||||
name={this.isNew ? "id" : ""} value={this.state.id} className="id"
|
||||
placeholder="@fancybot:example.com" onChange={this.inputChange}/>
|
||||
<PrefInput rowName="Homeserver" type="text" name="homeserver"
|
||||
value={this.state.homeserver} placeholder="https://example.com"
|
||||
@ -210,7 +209,7 @@ class Client extends BaseMainView {
|
||||
{this.renderInstances()}
|
||||
</div>
|
||||
</div>
|
||||
<Log showName={false} lines={this.props.log}/>
|
||||
{this.renderLog()}
|
||||
</>
|
||||
}
|
||||
}
|
||||
|
@ -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 }) => (
|
||||
<NavLink className="instance entry" to={`/instance/${entry.id}`}>
|
||||
@ -168,7 +167,7 @@ class Instance extends BaseMainView {
|
||||
</button>
|
||||
</div>
|
||||
<div className="error">{this.state.error}</div>
|
||||
<Log showName={false} lines={this.props.log}/>
|
||||
{this.renderLog()}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
@ -14,14 +14,13 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
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 }) => (
|
||||
<NavLink className="plugin entry" to={`/plugin/${entry.id}`}>
|
||||
@ -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 {
|
||||
</button>
|
||||
</div>}
|
||||
<div className="error">{this.state.error}</div>
|
||||
{!this.isNew && this.renderInstances()}
|
||||
<Log showName={false} lines={this.props.log}/>
|
||||
{this.renderInstances()}
|
||||
{this.renderLog()}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
export default Plugin
|
||||
export default withRouter(Plugin)
|
||||
|
Loading…
Reference in New Issue
Block a user