import * as React from 'react';

import { FormContainer, SelectField } from '@waldur/form-react';
import { translate } from '@waldur/i18n';

export const OpenStackPluginOptionsForm = ({ container, locale }) => {
  const STORAGE_MODE_OPTIONS = React.useMemo(
    () => [
      {
        label: translate('Fixed — use common storage quota'),
        value: 'fixed',
      },
      {
        label: translate(
          'Dynamic — use separate volume types for tracking pricing',
        ),
        value: 'dynamic',
      },
    ],
    locale,
  );

  return (
    <FormContainer {...container}>
      <SelectField
        name="storage_mode"
        label={translate('Storage mode')}
        options={STORAGE_MODE_OPTIONS}
        simpleValue={true}
        required={true}
        description={translate(
          'Offering needs to be saved before pricing for dynamic components could be set.',
        )}
      />
    </FormContainer>
  );
};

import * as React from 'react';

import { FormContainer, SelectField, NumberField } from '@waldur/form-react';
import { translate } from '@waldur/i18n';

export const OpenStackPluginOptionsForm = ({ container }) => {
  const STORAGE_MODE_OPTIONS = React.useMemo(
    () => [
      {
        label: translate('Fixed — use common storage quota'),
        value: 'fixed',
      },
      {
        label: translate(
          'Dynamic — use separate volume types for tracking pricing',
        ),
        value: 'dynamic',
      },
    ],
    [],
  );

  return (
    <FormContainer {...container}>
      <SelectField
        name="storage_mode"
        label={translate('Storage mode')}
        options={STORAGE_MODE_OPTIONS}
        simpleValue={true}
        required={true}
        description={translate(
          'Offering needs to be saved before pricing for dynamic components could be set.',
        )}
      />
      <NumberField
        name="snapshot_size_limit_gb"
        label={translate('Snapshot size limit')}
        unit="GB"
      />
    </FormContainer>
  );
};

Introduce snapshot size limit as plugin option for OpenStack offering
Introduce snapshot size limit as plugin option for OpenStack offering [WAL-2936]
