1
0
mirror of https://github.com/cp6/my-idlers.git synced 2024-11-16 15:33:44 +01:00

Updated server create blade view

Updated server create blade view for NPM webpack usage
This commit is contained in:
cp6 2022-11-13 15:54:43 +11:00
parent 26356b3cd7
commit 908b8df495

View File

@ -1,8 +1,4 @@
@section("title", "Add a server") @section("title", "Add a server")
@section('scripts')
<script src="{{ asset('js/vue.min.js') }}"></script>
<script src="{{ asset('js/axios.min.js') }}"></script>
@endsection
<x-app-layout> <x-app-layout>
<x-slot name="header"> <x-slot name="header">
{{ __('Insert a new server') }} {{ __('Insert a new server') }}
@ -224,7 +220,8 @@
</x-labels-select> </x-labels-select>
</div> </div>
</div> </div>
<x-form-check text="Allow this data to be public, restrict values in settings" name="show_public"></x-form-check> <x-form-check text="Allow this data to be public, restrict values in settings"
name="show_public"></x-form-check>
<div class="row"> <div class="row">
<div class="col-12 col-lg-4"> <div class="col-12 col-lg-4">
<x-submit-button>Insert server</x-submit-button> <x-submit-button>Insert server</x-submit-button>
@ -233,35 +230,39 @@
</form> </form>
</x-card> </x-card>
</div> </div>
@section('scripts')
<script>
window.addEventListener('load', function () {
<script> axios.defaults.headers.common = {
axios.defaults.headers.common = { 'Content-Type': 'application/json',
'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest',
'X-Requested-With': 'XMLHttpRequest', 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'), 'Accept': 'application/json',
'Accept': 'application/json', };
};
let app = new Vue({ let app = new Vue({
el: "#app", el: "#app",
data: { data: {
"ipv4_in": '', "ipv4_in": '',
"ipv6_in": '' "ipv6_in": ''
}, },
methods: { methods: {
fetchDnsRecords(event) { fetchDnsRecords(event) {
var hostname = document.getElementById('hostname').value; var hostname = document.getElementById('hostname').value;
if (hostname) { if (hostname) {
axios axios
.get('/api/dns/' + hostname + '/A', {headers: {'Authorization': 'Bearer ' + document.querySelector('meta[name="api_token"]').getAttribute('content')}}) .get('/api/dns/' + hostname + '/A', {headers: {'Authorization': 'Bearer ' + document.querySelector('meta[name="api_token"]').getAttribute('content')}})
.then(response => (this.ipv4_in = response.data.ip)); .then(response => (this.ipv4_in = response.data.ip));
axios axios
.get('/api/dns/' + hostname + '/AAAA', {headers: {'Authorization': 'Bearer ' + document.querySelector('meta[name="api_token"]').getAttribute('content')}}) .get('/api/dns/' + hostname + '/AAAA', {headers: {'Authorization': 'Bearer ' + document.querySelector('meta[name="api_token"]').getAttribute('content')}})
.then(response => (this.ipv6_in = response.data.ip)); .then(response => (this.ipv6_in = response.data.ip));
}
}
} }
} });
} })
}); </script>
</script> @endsection
</x-app-layout> </x-app-layout>