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

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

The newest version!
import React from "/apps/websight-atlaskit-esm/web-resources/react.js";
import Button from "/apps/websight-atlaskit-esm/web-resources/@atlaskit/button.js";
import Select from "/apps/websight-atlaskit-esm/web-resources/@atlaskit/select.js";
import styled from "/apps/websight-atlaskit-esm/web-resources/styled-components.js";
import { colors } from "/apps/websight-admin/web-resources/theme.js";
import ScheduleValueRow from "./ScheduleValueRow.js";
const SCHEDULE_ACTION_SELECT_INITIAL_WIDTH = 100;
const ScheduleActionContainer = styled.div`
    margin: 10px 0 10px 24px;
    padding-bottom: 4px
    border-bottom: 1px solid ${colors.veryLightGrey};
`;
const ScheduleBasicInfoContainer = styled.div`
    display: flex;
    align-items: flex-start;
`;
const ScheduleActionSelectContainer = styled.div`
    flex: 0 0 ${SCHEDULE_ACTION_SELECT_INITIAL_WIDTH}px;
`;
const SchedulesFirstValueContainer = styled.div`
    width: 100%;
`;
const SchedulesNextValuesContainer = styled.div`
    margin-left: ${SCHEDULE_ACTION_SELECT_INITIAL_WIDTH}px;
`;
const SchedulesOptions = styled.div`
    margin-left: ${SCHEDULE_ACTION_SELECT_INITIAL_WIDTH + 15}px;
    display: flex;
    align-items: center;
`;
const ActionSuspendedInfo = styled.div`
    display: flex;
`;
const ActionSuspendInfoText = styled.p`
    padding: 0;
    font-size: smaller;
    margin: 4px 0px 0px 4px;
`;
const ActionSuspendedIcon = styled.i`
    font-size: 21px;
    color: ${colors.yellow};
`;
const SCHEDULE_ACTION_TYPES = [{
  value: 'BUILD',
  label: 'Build'
}, {
  value: 'INSTALL',
  label: 'Install'
}, {
  value: 'UNINSTALL',
  label: 'Uninstall'
}, {
  value: 'DELETE',
  label: 'Delete'
}];

const SchedulePackageActionRow = props => {
  const {
    scheduleAction
  } = props;
  const schedules = scheduleAction && scheduleAction.schedules || [];
  return /*#__PURE__*/React.createElement(ScheduleActionContainer, null, /*#__PURE__*/React.createElement(ScheduleBasicInfoContainer, null, /*#__PURE__*/React.createElement(ScheduleActionSelectContainer, null, /*#__PURE__*/React.createElement(Select, {
    className: "single-select",
    classNamePrefix: "react-select",
    spacing: "compact",
    isDisabled: !!scheduleAction.id,
    isRequired: true,
    options: SCHEDULE_ACTION_TYPES,
    placeholder: "Select Action",
    menuPortalTarget: document.body,
    styles: {
      container: base => ({ ...base,
        paddingBottom: '10px'
      }),
      menuPortal: base => ({ ...base,
        zIndex: 9999
      })
    },
    value: SCHEDULE_ACTION_TYPES.find(({
      value
    }) => value === scheduleAction.action),
    onChange: newScheduleAction => props.updateScheduleAction(newScheduleAction.value)
  })), schedules && schedules.length > 0 && /*#__PURE__*/React.createElement(SchedulesFirstValueContainer, null, /*#__PURE__*/React.createElement(ScheduleValueRow, {
    update: updatedSchedule => props.updateSchedule(updatedSchedule, 0),
    delete: () => props.deleteSchedule(0),
    schedule: schedules[0],
    serverDateTimeOffset: props.serverDateTimeOffset
  }))), schedules && schedules.length > 1 && /*#__PURE__*/React.createElement(SchedulesNextValuesContainer, null, schedules.map((schedule, index) => {
    if (index !== 0) {
      return /*#__PURE__*/React.createElement(ScheduleValueRow, {
        key: index,
        update: updatedSchedule => props.updateSchedule(updatedSchedule, index),
        delete: () => props.deleteSchedule(index),
        serverDateTimeOffset: props.serverDateTimeOffset,
        schedule: schedule
      });
    }
  })), /*#__PURE__*/React.createElement(SchedulesOptions, null, /*#__PURE__*/React.createElement(Button, {
    onClick: props.addSchedule
  }, "Add Schedule"), /*#__PURE__*/React.createElement(Button, {
    style: {
      margin: '0 15px'
    },
    onClick: () => props.setSuspendingScheduleAction(!scheduleAction.suspended)
  }, scheduleAction.suspended ? 'Resume all' : 'Suspend all'), scheduleAction.suspended && /*#__PURE__*/React.createElement(ActionSuspendedInfo, null, /*#__PURE__*/React.createElement(ActionSuspendedIcon, {
    className: "material-icons"
  }, "warning"), /*#__PURE__*/React.createElement(ActionSuspendInfoText, null, "Action suspended"))));
};

export default SchedulePackageActionRow;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy