mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-21 21:33:08 +01:00
Added UI for testing healthchecks
Also added close button on settings modals and test more info modals
This commit is contained in:
@@ -135,19 +135,4 @@ class SettingsController extends Controller
|
||||
{
|
||||
return SettingsHelper::getConfig();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger a test of all notification agents
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function testNotification()
|
||||
{
|
||||
SettingsHelper::testNotification();
|
||||
|
||||
return response()->json([
|
||||
'method' => 'test notificaiton agents'
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
|
||||
2
public/js/app.js
vendored
2
public/js/app.js
vendored
File diff suppressed because one or more lines are too long
2
resources/js/components/Graphics/TableRow.js
vendored
2
resources/js/components/Graphics/TableRow.js
vendored
@@ -62,7 +62,7 @@ export default class TableRow extends Component {
|
||||
<td>
|
||||
<span onClick={this.toggleShow} className="ti-arrow-top-right mouse"></span>
|
||||
<Modal show={show} onHide={this.toggleShow}>
|
||||
<Modal.Header>
|
||||
<Modal.Header closeButton>
|
||||
<Modal.Title>More info</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body className="text-center">
|
||||
|
||||
@@ -101,7 +101,7 @@ export default class SettingWithModal extends Component {
|
||||
<>
|
||||
<SettingsModalCard title={title} description={description} toggleShow={this.toggleShow} />
|
||||
<Modal show={show} onHide={this.toggleShow}>
|
||||
<Modal.Header>
|
||||
<Modal.Header closeButton>
|
||||
<Modal.Title>{title}</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body>
|
||||
@@ -248,6 +248,35 @@ export default class SettingWithModal extends Component {
|
||||
}
|
||||
</Row>
|
||||
)
|
||||
} else if(e.type == 'group') {
|
||||
return (
|
||||
<div key={e.obj.id}>
|
||||
<Row>
|
||||
<Col md={md} sm={sm}>
|
||||
<p>{name}</p>
|
||||
</Col>
|
||||
{e.description == null &&
|
||||
<Col md={md} sm={sm}>
|
||||
<p>{e.obj.description}</p>
|
||||
</Col>
|
||||
}
|
||||
</Row>
|
||||
<Row>
|
||||
<Col sm={{ span: 12 }}>
|
||||
{e.children.map((ee,ii) => {
|
||||
if(ee.type == 'button-get') {
|
||||
return (
|
||||
<Button key={ii} variant={ee.btnType} className={'mr-2 mb-3'} onClick={() => { Axios.get(ee.url)
|
||||
.then((resp) => { toast.success('Healthcheck sent') })
|
||||
.catch((resp) => { resp = resp.response; toast.error(resp.data.error) })
|
||||
}} >{ee.text}</Button>
|
||||
)
|
||||
}
|
||||
})}
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
})}
|
||||
<Button variant="primary" type="submit" onClick={this.update} >Save</Button>
|
||||
|
||||
35
resources/js/components/Settings/Settings.js
vendored
35
resources/js/components/Settings/Settings.js
vendored
@@ -159,7 +159,7 @@ export default class Settings extends Component {
|
||||
]} />
|
||||
</Col>
|
||||
<Col lg={{ span: 4 }} md={{ span: 6 }} sm={{ span: 12 }}>
|
||||
<SettingWithModal title="healthchecks.io settings" description="Control settings for healthchecks.io" autoClose={true} settings={[
|
||||
<SettingWithModal title="healthchecks.io settings" description="Control settings for healthchecks.io" autoClose={false} settings={[
|
||||
{
|
||||
obj: e.healthchecks_uuid,
|
||||
type: 'text'
|
||||
@@ -167,7 +167,38 @@ export default class Settings extends Component {
|
||||
{
|
||||
obj: e.healthchecks_enabled,
|
||||
type: 'checkbox'
|
||||
}
|
||||
},
|
||||
{
|
||||
obj: {
|
||||
id: (Math.floor(Math.random() * 10000) + 1),
|
||||
name: "Test healthchecks (after saving)",
|
||||
description: ""
|
||||
},
|
||||
type: 'group',
|
||||
children: [
|
||||
{
|
||||
type: 'button-get',
|
||||
url: 'api/settings/test-healthchecks/start',
|
||||
btnType: 'outline-success',
|
||||
text: 'Start',
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
type: 'button-get',
|
||||
url: 'api/settings/test-healthchecks/success',
|
||||
btnType: 'success',
|
||||
text: 'Success',
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
type: 'button-get',
|
||||
url: 'api/settings/test-healthchecks/fail',
|
||||
btnType: 'danger',
|
||||
text: 'Fail',
|
||||
inline: true,
|
||||
},
|
||||
]
|
||||
},
|
||||
]} />
|
||||
</Col>
|
||||
<Col lg={{ span: 4 }} md={{ span: 6 }} sm={{ span: 12 }}>
|
||||
|
||||
Reference in New Issue
Block a user