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.

24.9 KB
Raw Blame
// ============================================
// BACKUPS PAGE
// ============================================
// Reconstructed after a data-loss corruption. Rebuilt from the class usage in
// pages/Backups.jsx and components/backups/*, using design-system tokens only.
// Layout-faithful to the surviving JSX; visual details are a best-effort
// restore rather than a byte-for-byte recovery of the original 22KB sheet.

.backups-page {
    display: flex;
    flex-direction: column;
    gap: $space-5;
}

// ---------- KPI strip / generic cards ----------
// ---------- Overview (ported from the design mock) ----------
// KPI band, activity heatmap, recent feed, destinations, latest snapshots.
// The summary band lives here only — it used to repeat above Schedules,
// Storage and Settings, where none of its numbers answered the question you
// opened that tab to ask.
.bk-overview {
    display: grid;
    gap: $space-5;
}

.bk-grid2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: $space-5;
    align-items: start;

    @media (max-width: 1100px) { grid-template-columns: 1fr; }
}

.bk-panel {
    min-width: 0;
    padding: $space-5;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);

    // For panels whose body is a table that should meet the card edges.
    &--flush {
        padding: 0;
        overflow: hidden;

        .bk-panel__head { padding: $space-5 $space-5 0; margin-bottom: $space-3; }
    }

    &__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: $space-3;
        margin-bottom: $space-4;

        h3 {
            margin: 0;
            font-size: $text-base;
            font-weight: $font-weight-semibold;
            color: var(--text);
        }
    }

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

// "All snapshots ›" / "Manage ›" — a quiet inline jump to the full section.
.bk-link {
    display: inline-flex;
    align-items: center;
    gap: $space-1;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-faint);
    font-size: $text-xs;
    cursor: pointer;
    white-space: nowrap;

    &:hover { color: var(--accent-bright); }
}

.bk-hint {
    display: flex;
    align-items: center;
    gap: $space-2;
    margin: 0;
    font-size: $text-sm;
    color: var(--text-faint);

    svg { flex-shrink: 0; }

    // Amber, not red: keeping backups only on the same disk is a risk to fix,
    // not a failure that has already happened.
    &--warn {
        margin-top: $space-4;
        padding-top: $space-3;
        border-top: 1px solid var(--border-soft);
        color: var(--amber);
        align-items: flex-start;
        line-height: 1.45;
    }
}

// Contribution-style activity grid: one column per week, one row per weekday.
// Columns are `1fr`, not a fixed pixel size — a fixed grid sat at its natural
// width inside a fluid card and left the right half of the panel empty. The
// cells keep their square shape via aspect-ratio, so the whole strip simply
// scales with however much room the card has.
.bk-heat {
    display: grid;
    width: 100%;
    grid-template-rows: repeat(7, auto);
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: $space-1;

    i {
        aspect-ratio: 1;
        min-width: 0;
        border-radius: $radius-badge;
        background: var(--surface-3);

        &.l1 { background: rgba(61, 220, 151, 0.32); }
        &.l2 { background: rgba(61, 220, 151, 0.62); }
        &.l3 { background: var(--green); }
        &.fail { background: var(--red); }
    }

    &__scroll {
        min-width: 0;
        padding-bottom: $space-1;
    }

    &__legend {
        display: inline-flex;
        align-items: center;
        gap: $space-1;
        font-size: $text-xs;
        color: var(--text-faint);
        white-space: nowrap;

        i {
            width: 10px;
            height: 10px;
            border-radius: $radius-badge;

            &.l1 { background: rgba(61, 220, 151, 0.32); }
            &.l2 { background: rgba(61, 220, 151, 0.62); }
            &.l3 { background: var(--green); }
        }
    }

    // Footer stat row under the grid.
    &__stats {
        display: flex;
        flex-wrap: wrap;
        gap: $space-6;
        margin-top: $space-4;
        padding-top: $space-4;
        border-top: 1px solid var(--border-soft);

        span {
            display: block;
            font-size: $text-xs;
            color: var(--text-faint);
        }

        strong {
            display: block;
            margin-top: $space-1;
            font-size: $text-lg;
            font-weight: $font-weight-semibold;
            color: var(--text);
        }
    }
}

