Path: blob/1.0-develop/resources/views/admin/api/index.blade.php
14044 views
@extends('layouts.admin')12@section('title')3Application API4@endsection56@section('content-header')7<h1>Application API<small>Control access credentials for managing this Panel via the API.</small></h1>8<ol class="breadcrumb">9<li><a href="{{ route('admin.index') }}">Admin</a></li>10<li class="active">Application API</li>11</ol>12@endsection1314@section('content')15<div class="row">16<div class="col-xs-12">17<div class="box box-primary">18<div class="box-header with-border">19<h3 class="box-title">Credentials List</h3>20<div class="box-tools">21<a href="{{ route('admin.api.new') }}" class="btn btn-sm btn-primary">Create New</a>22</div>23</div>24<div class="box-body table-responsive no-padding">25<table class="table table-hover">26<tr>27<th>Key</th>28<th>Memo</th>29<th>Last Used</th>30<th>Created</th>31<th>Created by</th>32<th></th>33</tr>34@foreach($keys as $key)35<tr>36<td><code>37@if (Auth::user()->is($key->user))38{{ $key->identifier . decrypt($key->token) }}39@else40{{ $key->identifier . '****' }}41@endif42</code></td>43<td>{{ $key->memo }}</td>44<td>45@if(!is_null($key->last_used_at))46@datetimeHuman($key->last_used_at)47@else48—49@endif50</td>51<td>@datetimeHuman($key->created_at)</td>52<td>53<a href="{{ route('admin.users.view', $key->user->id) }}">{{ $key->user->username }}</a>54</td>55<td>56<a href="#" data-action="revoke-key" data-attr="{{ $key->identifier }}">57<i class="fa fa-trash-o text-danger"></i>58</a>59</td>60</tr>61@endforeach62</table>63</div>64</div>65</div>66</div>67@endsection6869@section('footer-scripts')70@parent71<script>72$(document).ready(function() {73$('[data-action="revoke-key"]').click(function (event) {74var self = $(this);75event.preventDefault();76swal({77type: 'error',78title: 'Revoke API Key',79text: 'Once this API key is revoked any applications currently using it will stop working.',80showCancelButton: true,81allowOutsideClick: true,82closeOnConfirm: false,83confirmButtonText: 'Revoke',84confirmButtonColor: '#d9534f',85showLoaderOnConfirm: true86}, function () {87$.ajax({88method: 'DELETE',89url: '/admin/api/revoke/' + self.data('attr'),90headers: {91'X-CSRF-TOKEN': '{{ csrf_token() }}'92}93}).done(function () {94swal({95type: 'success',96title: '',97text: 'API Key has been revoked.'98});99self.parent().parent().slideUp();100}).fail(function (jqXHR) {101console.error(jqXHR);102swal({103type: 'error',104title: 'Whoops!',105text: 'An error occurred while attempting to revoke this key.'106});107});108});109});110});111</script>112@endsection113114115