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

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

// Copyright 2021 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_shared.css.js';

import {loadTimeData} from 'chrome://resources/ash/common/load_time_data.m.js';
import {I18nMixin} from 'chrome://resources/ash/common/cr_elements/i18n_mixin.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 {TroubleshootingInfo} from './diagnostics_types.js';
import {getTemplate} from './network_troubleshooting.html.js';

const NetworkTroubleshootingElementBase = I18nMixin(PolymerElement);

export class NetworkTroubleshootingElement extends
    NetworkTroubleshootingElementBase {
  static get is(): 'network-troubleshooting' {
    return 'network-troubleshooting' as const;
  }

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

  static get properties(): PolymerElementProperties {
    return {
      isLoggedIn: {type: Boolean},

      troubleshootingInfo: {
        type: Object,
      },
    };
  }

  troubleshootingInfo: TroubleshootingInfo;
  protected isLoggedIn: boolean = loadTimeData.getBoolean('isLoggedIn');

  protected onLinkTextClicked(): void {
    window.open(this.troubleshootingInfo.url);
  }
}

declare global {
  interface HTMLElementTagNameMap {
    [NetworkTroubleshootingElement.is]: NetworkTroubleshootingElement;
  }
}

customElements.define(
    NetworkTroubleshootingElement.is, NetworkTroubleshootingElement);