// Recent-activity feed.
.bk-feed {
    display: flex;
    flex-direction: column;

    &__item {
        display: flex;
        align-items: flex-start;
        gap: $space-3;
        padding: $space-3 0;
        border-top: 1px solid var(--border-soft);

        &:first-child { border-top: 0; padding-top: 0; }
        &:last-child { padding-bottom: 0; }
    }

    &__dot {
        width: 28px;
        height: 28px; // geometry: icon tile
        border-radius: $radius-card;
        display: grid;
        place-items: center;
        flex-shrink: 0;
        background: var(--surface-3);
        color: var(--text-dim);

        &.is-complete { @include status-variant(var(--green), var(--green-bg)); }
        &.is-running { @include status-variant(var(--cyan), var(--cyan-bg)); }
        &.is-failed { @include status-variant(var(--red), var(--red-bg)); }
    }

    &__body { min-width: 0; flex: 1; }

    &__txt {
        font-size: $text-sm;
        color: var(--text-dim);
        line-height: 1.4;

        b { color: var(--text); font-weight: $font-weight-semibold; }
    }

    &__time {
        margin-top: $space-hair;
        font-size: $text-xs;
        color: var(--text-faint);
    }
}

// ---------- Schedules (mock `BkSchedules`) ----------
// A disabled policy stays readable but visibly inert, so a paused row never
// gets mistaken for a running one.
.bk-table--schedules {
    .is-off { opacity: 0.55; }

    .bk-col-on { white-space: nowrap; } // width: column definition
}

// Retention chips (the mock's GFS daily/weekly/monthly row).
.bk-ret {
    display: inline-flex;
    gap: $space-1;

    span {
        padding: $space-hair $space-2;
        border-radius: $radius-control;
        background: var(--surface-3);
        color: var(--text-dim);
        font-size: $text-xs;
    }
}

.bk-lastrun {
    display: inline-flex;
    align-items: center;
    gap: $space-tight;
    font-size: $text-xs;
    color: var(--text-faint);
    white-space: nowrap;

    // A failed last run gets a dot rather than a pill — it is a footnote on
    // the row, not the row's status.
    &.is-failed {
        color: var(--red);

        i {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--red);
        }
    }
}

.bk-paused { color: var(--text-ghost); }

.bk-hint--foot {
    margin-top: $space-3;
    font-size: $text-xs;
}

// ---------- Storage destinations (mock `BkStorage`) ----------
.bk-dests {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: $space-4;
    margin-bottom: $space-5;
}

.bk-destcard {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: $space-4 $space-5 $space-5;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);

    // The copy that survives losing the box earns the accent border.
    &.is-primary { border-color: var(--accent-dim); }

    &__head {
        display: flex;
        align-items: flex-start;
        gap: $space-3;
        margin-bottom: $space-4;

        .sk-pill { flex-shrink: 0; }
    }

    &__ico {
        width: 38px;
        height: 38px; // geometry: icon tile
        border-radius: $radius-card;
        display: grid;
        place-items: center;
        flex-shrink: 0;
        @include status-variant(var(--accent-bright), var(--accent-bg));
    }

    &__id { flex: 1; min-width: 0; }

    &__name {
        display: flex;
        align-items: center;
        gap: $space-2;
        font-size: $text-base;
        font-weight: $font-weight-semibold;
        color: var(--text);
        @include truncate();
    }

    &__type {
        margin-top: $space-hair;
        font-size: $text-xs;
        color: var(--text-faint);
    }

    &__usage {
        display: flex;
        justify-content: space-between;
        gap: $space-3;
        margin-top: $space-2;
        font-size: $text-xs;
        color: var(--text-faint);
    }

    &__rows {
        margin: $space-4 0 0;

        > div {
            display: flex;
            justify-content: space-between;
            gap: $space-3;
            padding: $space-2 0;
            border-top: 1px solid var(--border-soft);
        }

        dt {
            font-size: $text-xs;
            color: var(--text-faint);
        }

        dd {
            margin: 0;
            min-width: 0;
            font-size: $text-xs;
            color: var(--text-dim);
            @include truncate();
        }
    }

    &__actions {
        display: flex;
        gap: $space-2;
        margin-top: auto;
        padding-top: $space-4;
    }

    // Dashed "add" tile — the same footprint as a real card so the grid keeps
    // its rhythm whether one destination is configured or three.
    &--add {
        display: grid;
        place-items: center;
        gap: $space-2;
        min-height: 200px;
        border: 1.5px dashed var(--border-strong);
        background: transparent;
        color: var(--text-faint);
        cursor: pointer;
        text-align: center;

        &:hover { color: var(--accent-bright); border-color: var(--accent-dim); }

        span { font-size: $text-sm; font-weight: $font-weight-medium; }
    }
}

