diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionInstallSection.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionInstallSection.js')
-rw-r--r-- | devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionInstallSection.js | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionInstallSection.js b/devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionInstallSection.js new file mode 100644 index 0000000000..f85618f73d --- /dev/null +++ b/devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionInstallSection.js @@ -0,0 +1,101 @@ +/* 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("resource://devtools/client/shared/vendor/react.js"); +const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js"); +const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.js"); + +const FluentReact = require("resource://devtools/client/shared/vendor/fluent-react.js"); +const Localized = createFactory(FluentReact.Localized); + +const DetailsLog = createFactory( + require("resource://devtools/client/aboutdebugging/src/components/shared/DetailsLog.js") +); +const Message = createFactory( + require("resource://devtools/client/aboutdebugging/src/components/shared/Message.js") +); +const TemporaryExtensionInstaller = createFactory( + require("resource://devtools/client/aboutdebugging/src/components/debugtarget/TemporaryExtensionInstaller.js") +); + +const { + MESSAGE_LEVEL, +} = require("resource://devtools/client/aboutdebugging/src/constants.js"); + +/** + * This component provides an installer and error message area for temporary extension. + */ +class TemporaryExtensionInstallSection extends PureComponent { + static get propTypes() { + return { + dispatch: PropTypes.func.isRequired, + temporaryInstallError: PropTypes.object, + }; + } + + renderError() { + const { temporaryInstallError } = this.props; + + if (!temporaryInstallError) { + return null; + } + + const errorMessages = [ + temporaryInstallError.message, + ...(temporaryInstallError.additionalErrors || []), + ]; + + const errors = errorMessages.map((message, index) => { + return dom.p( + { + className: "technical-text", + key: "tmp-extension-install-error-" + index, + }, + message + ); + }); + + return Message( + { + level: MESSAGE_LEVEL.ERROR, + className: "qa-tmp-extension-install-error", + isCloseable: true, + }, + Localized( + { + id: "about-debugging-tmp-extension-install-error", + }, + dom.p({}, "about-debugging-tmp-extension-install-error") + ), + DetailsLog( + { + type: MESSAGE_LEVEL.ERROR, + }, + errors + ) + ); + } + + render() { + const { dispatch } = this.props; + + return dom.section( + {}, + dom.div( + { + className: "temporary-extension-install-section__toolbar", + }, + TemporaryExtensionInstaller({ dispatch }) + ), + this.renderError() + ); + } +} + +module.exports = TemporaryExtensionInstallSection; |