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

ash / webui / diagnostics_ui / resources / diagnostics_card.ts [blame]

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import './diagnostics_card_frame.js';
import './diagnostics_shared.css.js';

import {PolymerElementProperties} from 'chrome://resources/polymer/v3_0/polymer/interfaces.js';
import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';

import {getTemplate} from './diagnostics_card.html.js';

/**
 * @fileoverview
 * 'diagnostics-card' is a styling wrapper for each component's diagnostic
 * card.
 */

export class DiagnosticsCardElement extends PolymerElement {
  static get is(): string {
    return 'diagnostics-card';
  }

  static get template(): HTMLTemplateElement {
    return getTemplate();
  }

  static get properties(): PolymerElementProperties {
    return {
      hideDataPoints: {
        type: Boolean,
        value: false,
        reflectToAttribute: true,
      },

      isNetworkingCard: {
        type: Boolean,
        value: false,
        reflectToAttribute: true,
      },

    };
  }

  hideDataPoints: boolean;
  isNetworkingCard: boolean;

  protected getTopSectionClassName(): string {
    return `top-section${this.isNetworkingCard ? '-networking' : ''}`;
  }

  protected getBodyClassName(): string {
    return `data-points${this.isNetworkingCard ? '-column' : ''}`;
  }
}

declare global {
  interface HTMLElementTagNameMap {
    'diagnostics-card': DiagnosticsCardElement;
  }
}

customElements.define(DiagnosticsCardElement.is, DiagnosticsCardElement);