// Storage destinations — one bar per place the archive lives (mock `.dest-bar`).
.bk-dest {
    &__row + &__row { margin-top: $space-3; }

    &__tag {
        display: inline-flex;
        align-items: center;
        height: 20px; // geometry: badge height (20px badge spec)
        padding: 0 $space-tight;
        border-radius: $radius-badge;
        @include status-variant(var(--accent-bright), var(--accent-bg));
        font-size: $text-xs;
        font-weight: $font-weight-medium;
    }

    &__top {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: $space-3;
        margin-bottom: $space-2;
    }

    &__name {
        display: inline-flex;
        align-items: center;
        gap: $space-2;
        min-width: 0;
        font-size: $text-sm;
        font-weight: $font-weight-semibold;
        color: var(--text);

        svg { flex-shrink: 0; color: var(--text-faint); }

        small {
            font-size: $text-xs;
            font-weight: $font-weight-normal;
            color: var(--text-faint);
            @include truncate();
        }
    }

    &__size {
        flex-shrink: 0;
        font-size: $text-xs;
        color: var(--text-dim);

        em { font-style: normal; color: var(--text-faint); margin-left: 5px; }
    }

    &__bar {
        height: 6px;
        border-radius: $radius-badge;
        background: var(--surface-3);
        overflow: hidden;

        i {
            display: block;
            height: 100%;
            border-radius: $radius-badge;
            transition: width 0.3s;
        }

        &--local i { background: var(--accent-bright); }
        &--remote i { background: var(--cyan); }
    }
}

// Row actions stay on one line at the right edge. They used to wrap, which
// pushed a full-width destructive button onto its own row and made every table
// row a different height.
.bk-actions {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    gap: $space-hair;
    white-space: nowrap;

    // Icon-only affordances: quiet by default, and only the delete goes red —
    // and only on hover, so a table of rows isn't a wall of red slabs.
    .bk-iconbtn {
        display: grid;
        place-items: center;
        width: $control-sm;
        height: $control-sm;
        padding: 0;
        border: 0;
        border-radius: $radius-control;
        background: none;
        color: var(--text-faint);
        cursor: pointer;
        transition: background 0.14s, color 0.14s;

        &:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
        &:disabled { opacity: 0.45; cursor: default; }

        &--danger:hover:not(:disabled) { @include status-variant(var(--red), var(--red-bg)); }
    }
}

// ---------- Backups / schedules table ----------
// `.bk-table` is the DataTable wrap; only cell content is styled here, and the
// actions column's width lives on its column definition.
.bk-table {
    // Snapshot names are long and machine-generated, so they get the room and
    // an ellipsis; everything numeric stays on one line rather than folding a
    // "464 MB" onto two and doubling the row height.
    .bk-name span:last-child {
        min-width: 0;
        @include truncate();
    }

    .sk-cell-mono,
    .sk-cell-dim,
    .bk-when { white-space: nowrap; }
}

.bk-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: $text-secondary;
}

.bk-type {
    display: inline-flex;
    align-items: center;
    gap: $space-1;
    font-size: $text-xs;
    color: $text-secondary;
}

.bk-when {
    color: $text-tertiary;
    font-size: $text-xs;
    white-space: nowrap;
}

.bk-specs {
    display: flex;
    flex-wrap: wrap;
    gap: $space-2;
    color: $text-tertiary;
    font-size: $text-xs;
}

.bk-sched {
    font-family: $font-mono;
    font-size: $text-xs;
    color: $text-secondary;
}

.bk-remote-on { color: $success; }
.bk-remote-off { color: $text-tertiary; }

.bk-restore-warn {
    display: flex;
    align-items: flex-start;
    gap: $space-2;
    padding: $space-3;
    border-radius: $radius-control;
    background: $warning-bg;
    border: 1px solid $warning-border;
    color: $warning;
    font-size: $text-xs;
}

// ---------- Backup history list ----------
.backup-history-list {
    &__ico {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: $text-secondary;
    }

    &__storage {
        color: $text-tertiary;
        font-size: $text-xs;
    }

    &__when {
        color: $text-tertiary;
        font-size: $text-xs;
        white-space: nowrap;
    }

    &__actions {
        display: flex;
        gap: $space-1;
    }
}

