import * as i0 from '@angular/core';
import { Component, ChangeDetectionStrategy, Input, NgModule } from '@angular/core';
import * as i1 from '@vendure/admin-ui/core';
import { JobState, BaseListComponent, SortOrder, SharedModule } from '@vendure/admin-ui/core';
import * as i3 from '@clr/angular';
import * as i3$1 from '@angular/common';
import * as i4 from '@ngx-translate/core';
import * as i5 from '@angular/forms';
import { FormControl } from '@angular/forms';
import { timer } from 'rxjs';
import { takeUntil, filter, map } from 'rxjs/operators';
import * as i2 from '@angular/router';
import { RouterModule } from '@angular/router';
import * as i6 from '@ng-select/ng-select';
import { marker } from '@biesbjerg/ngx-translate-extract-marker';

class HealthCheckComponent {
    constructor(healthCheckService) {
        this.healthCheckService = healthCheckService;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: HealthCheckComponent, deps: [{ token: i1.HealthCheckService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: HealthCheckComponent, selector: "vdr-health-check", ngImport: i0, template: "<vdr-page-header>\n    <vdr-page-title></vdr-page-title>\n</vdr-page-header>\n<vdr-page-body>\n    <vdr-page-block>\n        <vdr-action-bar>\n            <vdr-ab-left>\n                <div class=\"system-status-header\" *ngIf=\"healthCheckService.status$ | async as status\">\n                    <div class=\"status-icon\">\n                        <clr-icon\n                            [attr.shape]=\"status === 'ok' ? 'check-circle' : 'exclamation-circle'\"\n                            [ngClass]=\"{ 'is-success': status === 'ok', 'is-danger': status !== 'ok' }\"\n                            size=\"48\"\n                        ></clr-icon>\n                    </div>\n                    <div class=\"status-detail\">\n                        <ng-container *ngIf=\"status === 'ok'; else error\">\n                            {{ 'system.health-all-systems-up' | translate }}\n                        </ng-container>\n                        <ng-template #error>\n                            {{ 'system.health-error' | translate }}\n                        </ng-template>\n                        <div class=\"last-checked\">\n                            {{ 'system.health-last-checked' | translate }}:\n                            {{ healthCheckService.lastCheck$ | async | localeDate : 'mediumTime' }}\n                        </div>\n                    </div>\n                </div>\n            </vdr-ab-left>\n            <vdr-ab-right>\n                <vdr-action-bar-items locationId=\"system-status\"></vdr-action-bar-items>\n                <button class=\"btn btn-secondary\" (click)=\"healthCheckService.refresh()\">\n                    <clr-icon shape=\"refresh\"></clr-icon> {{ 'system.health-refresh' | translate }}\n                </button>\n            </vdr-ab-right>\n        </vdr-action-bar>\n    </vdr-page-block>\n    <vdr-page-block>\n        <table class=\"table\">\n            <thead>\n                <tr>\n                    <th class=\"left\">\n                        {{ 'common.name' | translate }}\n                    </th>\n                    <th class=\"left\">\n                        {{ 'system.health-status' | translate }}\n                    </th>\n                    <th class=\"left\">\n                        {{ 'system.health-message' | translate }}\n                    </th>\n                </tr>\n            </thead>\n            <tbody>\n                <tr *ngFor=\"let row of healthCheckService.details$ | async\">\n                    <td class=\"align-middle left\">{{ row.key }}</td>\n                    <td class=\"align-middle left\">\n                        <vdr-chip [colorType]=\"row.result.status === 'up' ? 'success' : 'error'\">\n                            <ng-container *ngIf=\"row.result.status === 'up'; else down\">\n                                <clr-icon shape=\"check-circle\"></clr-icon>\n                                {{ 'system.health-status-up' | translate }}\n                            </ng-container>\n                            <ng-template #down>\n                                <clr-icon shape=\"exclamation-circle\"></clr-icon>\n                                {{ 'system.health-status-down' | translate }}\n                            </ng-template>\n                        </vdr-chip>\n                    </td>\n                    <td class=\"align-middle left\">{{ row.result.message }}</td>\n                </tr>\n            </tbody>\n        </table>\n    </vdr-page-block>\n</vdr-page-body>\n", styles: [".system-status-header{display:flex;justify-content:space-between;align-items:flex-start}.system-status-header .status-detail{font-weight:700;margin-inline-end:6px}.system-status-header .last-checked{font-weight:400;color:var(--color-grey-500)}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.ActionBarComponent, selector: "vdr-action-bar" }, { kind: "component", type: i1.ActionBarLeftComponent, selector: "vdr-ab-left", inputs: ["grow"] }, { kind: "component", type: i1.ActionBarRightComponent, selector: "vdr-ab-right", inputs: ["grow"] }, { kind: "component", type: i1.ChipComponent, selector: "vdr-chip", inputs: ["icon", "invert", "colorFrom", "colorType"], outputs: ["iconClick"] }, { kind: "component", type: i1.ActionBarItemsComponent, selector: "vdr-action-bar-items", inputs: ["locationId"] }, { kind: "component", type: i1.PageHeaderComponent, selector: "vdr-page-header" }, { kind: "component", type: i1.PageTitleComponent, selector: "vdr-page-title", inputs: ["title"] }, { kind: "component", type: i1.PageBodyComponent, selector: "vdr-page-body" }, { kind: "component", type: i1.PageBlockComponent, selector: "vdr-page-block" }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleDatePipe, name: "localeDate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: HealthCheckComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-health-check', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-page-header>\n    <vdr-page-title></vdr-page-title>\n</vdr-page-header>\n<vdr-page-body>\n    <vdr-page-block>\n        <vdr-action-bar>\n            <vdr-ab-left>\n                <div class=\"system-status-header\" *ngIf=\"healthCheckService.status$ | async as status\">\n                    <div class=\"status-icon\">\n                        <clr-icon\n                            [attr.shape]=\"status === 'ok' ? 'check-circle' : 'exclamation-circle'\"\n                            [ngClass]=\"{ 'is-success': status === 'ok', 'is-danger': status !== 'ok' }\"\n                            size=\"48\"\n                        ></clr-icon>\n                    </div>\n                    <div class=\"status-detail\">\n                        <ng-container *ngIf=\"status === 'ok'; else error\">\n                            {{ 'system.health-all-systems-up' | translate }}\n                        </ng-container>\n                        <ng-template #error>\n                            {{ 'system.health-error' | translate }}\n                        </ng-template>\n                        <div class=\"last-checked\">\n                            {{ 'system.health-last-checked' | translate }}:\n                            {{ healthCheckService.lastCheck$ | async | localeDate : 'mediumTime' }}\n                        </div>\n                    </div>\n                </div>\n            </vdr-ab-left>\n            <vdr-ab-right>\n                <vdr-action-bar-items locationId=\"system-status\"></vdr-action-bar-items>\n                <button class=\"btn btn-secondary\" (click)=\"healthCheckService.refresh()\">\n                    <clr-icon shape=\"refresh\"></clr-icon> {{ 'system.health-refresh' | translate }}\n                </button>\n            </vdr-ab-right>\n        </vdr-action-bar>\n    </vdr-page-block>\n    <vdr-page-block>\n        <table class=\"table\">\n            <thead>\n                <tr>\n                    <th class=\"left\">\n                        {{ 'common.name' | translate }}\n                    </th>\n                    <th class=\"left\">\n                        {{ 'system.health-status' | translate }}\n                    </th>\n                    <th class=\"left\">\n                        {{ 'system.health-message' | translate }}\n                    </th>\n                </tr>\n            </thead>\n            <tbody>\n                <tr *ngFor=\"let row of healthCheckService.details$ | async\">\n                    <td class=\"align-middle left\">{{ row.key }}</td>\n                    <td class=\"align-middle left\">\n                        <vdr-chip [colorType]=\"row.result.status === 'up' ? 'success' : 'error'\">\n                            <ng-container *ngIf=\"row.result.status === 'up'; else down\">\n                                <clr-icon shape=\"check-circle\"></clr-icon>\n                                {{ 'system.health-status-up' | translate }}\n                            </ng-container>\n                            <ng-template #down>\n                                <clr-icon shape=\"exclamation-circle\"></clr-icon>\n                                {{ 'system.health-status-down' | translate }}\n                            </ng-template>\n                        </vdr-chip>\n                    </td>\n                    <td class=\"align-middle left\">{{ row.result.message }}</td>\n                </tr>\n            </tbody>\n        </table>\n    </vdr-page-block>\n</vdr-page-body>\n", styles: [".system-status-header{display:flex;justify-content:space-between;align-items:flex-start}.system-status-header .status-detail{font-weight:700;margin-inline-end:6px}.system-status-header .last-checked{font-weight:400;color:var(--color-grey-500)}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.HealthCheckService }]; } });

class JobStateLabelComponent {
    get iconShape() {
        switch (this.job.state) {
            case JobState.COMPLETED:
                return 'check-circle';
            case JobState.FAILED:
                return 'exclamation-circle';
            case JobState.CANCELLED:
                return 'ban';
            case JobState.PENDING:
            case JobState.RETRYING:
                return 'hourglass';
            case JobState.RUNNING:
                return 'sync';
        }
    }
    get colorType() {
        switch (this.job.state) {
            case JobState.COMPLETED:
                return 'success';
            case JobState.FAILED:
            case JobState.CANCELLED:
                return 'error';
            case JobState.PENDING:
            case JobState.RETRYING:
                return '';
            case JobState.RUNNING:
                return 'warning';
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: JobStateLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: JobStateLabelComponent, selector: "vdr-job-state-label", inputs: { job: "job" }, ngImport: i0, template: "<vdr-chip [colorType]=\"colorType\">\n    <clr-icon [attr.shape]=\"iconShape\" class=\"mr1\"></clr-icon>\n    {{ job.state | titlecase }}\n    <span *ngIf=\"job.state === 'RUNNING'\" class=\"progress\">\n        {{ (job.progress / 100) | percent }}\n    </span>\n</vdr-chip>\n", styles: [".progress{margin-inline-start:3px}clr-icon{min-width:12px}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.ChipComponent, selector: "vdr-chip", inputs: ["icon", "invert", "colorFrom", "colorType"], outputs: ["iconClick"] }, { kind: "pipe", type: i3$1.PercentPipe, name: "percent" }, { kind: "pipe", type: i3$1.TitleCasePipe, name: "titlecase" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: JobStateLabelComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-job-state-label', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-chip [colorType]=\"colorType\">\n    <clr-icon [attr.shape]=\"iconShape\" class=\"mr1\"></clr-icon>\n    {{ job.state | titlecase }}\n    <span *ngIf=\"job.state === 'RUNNING'\" class=\"progress\">\n        {{ (job.progress / 100) | percent }}\n    </span>\n</vdr-chip>\n", styles: [".progress{margin-inline-start:3px}clr-icon{min-width:12px}\n"] }]
        }], propDecorators: { job: [{
                type: Input
            }] } });

class JobListComponent extends BaseListComponent {
    constructor(dataService, router, route) {
        super(router, route);
        this.dataService = dataService;
        this.liveUpdate = new FormControl(true);
        this.queueFilter = new FormControl('all');
        this.stateFilter = new FormControl('');
        super.setQueryFn((...args) => this.dataService.settings.getAllJobs(...args), data => data.jobs, (skip, take) => {
            const queueFilter = this.queueFilter.value === 'all' ? null : { queueName: { eq: this.queueFilter.value } };
            const stateFilter = this.stateFilter.value;
            return {
                options: {
                    skip,
                    take,
                    filter: {
                        ...queueFilter,
                        ...(stateFilter ? { state: { eq: stateFilter } } : {}),
                    },
                    sort: {
                        createdAt: SortOrder.DESC,
                    },
                },
            };
        });
    }
    ngOnInit() {
        super.ngOnInit();
        timer(5000, 2000)
            .pipe(takeUntil(this.destroy$), filter(() => !!this.liveUpdate.value))
            .subscribe(() => {
            this.refresh();
        });
        this.queues$ = this.dataService.settings
            .getJobQueues()
            .mapStream(res => res.jobQueues)
            .pipe(map(queues => [{ name: 'all', running: true }, ...queues]));
    }
    hasResult(job) {
        const result = job.result;
        if (result == null) {
            return false;
        }
        if (typeof result === 'object') {
            return Object.keys(result).length > 0;
        }
        return true;
    }
    cancelJob(id) {
        this.dataService.settings.cancelJob(id).subscribe(() => this.refresh());
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: JobListComponent, deps: [{ token: i1.DataService }, { token: i2.Router }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: JobListComponent, selector: "vdr-job-list", usesInheritance: true, ngImport: i0, template: "<vdr-page-header>\n    <vdr-page-title></vdr-page-title>\n</vdr-page-header>\n<vdr-page-body>\n    <vdr-page-block>\n        <vdr-action-bar>\n            <vdr-ab-left>\n                <clr-checkbox-wrapper class=\"mr-2\">\n                    <input type=\"checkbox\" clrCheckbox [formControl]=\"liveUpdate\" name=\"live-update\" />\n                    <label>{{ 'common.live-update' | translate }}</label>\n                </clr-checkbox-wrapper>\n            </vdr-ab-left>\n            <vdr-ab-right>\n                <vdr-action-bar-items locationId=\"job-list\"></vdr-action-bar-items>\n                <ng-select\n                    class=\"mr-2\"\n                    [addTag]=\"false\"\n                    [hideSelected]=\"true\"\n                    [multiple]=\"false\"\n                    [markFirst]=\"false\"\n                    [clearable]=\"false\"\n                    [searchable]=\"false\"\n                    [formControl]=\"stateFilter\"\n                    (change)=\"refresh()\"\n                >\n                    <ng-option [value]=\"''\">\n                        <vdr-chip>{{ 'system.job-state-all' | translate }}</vdr-chip>\n                    </ng-option>\n                    <ng-option [value]=\"'PENDING'\">\n                        <vdr-chip>{{ 'system.job-state-pending' | translate }}</vdr-chip>\n                    </ng-option>\n                    <ng-option [value]=\"'RUNNING'\">\n                        <vdr-chip colorType=\"warning\">{{ 'system.job-state-running' | translate }}</vdr-chip>\n                    </ng-option>\n                    <ng-option [value]=\"'COMPLETED'\">\n                        <vdr-chip colorType=\"success\">{{ 'system.job-state-completed' | translate }}</vdr-chip>\n                    </ng-option>\n                    <ng-option [value]=\"'FAILED'\">\n                        <vdr-chip colorType=\"error\">{{ 'system.job-state-failed' | translate }}</vdr-chip>\n                    </ng-option>\n                    <ng-option [value]=\"'CANCELLED'\">\n                        <vdr-chip colorType=\"error\">{{ 'system.job-state-cancelled' | translate }}</vdr-chip>\n                    </ng-option>\n                </ng-select>\n                <ng-select\n                    [addTag]=\"false\"\n                    [items]=\"queues$ | async\"\n                    [hideSelected]=\"true\"\n                    [multiple]=\"false\"\n                    [markFirst]=\"false\"\n                    [clearable]=\"false\"\n                    [searchable]=\"false\"\n                    bindValue=\"name\"\n                    [formControl]=\"queueFilter\"\n                    (change)=\"refresh()\"\n                >\n                    <ng-template ng-label-tmp ng-option-tmp let-item=\"item\">\n                        <ng-container *ngIf=\"item.name === 'all'; else others\">\n                            <vdr-chip>{{ 'system.all-job-queues' | translate }}</vdr-chip>\n                        </ng-container>\n                        <ng-template #others>\n                            <vdr-chip [colorFrom]=\"item.name\">{{ item.name }}</vdr-chip>\n                        </ng-template>\n                    </ng-template>\n                </ng-select>\n            </vdr-ab-right>\n        </vdr-action-bar>\n    </vdr-page-block>\n\n    <vdr-data-table-2\n        id=\"job-list\"\n        [items]=\"items$ | async\"\n        [itemsPerPage]=\"itemsPerPage$ | async\"\n        [totalItems]=\"totalItems$ | async\"\n        [currentPage]=\"currentPage$ | async\"\n        (pageChange)=\"setPageNumber($event)\"\n        (itemsPerPageChange)=\"setItemsPerPage($event)\"\n    >\n        <vdr-dt2-column [heading]=\"'common.id' | translate\" id=\"id\">\n            <ng-template let-job=\"item\">\n                {{ job.id }}\n            </ng-template>\n        </vdr-dt2-column>\n        <vdr-dt2-column [heading]=\"'common.created-at' | translate\" id=\"created-at\">\n            <ng-template let-job=\"item\">\n                {{ job.createdAt | timeAgo }}\n            </ng-template>\n        </vdr-dt2-column>\n        <vdr-dt2-column [heading]=\"'system.job-queue-name' | translate\" id=\"job-queue-name\" [optional]=\"false\">\n            <ng-template let-job=\"item\">\n                <vdr-chip [colorFrom]=\"job.queueName\">{{ job.queueName }}</vdr-chip>\n            </ng-template>\n        </vdr-dt2-column>\n        <vdr-dt2-column [heading]=\"'system.job-data' | translate\" id=\"job-data\" [optional]=\"false\">\n            <ng-template let-job=\"item\">\n                <vdr-dropdown *ngIf=\"job.data\">\n                    <button\n                        class=\"button-small\"\n                        vdrDropdownTrigger\n                        [title]=\"'system.job-data' | translate\"\n                    >\n                        <clr-icon shape=\"details\"></clr-icon>\n                    </button>\n                    <vdr-dropdown-menu>\n                        <div class=\"result-detail\">\n                            <vdr-object-tree [value]=\"job.data\"></vdr-object-tree>\n                        </div>\n                    </vdr-dropdown-menu>\n                </vdr-dropdown>\n            </ng-template>\n        </vdr-dt2-column>\n        <vdr-dt2-column [heading]=\"'system.job-state' | translate\" id=\"job-state\">\n            <ng-template let-job=\"item\">\n                <vdr-job-state-label [job]=\"job\"></vdr-job-state-label>\n                <div *ngIf=\"job.state === 'FAILED'\" class=\"retry-info\">after {{ job.attempts }} attempts</div>\n                <div *ngIf=\"job.state === 'RUNNING' || job.state === 'RETRYING'\" class=\"retry-info\">\n                    attempting {{ job.attempts }} of {{ job.retries + 1 }}\n                </div>\n            </ng-template>\n        </vdr-dt2-column>\n        <vdr-dt2-column [heading]=\"'system.job-duration' | translate\" id=\"job-duration\">\n            <ng-template let-job=\"item\">\n                {{ job.duration | duration }}\n            </ng-template>\n        </vdr-dt2-column>\n        <vdr-dt2-column [heading]=\"'system.job-result' | translate\" id=\"job-result\">\n            <ng-template let-job=\"item\">\n                <vdr-dropdown *ngIf=\"hasResult(job)\">\n                    <button class=\"button-small mr-1\" vdrDropdownTrigger>\n                        <clr-icon shape=\"details\"></clr-icon>\n                        {{ 'system.job-result' | translate }}\n                    </button>\n                    <vdr-dropdown-menu>\n                        <div class=\"result-detail\">\n                            <vdr-object-tree [value]=\"job.result\"></vdr-object-tree>\n                        </div>\n                    </vdr-dropdown-menu>\n                </vdr-dropdown>\n                <vdr-dropdown *ngIf=\"job.error\">\n                    <button class=\"button-small\" vdrDropdownTrigger>\n                        <clr-icon shape=\"exclamation-circle\"></clr-icon>\n                        {{ 'system.job-error' | translate }}\n                    </button>\n                    <vdr-dropdown-menu>\n                        <div class=\"result-detail\">\n                            {{ job.error }}\n                        </div>\n                    </vdr-dropdown-menu>\n                </vdr-dropdown>\n                <vdr-dropdown *ngIf=\"!job.isSettled && job.state !== 'FAILED'\">\n                    <button class=\"icon-button\" vdrDropdownTrigger>\n                        <clr-icon shape=\"ellipsis-vertical\" size=\"12\"></clr-icon>\n                    </button>\n                    <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n                        <button\n                            type=\"button\"\n                            class=\"delete-button\"\n                            (click)=\"cancelJob(job.id)\"\n                            [disabled]=\"!(['DeleteSettings', 'DeleteSystem'] | hasPermission)\"\n                            vdrDropdownItem\n                        >\n                            <clr-icon shape=\"ban\" class=\"is-danger\"></clr-icon>\n                            {{ 'common.cancel' | translate }}\n                        </button>\n                    </vdr-dropdown-menu>\n                </vdr-dropdown>\n            </ng-template>\n        </vdr-dt2-column>\n    </vdr-data-table-2>\n</vdr-page-body>\n", styles: [".result-detail{margin:0 12px}.retry-info{margin-inline-start:6px;color:var(--color-grey-400)}\n"], dependencies: [{ kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3.ClrLabel, selector: "label", inputs: ["for"] }, { kind: "directive", type: i3.ClrCheckbox, selector: "[clrCheckbox],[clrToggle]" }, { kind: "component", type: i3.ClrCheckboxWrapper, selector: "clr-checkbox-wrapper,clr-toggle-wrapper" }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i6.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "component", type: i6.NgOptionComponent, selector: "ng-option", inputs: ["value", "disabled"] }, { kind: "directive", type: i6.NgOptionTemplateDirective, selector: "[ng-option-tmp]" }, { kind: "directive", type: i6.NgLabelTemplateDirective, selector: "[ng-label-tmp]" }, { kind: "component", type: i1.ActionBarComponent, selector: "vdr-action-bar" }, { kind: "component", type: i1.ActionBarLeftComponent, selector: "vdr-ab-left", inputs: ["grow"] }, { kind: "component", type: i1.ActionBarRightComponent, selector: "vdr-ab-right", inputs: ["grow"] }, { kind: "component", type: i1.ChipComponent, selector: "vdr-chip", inputs: ["icon", "invert", "colorFrom", "colorType"], outputs: ["iconClick"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select" }, { kind: "component", type: i1.DropdownComponent, selector: "vdr-dropdown", inputs: ["manualToggle"] }, { kind: "component", type: i1.DropdownMenuComponent, selector: "vdr-dropdown-menu", inputs: ["vdrPosition", "customClasses"] }, { kind: "directive", type: i1.DropdownTriggerDirective, selector: "[vdrDropdownTrigger]" }, { kind: "directive", type: i1.DropdownItemDirective, selector: "[vdrDropdownItem]" }, { kind: "component", type: i1.ObjectTreeComponent, selector: "vdr-object-tree", inputs: ["value", "isArrayItem"] }, { kind: "component", type: i1.ActionBarItemsComponent, selector: "vdr-action-bar-items", inputs: ["locationId"] }, { kind: "component", type: i1.DataTable2Component, selector: "vdr-data-table-2", inputs: ["id", "items", "itemsPerPage", "currentPage", "totalItems", "emptyStateLabel", "filters", "activeIndex"], outputs: ["pageChange", "itemsPerPageChange"] }, { kind: "component", type: i1.DataTable2ColumnComponent, selector: "vdr-dt2-column", inputs: ["id", "expand", "heading", "align", "sort", "optional", "hiddenByDefault", "orderable"], exportAs: ["row"] }, { kind: "component", type: i1.PageHeaderComponent, selector: "vdr-page-header" }, { kind: "component", type: i1.PageTitleComponent, selector: "vdr-page-title", inputs: ["title"] }, { kind: "component", type: i1.PageBodyComponent, selector: "vdr-page-body" }, { kind: "component", type: i1.PageBlockComponent, selector: "vdr-page-block" }, { kind: "component", type: JobStateLabelComponent, selector: "vdr-job-state-label", inputs: ["job"] }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.HasPermissionPipe, name: "hasPermission" }, { kind: "pipe", type: i1.TimeAgoPipe, name: "timeAgo" }, { kind: "pipe", type: i1.DurationPipe, name: "duration" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: JobListComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-job-list', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-page-header>\n    <vdr-page-title></vdr-page-title>\n</vdr-page-header>\n<vdr-page-body>\n    <vdr-page-block>\n        <vdr-action-bar>\n            <vdr-ab-left>\n                <clr-checkbox-wrapper class=\"mr-2\">\n                    <input type=\"checkbox\" clrCheckbox [formControl]=\"liveUpdate\" name=\"live-update\" />\n                    <label>{{ 'common.live-update' | translate }}</label>\n                </clr-checkbox-wrapper>\n            </vdr-ab-left>\n            <vdr-ab-right>\n                <vdr-action-bar-items locationId=\"job-list\"></vdr-action-bar-items>\n                <ng-select\n                    class=\"mr-2\"\n                    [addTag]=\"false\"\n                    [hideSelected]=\"true\"\n                    [multiple]=\"false\"\n                    [markFirst]=\"false\"\n                    [clearable]=\"false\"\n                    [searchable]=\"false\"\n                    [formControl]=\"stateFilter\"\n                    (change)=\"refresh()\"\n                >\n                    <ng-option [value]=\"''\">\n                        <vdr-chip>{{ 'system.job-state-all' | translate }}</vdr-chip>\n                    </ng-option>\n                    <ng-option [value]=\"'PENDING'\">\n                        <vdr-chip>{{ 'system.job-state-pending' | translate }}</vdr-chip>\n                    </ng-option>\n                    <ng-option [value]=\"'RUNNING'\">\n                        <vdr-chip colorType=\"warning\">{{ 'system.job-state-running' | translate }}</vdr-chip>\n                    </ng-option>\n                    <ng-option [value]=\"'COMPLETED'\">\n                        <vdr-chip colorType=\"success\">{{ 'system.job-state-completed' | translate }}</vdr-chip>\n                    </ng-option>\n                    <ng-option [value]=\"'FAILED'\">\n                        <vdr-chip colorType=\"error\">{{ 'system.job-state-failed' | translate }}</vdr-chip>\n                    </ng-option>\n                    <ng-option [value]=\"'CANCELLED'\">\n                        <vdr-chip colorType=\"error\">{{ 'system.job-state-cancelled' | translate }}</vdr-chip>\n                    </ng-option>\n                </ng-select>\n                <ng-select\n                    [addTag]=\"false\"\n                    [items]=\"queues$ | async\"\n                    [hideSelected]=\"true\"\n                    [multiple]=\"false\"\n                    [markFirst]=\"false\"\n                    [clearable]=\"false\"\n                    [searchable]=\"false\"\n                    bindValue=\"name\"\n                    [formControl]=\"queueFilter\"\n                    (change)=\"refresh()\"\n                >\n                    <ng-template ng-label-tmp ng-option-tmp let-item=\"item\">\n                        <ng-container *ngIf=\"item.name === 'all'; else others\">\n                            <vdr-chip>{{ 'system.all-job-queues' | translate }}</vdr-chip>\n                        </ng-container>\n                        <ng-template #others>\n                            <vdr-chip [colorFrom]=\"item.name\">{{ item.name }}</vdr-chip>\n                        </ng-template>\n                    </ng-template>\n                </ng-select>\n            </vdr-ab-right>\n        </vdr-action-bar>\n    </vdr-page-block>\n\n    <vdr-data-table-2\n        id=\"job-list\"\n        [items]=\"items$ | async\"\n        [itemsPerPage]=\"itemsPerPage$ | async\"\n        [totalItems]=\"totalItems$ | async\"\n        [currentPage]=\"currentPage$ | async\"\n        (pageChange)=\"setPageNumber($event)\"\n        (itemsPerPageChange)=\"setItemsPerPage($event)\"\n    >\n        <vdr-dt2-column [heading]=\"'common.id' | translate\" id=\"id\">\n            <ng-template let-job=\"item\">\n                {{ job.id }}\n            </ng-template>\n        </vdr-dt2-column>\n        <vdr-dt2-column [heading]=\"'common.created-at' | translate\" id=\"created-at\">\n            <ng-template let-job=\"item\">\n                {{ job.createdAt | timeAgo }}\n            </ng-template>\n        </vdr-dt2-column>\n        <vdr-dt2-column [heading]=\"'system.job-queue-name' | translate\" id=\"job-queue-name\" [optional]=\"false\">\n            <ng-template let-job=\"item\">\n                <vdr-chip [colorFrom]=\"job.queueName\">{{ job.queueName }}</vdr-chip>\n            </ng-template>\n        </vdr-dt2-column>\n        <vdr-dt2-column [heading]=\"'system.job-data' | translate\" id=\"job-data\" [optional]=\"false\">\n            <ng-template let-job=\"item\">\n                <vdr-dropdown *ngIf=\"job.data\">\n                    <button\n                        class=\"button-small\"\n                        vdrDropdownTrigger\n                        [title]=\"'system.job-data' | translate\"\n                    >\n                        <clr-icon shape=\"details\"></clr-icon>\n                    </button>\n                    <vdr-dropdown-menu>\n                        <div class=\"result-detail\">\n                            <vdr-object-tree [value]=\"job.data\"></vdr-object-tree>\n                        </div>\n                    </vdr-dropdown-menu>\n                </vdr-dropdown>\n            </ng-template>\n        </vdr-dt2-column>\n        <vdr-dt2-column [heading]=\"'system.job-state' | translate\" id=\"job-state\">\n            <ng-template let-job=\"item\">\n                <vdr-job-state-label [job]=\"job\"></vdr-job-state-label>\n                <div *ngIf=\"job.state === 'FAILED'\" class=\"retry-info\">after {{ job.attempts }} attempts</div>\n                <div *ngIf=\"job.state === 'RUNNING' || job.state === 'RETRYING'\" class=\"retry-info\">\n                    attempting {{ job.attempts }} of {{ job.retries + 1 }}\n                </div>\n            </ng-template>\n        </vdr-dt2-column>\n        <vdr-dt2-column [heading]=\"'system.job-duration' | translate\" id=\"job-duration\">\n            <ng-template let-job=\"item\">\n                {{ job.duration | duration }}\n            </ng-template>\n        </vdr-dt2-column>\n        <vdr-dt2-column [heading]=\"'system.job-result' | translate\" id=\"job-result\">\n            <ng-template let-job=\"item\">\n                <vdr-dropdown *ngIf=\"hasResult(job)\">\n                    <button class=\"button-small mr-1\" vdrDropdownTrigger>\n                        <clr-icon shape=\"details\"></clr-icon>\n                        {{ 'system.job-result' | translate }}\n                    </button>\n                    <vdr-dropdown-menu>\n                        <div class=\"result-detail\">\n                            <vdr-object-tree [value]=\"job.result\"></vdr-object-tree>\n                        </div>\n                    </vdr-dropdown-menu>\n                </vdr-dropdown>\n                <vdr-dropdown *ngIf=\"job.error\">\n                    <button class=\"button-small\" vdrDropdownTrigger>\n                        <clr-icon shape=\"exclamation-circle\"></clr-icon>\n                        {{ 'system.job-error' | translate }}\n                    </button>\n                    <vdr-dropdown-menu>\n                        <div class=\"result-detail\">\n                            {{ job.error }}\n                        </div>\n                    </vdr-dropdown-menu>\n                </vdr-dropdown>\n                <vdr-dropdown *ngIf=\"!job.isSettled && job.state !== 'FAILED'\">\n                    <button class=\"icon-button\" vdrDropdownTrigger>\n                        <clr-icon shape=\"ellipsis-vertical\" size=\"12\"></clr-icon>\n                    </button>\n                    <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n                        <button\n                            type=\"button\"\n                            class=\"delete-button\"\n                            (click)=\"cancelJob(job.id)\"\n                            [disabled]=\"!(['DeleteSettings', 'DeleteSystem'] | hasPermission)\"\n                            vdrDropdownItem\n                        >\n                            <clr-icon shape=\"ban\" class=\"is-danger\"></clr-icon>\n                            {{ 'common.cancel' | translate }}\n                        </button>\n                    </vdr-dropdown-menu>\n                </vdr-dropdown>\n            </ng-template>\n        </vdr-dt2-column>\n    </vdr-data-table-2>\n</vdr-page-body>\n", styles: [".result-detail{margin:0 12px}.retry-info{margin-inline-start:6px;color:var(--color-grey-400)}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.DataService }, { type: i2.Router }, { type: i2.ActivatedRoute }]; } });

const systemRoutes = [
    {
        path: 'jobs',
        component: JobListComponent,
        data: {
            breadcrumb: marker('breadcrumb.job-queue'),
        },
    },
    {
        path: 'system-status',
        component: HealthCheckComponent,
        data: {
            breadcrumb: marker('breadcrumb.system-status'),
        },
    },
];

class SystemModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: SystemModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.2", ngImport: i0, type: SystemModule, declarations: [HealthCheckComponent, JobListComponent, JobStateLabelComponent], imports: [SharedModule, i2.RouterModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: SystemModule, imports: [SharedModule, RouterModule.forChild(systemRoutes)] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: SystemModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [HealthCheckComponent, JobListComponent, JobStateLabelComponent],
                    imports: [SharedModule, RouterModule.forChild(systemRoutes)],
                }]
        }] });

// This file was generated by the build-public-api.ts script

/**
 * Generated bundle index. Do not edit.
 */

export { HealthCheckComponent, JobListComponent, JobStateLabelComponent, SystemModule, systemRoutes };
//# sourceMappingURL=vendure-admin-ui-system.mjs.map
