Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

7.3 KB
Raw Blame
// ============================================
// LOGS & COMMAND OUTPUT COMPONENTS
// ============================================

// Log viewer
.log-viewer {
    @include code-block();
    max-height: 500px;
    overflow-y: auto;
    line-height: $line-height-normal;
}

// Log controls
.log-controls {
    @include flex-start();
    gap: $space-3;

    select {
        padding: $space-2 $space-3;
        background: $bg-body;
        border: 1px solid $border-subtle;
        border-radius: $radius-control;
        color: $text-primary;
        font-size: $text-sm;
    }
}

// Split log viewer used by the reusable LogViewer component.
.logs-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    height: 100%;
    min-height: 320px;
    overflow: hidden;
    background: $bg-card;
    border: 1px solid $border-subtle;
    border-radius: $radius-card;
}

.logs-sidebar {
    min-width: 0;
    border-right: 1px solid $border-subtle;
    background: rgba($bg-body-raw, 0.35);
    display: flex;
    flex-direction: column;

    .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: $space-3;
        padding: $space-3;
        border-bottom: 1px solid $border-subtle;

        h3 {
            margin: 0;
            color: $text-primary;
            font-size: $text-xs;
            font-weight: $font-weight-semibold;
        }
    }
}

.log-files-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: $space-2;
    @include custom-scrollbar();
}

.log-file-item {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: center;
    gap: $space-2;
    padding: $space-2;
    border: 1px solid transparent;
    border-radius: $radius-card;
    color: $text-secondary;
    cursor: pointer;
    transition: background $transition-fast, border-color $transition-fast, color $transition-fast;

    &:hover {
        background: $bg-hover;
        color: $text-primary;
    }

    &.active {
        background: $accent-glow;
        border-color: rgba($accent-primary-raw, 0.35);
        color: $text-primary;
    }
}

.log-icon {
    width: 32px;
    height: 32px; // geometry: icon tile
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: $radius-control;
    background: $bg-elevated;
    color: $text-tertiary;

    &.error { color: $danger; background: $danger-bg; }
    &.access { color: $info; background: $info-bg; }
}

.log-file-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: $space-hair;
}

.log-file-name {
    color: inherit;
    font-size: $text-xs;
    font-weight: $font-weight-semibold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-file-path,
.log-file-size {
    color: $text-tertiary;
    font-family: $font-mono;
    font-size: $text-xs;
}

.logs-viewer {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-code);
    border: 1px solid var(--border-soft);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    font-family: var(--mono);
    font-size: $text-xs;
    line-height: 1.7;
    scroll-behavior: smooth;

    &__loading, &__empty {
        font-size: $text-xs;
        padding: $space-8;
        text-align: center;
        color: var(--text-faint);
    }

    &__line {
        display: flex;
        padding: 0 $space-4;
        transition: background 0.1s;

        &:hover {
            background: var(--surface-hover);
        }

        &--error {
            background: rgba(251, 111, 111, 0.06);
            .logs-viewer__line-text { color: var(--red); }
        }

        &--warn {
            background: rgba(245, 185, 69, 0.06);
            .logs-viewer__line-text { color: var(--amber); }
        }

        &--debug {
            .logs-viewer__line-text { color: var(--text-faint); }
        }

        &--structured {
            align-items: flex-start;
            padding-block: $space-2;
            border-bottom: 1px solid var(--border-soft);
        }
    }

    &__line-num {
        width: 48px;
        padding-right: $space-3;
        color: var(--text-ghost);
        text-align: right;
        flex-shrink: 0;
        user-select: none;
    }

    &__line-text {
        flex: 1;
        min-width: 0;
        color: var(--text-code);
        white-space: pre-wrap;
        word-break: break-all;
    }

    &__timestamp {
        display: block;
        margin-bottom: $space-1;
        color: var(--text-faint);
        font-size: $text-xs;
    }

    &__json {
        margin: 0;
        color: inherit;
        font: inherit;
        line-height: 1.55;
        white-space: pre-wrap;
        overflow-wrap: anywhere;
        word-break: normal;
    }

    &__highlight {
        background: rgba(245, 185, 69, 0.35);
        color: var(--text);
        border-radius: $radius-badge;
        padding: 0 1px;
    }
}

.viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: $space-3;
    padding: $space-3;
    border-bottom: 1px solid $border-subtle;
    flex-wrap: wrap;

    .toolbar-left,
    .toolbar-right {
        display: flex;
        align-items: center;
        gap: $space-2;
        flex-wrap: wrap;
    }

    .search-input {
        position: relative;
        min-width: 220px;

        svg {
            position: absolute;
            left: $space-3;
            top: 50%;
            transform: translateY(-50%);
            color: $text-tertiary;
            pointer-events: none;
        }

        input {
            padding-left: $space-8;
        }
    }

    // Shared Select trigger, kept at the search box's height and sized to
    // content so it sits in the toolbar instead of claiming a form-field row.
    .lines-select {
        width: auto;
        height: $control-md;
        min-width: 120px;
        font-size: $text-xs;
    }
}

.auto-refresh-toggle {
    display: inline-flex;
    align-items: center;
    gap: $space-2;
    color: $text-secondary;
    font-size: $text-xs;
    white-space: nowrap;
}

.log-content {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background: var(--bg-code);
    padding: $space-4;
    @include custom-scrollbar();

    pre {
        margin: 0;
        color: var(--text-code);
        font-family: $font-mono;
        font-size: $text-xs;
        line-height: 1.7;
        white-space: pre-wrap;
        word-break: break-word;
    }
}

.empty-hint {
    color: $text-tertiary;
    font-size: $text-xs;
    padding: $space-4;
}

@media (max-width: $breakpoint-md) {
    .logs-layout {
        grid-template-columns: 1fr;
    }

    .logs-sidebar {
        max-height: 180px;
        border-right: 0;
        border-bottom: 1px solid $border-subtle;
    }
}

// Command output
.command-output {
    background: $bg-body;
    border: 1px solid $border-subtle;
    border-radius: $radius-card;
    padding: $space-4;
    margin-top: $space-5;

    pre {
        @include mono-text();
        white-space: pre-wrap;
        word-break: break-all;
        color: $text-primary;
    }

    &.error {
        border-color: $danger;
    }

    .stderr {
        color: $danger;
    }
}

// Quick commands
.quick-commands {
    display: flex;
    flex-wrap: wrap;
    gap: $space-2;
    margin-bottom: $space-5;
}