.backup-history-card {
    background: $bg-card;
    border: 1px solid $border-subtle;
    border-radius: $radius-card;
    padding: $space-4;

    &__tools {
        display: flex;
        align-items: center;
        gap: $space-2;
    }

    &__chip {
        display: inline-flex;
        align-items: center;
        gap: $space-1;
        padding: 1px $space-2;
        border-radius: $radius-badge;
        background: $bg-hover;
        border: 1px solid $border-subtle;
        color: $text-secondary;
        font-size: $text-xs;
    }

    &__toggle {
        display: inline-flex;
        align-items: center;
        gap: $space-1;
        background: transparent;
        border: none;
        color: $accent-primary;
        cursor: pointer;
        font-size: $text-xs;
    }
}

// ---------- Backup calendar ----------
.backup-calendar {
    background: $bg-card;
    border: 1px solid $border-subtle;
    border-radius: $radius-card;
    padding: $space-4;

    &__head {
        display: flex;
        align-items: center;
        gap: $space-2;
        margin-bottom: $space-3;
    }

    &__nav {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: $control-sm;
        height: $control-sm;
        background: transparent;
        border: 1px solid $border-subtle;
        border-radius: $radius-control;
        color: $text-secondary;
        cursor: pointer;

        &:hover { border-color: $border-active; color: $text-primary; }
    }

    &__month {
        font-weight: $font-weight-semibold;
        color: $text-primary;
    }

    &__today {
        margin-left: auto;
        background: transparent;
        border: 1px solid $border-subtle;
        border-radius: $radius-badge;
        padding: $space-1 $space-2;
        color: $text-secondary;
        font-size: $text-xs;
        cursor: pointer;

        &:hover { border-color: $border-active; color: $text-primary; }
    }

    &__grid {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: $space-1;
    }

    &__dow {
        text-align: center;
        color: $text-tertiary;
        font-size: $text-xs;
        padding: $space-1 0;
    }

    &__cell {
        position: relative;
        min-height: 44px; // geometry: calendar day cell
        padding: $space-1;
        border: 1px solid $border-subtle;
        border-radius: $radius-badge;
        background: $bg-body;

        &--empty {
            background: transparent;
            border-color: transparent;
        }

        &--has {
            border-color: $border-active;
            cursor: pointer;

            &.is-success { border-color: $success-border; }
            &.is-failed,
            &.is-error { border-color: $danger-border; }
            &.is-running { border-color: $info-border; }
        }
    }

    &__today {
        // "Today" cell highlight (shared name with the header button, scoped by
        // being a grid cell modifier in markup).
    }

    &.is-today &__cell,
    &__cell.is-today {
        outline: 1px solid $accent-primary;
    }

    &__daynum {
        font-size: $text-xs;
        color: $text-secondary;
    }

    &__badge {
        position: absolute;
        bottom: 2px;
        right: 2px;
        min-width: 16px;
        height: 16px;
        padding: 0 $space-1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: $radius-full;
        background: $accent-primary;
        color: #fff;
        font-size: $text-xs;
        font-weight: $font-weight-semibold;
    }
}

// ---------- Backup detail drawer ----------
.backup-detail-drawer {
    display: flex;
    flex-direction: column;
    gap: $space-4;

    &__head {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: $space-3;
    }

    &__meta {
        display: flex;
        flex-direction: column;
        gap: $space-2;
    }

    &__row {
        display: flex;
        justify-content: space-between;
        gap: $space-3;
        font-size: $text-xs;
        color: $text-secondary;
        padding: $space-2 0;
        border-bottom: 1px solid $border-subtle;
    }

    &__cost {
        color: $text-secondary;
    }

    &__joblink {
        display: inline-flex;
        align-items: center;
        gap: $space-1;
        color: $accent-primary;
        cursor: pointer;
    }

    &__error {
        padding: $space-3;
        border-radius: $radius-control;
        background: $danger-bg;
        border: 1px solid $danger-border;
        color: $danger;
        font-size: $text-xs;
    }

    &__actions {
        display: flex;
        flex-wrap: wrap;
        gap: $space-2;
    }
}

