All files / common/models status-type.model.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96                                          1x                                                                                                                                                    
/**
 * Copyright (c) Siemens 2016 - 2025
 * SPDX-License-Identifier: MIT
 */
import { TranslatableString } from '@siemens/element-translate-ng/translate';
 
export type StatusType = 'success' | 'info' | 'warning' | 'danger' | 'caution' | 'critical';
export type ExtendedStatusType = StatusType | 'unknown';
export type EntityStatusType = ExtendedStatusType | 'pending' | 'progress';
export type AccentLineType = StatusType | 'caution' | 'primary' | 'inactive';
 
export interface StatusIcon {
  icon: string;
  color: string;
  stacked: string;
  stackedColor: string;
  background: string;
  severity: number; // for sorting
  ariaLabel?: TranslatableString;
}
 
export const STATUS_ICON: { [key in EntityStatusType]: StatusIcon } = {
  success: {
    icon: 'element-circle-filled',
    color: 'status-success',
    stacked: 'element-state-tick smooth-auto',
    stackedColor: 'status-success-contrast',
    background: 'bg-base-success',
    severity: 5
  },
  info: {
    icon: 'element-square-filled',
    color: 'status-info',
    stacked: 'element-state-info smooth-auto',
    stackedColor: 'status-info-contrast',
    background: 'bg-base-info',
    severity: 4
  },
  caution: {
    icon: 'element-square-45-filled',
    color: 'status-caution',
    stacked: 'element-state-exclamation-mark smooth-auto',
    stackedColor: 'status-caution-contrast',
    background: 'bg-base-caution',
    severity: 3
  },
  warning: {
    icon: 'element-triangle-filled',
    color: 'status-warning',
    stacked: 'element-state-exclamation-mark smooth-auto',
    stackedColor: 'status-warning-contrast',
    background: 'bg-base-warning',
    severity: 2
  },
  danger: {
    icon: 'element-circle-filled',
    color: 'status-danger',
    stacked: 'element-state-exclamation-mark smooth-auto',
    stackedColor: 'status-danger-contrast',
    background: 'bg-base-danger',
    severity: 1
  },
  critical: {
    icon: 'element-octagon-filled',
    color: 'status-critical',
    stacked: 'element-state-exclamation-mark smooth-auto',
    stackedColor: 'status-critical-contrast',
    background: 'bg-base-critical',
    severity: 0
  },
  progress: {
    icon: 'element-circle-filled',
    color: 'status-info',
    stacked: 'element-state-progress smooth-auto',
    stackedColor: 'status-info-contrast',
    background: 'bg-base-info',
    severity: 7
  },
  pending: {
    icon: 'element-circle-filled',
    color: 'status-caution',
    stacked: 'element-state-pause smooth-auto',
    stackedColor: 'status-caution-contrast',
    background: 'bg-base-caution',
    severity: 6
  },
  unknown: {
    icon: 'element-circle-filled',
    color: 'status-neutral',
    stacked: 'element-state-question-mark',
    stackedColor: 'text-body',
    background: 'bg-base-0',
    severity: 8
  }
};