add button to generate token to node configuration tab
add info message after node creation about token generation
This commit is contained in:
parent
52a395ac9a
commit
a1568e5acb
2 changed files with 28 additions and 0 deletions
|
@ -83,6 +83,7 @@ class NodesController extends Controller
|
|||
'_token',
|
||||
]));
|
||||
Alert::success('Successfully created new node. <strong>Before you can add any servers you need to first assign some IP addresses and ports.</strong>')->flash();
|
||||
Alert::info('<strong>To simplify the node setup you can generate a token on the configuration tab.</strong>')->flash();
|
||||
|
||||
return redirect()->route('admin.nodes.view', [
|
||||
'id' => $new,
|
||||
|
|
|
@ -286,6 +286,12 @@
|
|||
<div class="alert alert-info">
|
||||
Below is the configuration file for your daemon on this node. We recommend <strong>not</strong> simply copy and pasting the code below unless you know what you are doing. You should run the <code>auto-installer</code> or <code>auto-updater</code> to setup the daemon.
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<p>You can generate a token for automatic setups. Pressing the button below will generate a token. It can only be used once and is valid for 5 minutes. It will also provide the necessary commands to auto-configure the node.</p>
|
||||
<p class="text-center">
|
||||
<button type="button" id="configTokenBtn" class="btn btn-primary">Generate token</button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<pre><code>{{ $node->getConfigurationAsJson(true) }}</code></pre>
|
||||
</div>
|
||||
|
@ -495,6 +501,27 @@ $(document).ready(function () {
|
|||
});
|
||||
});
|
||||
|
||||
$('#configTokenBtn').on('click', function (event) {
|
||||
$.getJSON('{{ route('admin.nodes.configurationtoken', $node->id) }}')
|
||||
.done(function (data) {
|
||||
swal({
|
||||
type: 'success',
|
||||
title: 'Token created.',
|
||||
text: 'Here is your token: <code>'+data.token+'</code><br />' +
|
||||
'It will expire at <i>' + data.expires_at + '</i><br /><br />' +
|
||||
'<p>To auto-configure your node run<br /><small><code>npm run configure -- --panel-url {{ config('app.url') }} --token '+data.token+'</code></small></p>',
|
||||
html: true
|
||||
})
|
||||
})
|
||||
.fail(function () {
|
||||
swal({
|
||||
title: 'Error',
|
||||
text: 'Something went wrong creating your token.',
|
||||
type: 'error'
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
$('.cloneElement').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var rnd = randomKey(10);
|
||||
|
|
Loading…
Reference in a new issue