PHP Classes

File: resources/js/components/Show/Logs.vue

Recommend this page to a friend!
  Classes of Nyi Nyi Lwin  >  Laravel Nova Log Viewer  >  resources/js/components/Show/Logs.vue  >  Download  
File: resources/js/components/Show/Logs.vue
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Laravel Nova Log Viewer
Display information about logs in Laravel Nova
Author: By
Last change:
Date: 3 years ago
Size: 9,684 bytes


Class file image Download
        <heading class="mb-6">Log [ {{ $ }} ]</heading>

        <div class="flex mb-4">
            <div class="w-1/6">
                <card class="flex mr-1 rounded-none">
                    <div class="w-full p-4">
                               <div class="font-bold text-xl mb-2">Levels</div>

                        <ul class="list-reset">
                            <li class="leading-wide text-sm" v-for="(menu, key) in menus" :key="key">
                                    :disabled="menu.count === 0"
                                    :style="{ 'background-color' : key !== 'date' ? getColor(menu.count === 0 ? 'empty' : key) : '#1976D2' }"
                                    class="w-full font-bold py-2 px-4 inline-flex items-center"
                                    @click="$router.push({name: 'nova-log-viewer-show', params: {
                                        date: $,
                                        level: key
                                    <span class="text-white">{{ }}</span>
                                    <span class="flex rounded-full text-white uppercase px-2 py-1 text-xs font-bold mr-3">{{ menu.count }}</span>
            <div class="w-5/6">
                <card class="flex rounded-none" v-if="info != null">
                    <div class="w-full p-4">
                            <div class="float-left">
                                <div class="font-bold text-xl mb-2">Log info</div>

                            <div class="float-right">
                                <div class="inline-flex">
                                    <a :href="downloadUrl +" target="_blank" class="bg-success font-bold py-2 px-4 rounded-l inline-flex items-center">
                                        <icon class="fill-current w-4 h-4 text-white" type="download" view-box="0 0 24 24" />
                                    <button @click="openDeleteModal(log)" class="bg-danger font-bold py-2 px-4 rounded-r inline-flex items-center">
                                        <icon class="fill-current w-4 h-4 text-white" type="delete" viewBox="0 0 20 20" />
                        <table class="w-full">
                            <tbody class="align-baseline">
                                <td style="width: 23%;" class="text-sm pl-0 p-2">File Path :</td>
                                <td>{{ info.path }}</td>
                                <td style="width: 23%;" class="text-sm pl-0 p-2">Log Entries :</td>
                                <td>{{ info.entries }}</td>
                                <td style="width: 23%;" class="text-sm pl-0 p-2">Size :</td>
                                <td>{{ info.size }}</td>
                                <td style="width: 23%;" class="text-sm pl-0 p-2">Created At :</td>
                                <td>{{ info.created_at }}</td>
                                <td style="width: 23%;" class="text-sm pl-0 p-2">Updated At :</td>
                                <td>{{ info.updated_at }}</td>

                <card class="flex rounded-none mt-1 p-2">
                    <table class="table w-full border-0">
                            <th> Actions</th>
                            v-for="(entry, key) in entries"

                <card class="flex rounded-none justify-end" v-if="prev != null || next != null">
                    <div class="inline-flex">
                        <button @click="getLog(prev)" v-if="prev != null" class="bg-grey-light hover:bg-grey text-grey-darkest font-bold py-2 px-4 rounded-l">
                        <button @click="getLog(next)" v-if="next != null" class="bg-grey-light hover:bg-grey text-grey-darkest font-bold py-2 px-4 rounded-r">

        <portal to="modals">
            <transition name="fade">
                    <div class="p-8">
                        <heading :level="2" class="mb-6">
                            Delete Log File
                        <p class="text-80 leading-normal">
                            Are you sure you want to delete this log file {{ }}?

                <modal v-if="stackModalOpen">
                    <div class="bg-white">
                        <button type="button" @click="closeStackModal" class="btn text-danger float-right p-2">
                        <div style="width: 950px;height:600px;overflow: overlay;">
                            <div class="p-4 stack-content">
                                {{ stack }}

import Log from './Log';
import color from '../../utils/color';

export default {
    name: 'Show',
    components: {
    data() {
        return {
            info: null,
            log: null,
            levels: null,
            level: null,
            entries: null,
            menus: null,
            deleteModalOpen: false,
            deleting: null,
            next: null,
            prev: null,

            stackModalOpen: false,
            stack: null,
    watch: {
        '$route.params.level': function(level) {
    computed: {
        downloadUrl() {
            return '/nova-vendor/php-junior/nova-log-viewer/download/';
    mounted() {
    methods: {
        getColor(level) {
            return color(level);
        getLog(url) {
            url =
                url ||
            axios.get(url).then(({ data }) => {
                this.log = data.log;
                this.levels = data.levels;
                this.level = data.level;
                this.entries =;
                this.menus = data.menus;
                this.prev = data.entries.prev_page_url;
       = data.entries.next_page_url;
        openDeleteModal(log) {
            this.deleteModalOpen = true;
            this.deleting = log;

        closeDeleteModal() {
            this.deleteModalOpen = false;
            this.deleting = null;

        openStackModal(entry) {
            this.stackModalOpen = true;
            this.stack = entry.stack;

        closeStackModal() {
            this.stackModalOpen = false;
            this.stack = null;

        confirmDelete() {
                method: 'delete',
                url: '/nova-vendor/php-junior/nova-log-viewer/delete',
                data: {
            }).then(res => {
                this.deleteModalOpen = false;
                this.$router.push({ name: 'nova-log-viewer-list' });

<style scoped>
.stack-content {
    color: #ae0e0e;
    font-family: consolas, Menlo, Courier, monospace;
    font-size: 12px;
    font-weight: 400;
    white-space: pre-line;
    width: 100%;
For more information send a message to info at phpclasses dot org.