// ---------- Backup drills (restore drills / probes) ----------
.backup-drills {
    display: flex;
    flex-direction: column;
    gap: $space-2;

    &__head {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: $space-3;
    }

    &__list {
        display: flex;
        flex-direction: column;
        gap: $space-2;
    }

    &__item {
        background: $bg-card;
        border: 1px solid $border-subtle;
        border-radius: $radius-control;
        overflow: hidden;
    }

    &__trigger {
        display: flex;
        align-items: center;
        gap: $space-2;
        width: 100%;
        padding: $space-3;
        background: transparent;
        border: none;
        color: $text-primary;
        cursor: pointer;
        text-align: left;

        &:hover { background: $bg-hover; }
    }

    &__chev {
        display: inline-flex;
        color: $text-tertiary;
        transition: transform 0.15s;
    }

    &__row {
        display: flex;
        align-items: center;
        gap: $space-2;
    }

    &__when {
        color: $text-tertiary;
        font-size: $text-xs;
    }

    &__meta {
        color: $text-tertiary;
        font-size: $text-xs;
    }

    &__sub {
        margin-left: auto;
        color: $text-tertiary;
        font-size: $text-xs;
    }

    &__detail {
        padding: $space-3;
        border-top: 1px solid $border-subtle;
        display: flex;
        flex-direction: column;
        gap: $space-2;
    }

    &__probes {
        display: flex;
        flex-direction: column;
        gap: $space-1;
    }

    &__probe {
        display: flex;
        align-items: center;
        gap: $space-2;
        font-size: $text-xs;
        color: $text-secondary;
    }

    &__probe-empty {
        color: $text-tertiary;
        font-size: $text-xs;
        font-style: italic;
    }

    &__error {
        color: $danger;
        font-size: $text-xs;
    }
}

// ---------- Protection status card ----------
.protection-panel {
    display: flex;
    flex-direction: column;
    gap: $space-4;
}

.protection-status-card {
    &__toggle {
        display: flex;
        align-items: center;
        gap: $space-3;
    }

    &__toggle-title {
        display: block;
        font-weight: $font-weight-semibold;
        color: $text-primary;
    }

    &__toggle-sub {
        display: block;
        color: $text-tertiary;
        font-size: $text-xs;
    }

    &__status {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: $space-2;
        margin: $space-3 0;
    }

    &__kpis {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: $space-3;
        margin: $space-3 0;
    }

    &__actions {
        display: flex;
        flex-wrap: wrap;
        gap: $space-2;
    }
}

// ---------- Schedule card ----------
.schedule-card {
    background: $bg-card;
    border: 1px solid $border-subtle;
    border-radius: $radius-card;
    padding: $space-4;
    display: flex;
    flex-direction: column;
    gap: $space-3;

    &__field {
        display: flex;
        flex-direction: column;
        gap: $space-1;

        label {
            color: $text-tertiary;
            font-size: $text-xs;
        }
    }

    &__retention {
        display: flex;
        flex-direction: column;
        gap: $space-2;
    }

    &__retention-row {
        display: flex;
        align-items: center;
        gap: $space-2;
        font-size: $text-xs;
        color: $text-secondary;
    }

    &__remote {
        display: flex;
        align-items: center;
        gap: $space-2;
        font-size: $text-xs;
        color: $text-secondary;
    }

    &__actions {
        display: flex;
        flex-wrap: wrap;
        gap: $space-2;
    }
}

// ---------- Restore drawer ----------
.restore-drawer {
    display: flex;
    flex-direction: column;
    gap: $space-4;

    &__section {
        display: flex;
        flex-direction: column;
        gap: $space-2;
    }

    &__label {
        color: $text-tertiary;
        font-size: $text-xs;
        font-weight: $font-weight-semibold;
    }

    &__scope {
        display: flex;
        flex-wrap: wrap;
        gap: $space-2;
    }

    &__options {
        display: flex;
        flex-direction: column;
        gap: $space-2;
    }

    &__option {
        display: flex;
        align-items: flex-start;
        gap: $space-2;
        padding: $space-2 $space-3;
        border: 1px solid $border-subtle;
        border-radius: $radius-control;
        cursor: pointer;

        &:hover { border-color: $border-active; }
    }

    &__tables {
        display: flex;
        flex-direction: column;
        gap: $space-1;
        max-height: 240px;
        overflow-y: auto;
        padding: $space-2;
        border: 1px solid $border-subtle;
        border-radius: $radius-control;
        background: $bg-body;
    }

    &__warning {
        display: flex;
        align-items: flex-start;
        gap: $space-2;
        padding: $space-3;
        border-radius: $radius-control;
        background: $warning-bg;
        border: 1px solid $warning-border;
        color: $warning;
        font-size: $text-xs;
    }
}

// ---------- Storage provider config ----------
.storage-provider-config {
    display: flex;
    flex-direction: column;
    gap: $space-3;
    background: $bg-card;
    border: 1px solid $border-subtle;
    border-radius: $radius-card;
    padding: $space-4;
}

/* A destination ServerKit Cloud manages is read-only here.
   The fieldset is the disable mechanism; it must not look like a box. */
.bk-storage-fieldset {
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;
}

.bk-storage-fieldset:disabled {
    opacity: 0.65;
}