All Downloads are FREE. Search and download functionalities are using the official Maven repository.

apps.websight-package-manager.web-resources.components.modals.InstallPackageModal.js Maven / Gradle / Ivy

The newest version!
import React from "/apps/websight-atlaskit-esm/web-resources/react.js";
import Select from "/apps/websight-atlaskit-esm/web-resources/@atlaskit/select.js";
import Form, { FormFooter } from "/apps/websight-rest-atlaskit-client/web-resources/js/Form.js";
import Button, { ButtonGroup } from "/apps/websight-atlaskit-esm/web-resources/@atlaskit/button.js";
import ModalDialog, { ModalTransition } from "/apps/websight-atlaskit-esm/web-resources/@atlaskit/modal-dialog.js";
import { Fieldset } from "/apps/websight-atlaskit-esm/web-resources/@atlaskit/form.js";
import Panel from "/apps/websight-atlaskit-esm/web-resources/@atlaskit/panel.js";
import { Checkbox } from "/apps/websight-atlaskit-esm/web-resources/@atlaskit/checkbox.js";
import styled from "/apps/websight-atlaskit-esm/web-resources/styled-components.js";
import { acHandlingSelectOptions } from "../../utils/PackageManagerConstants.js";
const SettingsContainer = styled.span`
    display: block;
    left: 15px;
    width: 97%;
    position: relative;
    tabIndex: 0;
`;
export default class InstallPackageModal extends React.PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      isOpen: false,
      isExtractSubpackages: true
    };
    this.open = this.open.bind(this);
    this.close = this.close.bind(this);
    this.onFormSubmit = this.onFormSubmit.bind(this);
  }

  open() {
    this.setState({
      isOpen: true
    });
  }

  close() {
    this.setState({
      isOpen: false
    });
  }

  onFormSubmit(requestData, packageData) {
    this.props.onSubmit(packageData.path, requestData);
  }

  render() {
    const {
      isOpen
    } = this.state;
    return /*#__PURE__*/React.createElement(ModalTransition, null, isOpen && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ModalDialog, {
      onClose: this.close,
      heading: this.props.isPackageInstalled ? 'Reinstall' : 'Install' + 'package'
    }, /*#__PURE__*/React.createElement(React.Fragment, null, "Do you really want to ", this.props.isPackageInstalled ? 'reinstall' : 'install', " this package?", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("b", null, this.props.packageData.downloadName)), /*#__PURE__*/React.createElement(Form, {
      onSubmit: data => this.onFormSubmit(data, this.props.packageData),
      onSuccess: this.close
    }, ({
      submitted
    }) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SettingsContainer, null, /*#__PURE__*/React.createElement(Panel, {
      header: "Advanced",
      isDefaultExpanded: false
    }, /*#__PURE__*/React.createElement(Fieldset, null, /*#__PURE__*/React.createElement(Select, {
      label: "AC Handling",
      placeholder: "",
      name: "acHandling",
      options: acHandlingSelectOptions,
      menuPortalTarget: document.body,
      styles: {
        menuPortal: base => ({ ...base,
          zIndex: 9999
        })
      }
    }), /*#__PURE__*/React.createElement(Checkbox, {
      isChecked: this.state.isExtractSubpackages,
      defaultChecked: true,
      hideLabel: true,
      label: "Extract Subpackages",
      name: "extractSubpackages",
      onChange: event => this.setState({
        isExtractSubpackages: event.target.checked
      })
    })))), /*#__PURE__*/React.createElement(FormFooter, null, /*#__PURE__*/React.createElement(ButtonGroup, null, /*#__PURE__*/React.createElement(Button, {
      autoFocus: true,
      appearance: "primary",
      type: "submit",
      isLoading: submitted
    }, "Install"), /*#__PURE__*/React.createElement(Button, {
      appearance: "subtle",
      onClick: this.close,
      isDisabled: submitted
    }, "Cancel"))))))));
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy