{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}} {{-- Permission is hereby granted, free of charge, to any person obtaining a copy --}} {{-- of this software and associated documentation files (the "Software"), to deal --}} {{-- in the Software without restriction, including without limitation the rights --}} {{-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --}} {{-- copies of the Software, and to permit persons to whom the Software is --}} {{-- furnished to do so, subject to the following conditions: --}} {{-- The above copyright notice and this permission notice shall be included in all --}} {{-- copies or substantial portions of the Software. --}} {{-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --}} {{-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --}} {{-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --}} {{-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --}} {{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}} {{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}} {{-- SOFTWARE. --}} @extends('layouts.admin') @section('title') {{ $node->name }}: Configuration @endsection @section('content-header') <h1>{{ $node->name }}<small>Your daemon configuration file.</small></h1> <ol class="breadcrumb"> <li><a href="{{ route('admin.index') }}">Admin</a></li> <li><a href="{{ route('admin.nodes') }}">Nodes</a></li> <li><a href="{{ route('admin.nodes.view', $node->id) }}">{{ $node->name }}</a></li> <li class="active">Configuration</li> </ol> @endsection @section('content') <div class="row"> <div class="col-xs-12"> <div class="nav-tabs-custom nav-tabs-floating"> <ul class="nav nav-tabs"> <li><a href="{{ route('admin.nodes.view', $node->id) }}">About</a></li> <li><a href="{{ route('admin.nodes.view.settings', $node->id) }}">Settings</a></li> <li class="active"><a href="{{ route('admin.nodes.view.configuration', $node->id) }}">Configuration</a></li> <li><a href="{{ route('admin.nodes.view.allocation', $node->id) }}">Allocation</a></li> <li><a href="{{ route('admin.nodes.view.servers', $node->id) }}">Servers</a></li> </ul> </div> </div> </div> <div class="row"> <div class="col-sm-8"> <div class="box box-primary"> <div class="box-header with-border"> <h3 class="box-title">Configuration File</h3> </div> <div class="box-body"> <pre class="no-margin">{{ $node->getConfigurationAsJson(true) }}</pre> </div> <div class="box-footer"> <p class="no-margin">This file should be placed in your daemon's <code>config</code> directory in a file called <code>core.json</code>.</p> </div> </div> </div> <div class="col-sm-4"> <div class="box box-success"> <div class="box-header with-border"> <h3 class="box-title">Auto-Deploy</h3> </div> <div class="box-body"> <p class="text-muted small">To simplify the configuration of nodes it is possible to fetch the config from the panel. A token is required for this process. The button below will generate a token and provide you with the commands necessary for automatic configuration of the node. <em>Tokens are only valid for 5 minutes.</em></p> </div> <div class="box-footer"> <button type="button" id="configTokenBtn" class="btn btn-sm btn-default" style="width:100%;">Generate Token</button> </div> </div> </div> </div> @endsection @section('footer-scripts') @parent <script> $('#configTokenBtn').on('click', function (event) { $.getJSON('{{ route('admin.nodes.view.configuration.token', $node->id) }}').done(function (data) { swal({ type: 'success', title: 'Token created.', text: 'Your token will expire <strong>in 5 minutes.</strong><br /><br />' + '<p>To auto-configure your node run the following command:<br /><small><pre>npm run configure -- --panel-url {{ config('app.url') }} --token ' + data.token + '</pre></small></p>', html: true }) }).fail(function () { swal({ title: 'Error', text: 'Something went wrong creating your token.', type: 'error' }); }); }); </script> @endsection