mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 12:33:47 +08:00
TBR=jacktfranklin@chromium.org Bug: chromium:1011811 Change-Id: I6c2480e67a29765a2ef67ae85202532917a4d718 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2351773 Reviewed-by: Simon Zünd <szuend@chromium.org> Commit-Queue: Simon Zünd <szuend@chromium.org>
40 lines
1.5 KiB
JavaScript
40 lines
1.5 KiB
JavaScript
// Copyright 2018 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import * as Common from '../common/common.js';
|
|
import {Dialog} from './Dialog.js';
|
|
import {SizeBehavior} from './GlassPane.js';
|
|
import {createTextButton, formatLocalized} from './UIUtils.js';
|
|
import {VBox} from './Widget.js';
|
|
|
|
export class RemoteDebuggingTerminatedScreen extends VBox {
|
|
/**
|
|
* @param {string} reason
|
|
*/
|
|
constructor(reason) {
|
|
super(true);
|
|
this.registerRequiredCSS('ui/remoteDebuggingTerminatedScreen.css');
|
|
const message = this.contentElement.createChild('div', 'message');
|
|
const reasonElement = message.createChild('span', 'reason');
|
|
reasonElement.textContent = reason;
|
|
message.appendChild(formatLocalized('Debugging connection was closed. Reason: %s', [reasonElement]));
|
|
this.contentElement.createChild('div', 'message').textContent =
|
|
Common.UIString.UIString('Reconnect when ready by reopening DevTools.');
|
|
const button = createTextButton(Common.UIString.UIString('Reconnect DevTools'), () => window.location.reload());
|
|
this.contentElement.createChild('div', 'button').appendChild(button);
|
|
}
|
|
|
|
/**
|
|
* @param {string} reason
|
|
*/
|
|
static show(reason) {
|
|
const dialog = new Dialog();
|
|
dialog.setSizeBehavior(SizeBehavior.MeasureContent);
|
|
dialog.addCloseButton();
|
|
dialog.setDimmed(true);
|
|
new RemoteDebuggingTerminatedScreen(reason).show(dialog.contentElement);
|
|
dialog.show();
|
|
}
|
|
}
|