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
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {
createFactory,
PureComponent,
} = require("devtools/client/shared/vendor/react");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const Actions = require("devtools/client/aboutdebugging/src/actions/index");
const FluentReact = require("devtools/client/shared/vendor/fluent-react");
const Localized = createFactory(FluentReact.Localized);
const { RUNTIMES } = require("devtools/client/aboutdebugging/src/constants");
/**
* This component displays runtime information.
*/
class RuntimeInfo extends PureComponent {
static get propTypes() {
return {
dispatch: PropTypes.func.isRequired,
icon: PropTypes.string.isRequired,
deviceName: PropTypes.string,
name: PropTypes.string.isRequired,
version: PropTypes.string.isRequired,
runtimeId: PropTypes.string.isRequired,
};
}
render() {
const { icon, deviceName, name, version, runtimeId, dispatch } = this.props;
return dom.h1(
{
className: "main-heading runtime-info",
},
dom.img({
className: "main-heading__icon runtime-info__icon qa-runtime-icon",
src: icon,
}),
Localized(
{
id: "about-debugging-runtime-name",
$name: name,
$version: version,
},
dom.label(
{
className: "qa-runtime-name runtime-info__title",
},
`${name} (${version})`
)
),
deviceName
? dom.label(
{
className: "main-heading-subtitle runtime-info__subtitle",
},
deviceName
)
: null,
runtimeId !== RUNTIMES.THIS_FIREFOX
? Localized(
{
id: "about-debugging-runtime-disconnect-button",
},
dom.button(
{
className:
"default-button runtime-info__action qa-runtime-info__action",
onClick() {
dispatch(Actions.disconnectRuntime(runtimeId, true));
},
},
"Disconnect"
)
)
: null
);
}
}
module.exports = RuntimeInfo;
|