mirror of
https://github.com/flarum/core.git
synced 2025-02-24 11:13:40 +01:00
Remove the "debug" button from request error alerts
Using the browser's console to debug failed requests is much more powerful
This commit is contained in:
parent
5ce702a5d0
commit
64686ef7a9
@ -1,9 +1,7 @@
|
|||||||
import ItemList from './utils/ItemList';
|
import ItemList from './utils/ItemList';
|
||||||
import Alert from './components/Alert';
|
import Alert from './components/Alert';
|
||||||
import Button from './components/Button';
|
|
||||||
import ModalManager from './components/ModalManager';
|
import ModalManager from './components/ModalManager';
|
||||||
import AlertManager from './components/AlertManager';
|
import AlertManager from './components/AlertManager';
|
||||||
import RequestErrorModal from './components/RequestErrorModal';
|
|
||||||
import Translator from './Translator';
|
import Translator from './Translator';
|
||||||
import Store from './Store';
|
import Store from './Store';
|
||||||
import Session from './Session';
|
import Session from './Session';
|
||||||
@ -333,10 +331,7 @@ export default class Application {
|
|||||||
|
|
||||||
error.alert = new Alert({
|
error.alert = new Alert({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
children,
|
children
|
||||||
controls: app.forum.attribute('debug') ? [
|
|
||||||
<Button className="Button Button--link" onclick={this.showDebug.bind(this, error)}>Debug</Button>
|
|
||||||
] : undefined
|
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -351,16 +346,6 @@ export default class Application {
|
|||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {RequestError} error
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
showDebug(error) {
|
|
||||||
this.alerts.dismiss(this.requestErrorAlert);
|
|
||||||
|
|
||||||
this.modal.show(new RequestErrorModal({error}));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a URL to the route with the given name.
|
* Construct a URL to the route with the given name.
|
||||||
*
|
*
|
||||||
|
@ -37,7 +37,6 @@ import Placeholder from './components/Placeholder';
|
|||||||
import Separator from './components/Separator';
|
import Separator from './components/Separator';
|
||||||
import Dropdown from './components/Dropdown';
|
import Dropdown from './components/Dropdown';
|
||||||
import SplitDropdown from './components/SplitDropdown';
|
import SplitDropdown from './components/SplitDropdown';
|
||||||
import RequestErrorModal from './components/RequestErrorModal';
|
|
||||||
import FieldSet from './components/FieldSet';
|
import FieldSet from './components/FieldSet';
|
||||||
import Select from './components/Select';
|
import Select from './components/Select';
|
||||||
import Navigation from './components/Navigation';
|
import Navigation from './components/Navigation';
|
||||||
@ -101,7 +100,6 @@ export default {
|
|||||||
'components/Separator': Separator,
|
'components/Separator': Separator,
|
||||||
'components/Dropdown': Dropdown,
|
'components/Dropdown': Dropdown,
|
||||||
'components/SplitDropdown': SplitDropdown,
|
'components/SplitDropdown': SplitDropdown,
|
||||||
'components/RequestErrorModal': RequestErrorModal,
|
|
||||||
'components/FieldSet': FieldSet,
|
'components/FieldSet': FieldSet,
|
||||||
'components/Select': Select,
|
'components/Select': Select,
|
||||||
'components/Navigation': Navigation,
|
'components/Navigation': Navigation,
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
import Modal from './Modal';
|
|
||||||
|
|
||||||
export default class RequestErrorModal extends Modal {
|
|
||||||
className() {
|
|
||||||
return 'RequestErrorModal Modal--large';
|
|
||||||
}
|
|
||||||
|
|
||||||
title() {
|
|
||||||
return this.props.error.xhr
|
|
||||||
? this.props.error.xhr.status+' '+this.props.error.xhr.statusText
|
|
||||||
: '';
|
|
||||||
}
|
|
||||||
|
|
||||||
content() {
|
|
||||||
let responseText;
|
|
||||||
|
|
||||||
try {
|
|
||||||
responseText = JSON.stringify(JSON.parse(this.props.error.responseText), null, 2);
|
|
||||||
} catch (e) {
|
|
||||||
responseText = this.props.error.responseText;
|
|
||||||
}
|
|
||||||
|
|
||||||
return <div className="Modal-body">
|
|
||||||
<pre>
|
|
||||||
{this.props.error.options.method} {this.props.error.options.url}<br/><br/>
|
|
||||||
{responseText}
|
|
||||||
</pre>
|
|
||||||
</div>;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user