We need to start using `undefined` as the default state for when a value has not been defined. Previously we had used things like `’’` for string typed values. But this causes problems later when generating the request we send to image-builder. Using `undefined` is explicit and will make generating the requests much easier (as we don’t need to check for `’’`, determine the intent, and convert it to undefined if necessary). Explicit is better than implicit. With that in mind, tests have been added to ensure that the correct request is sent to the API for every option on the Registration step. This is facilitated using a new `spyOnRequest()` function. In the future, we will have similar tests for the rest of the steps. A few other minor things: 1. We need to get the `store` using `useStore()` for when we later call `store.getState()` because the tests use a different store that is configured in the renderer than the one we were importing. 2. In the wizardSlice, a new type RegistrationType is added that provides additional type safety instead of using `string`.
138 lines
3.9 KiB
JavaScript
138 lines
3.9 KiB
JavaScript
export const IMAGE_BUILDER_API = '/api/image-builder/v1';
|
|
export const RHSM_API = '/api/rhsm/v2';
|
|
export const EDGE_API = '/api/edge/v1';
|
|
export const CONTENT_SOURCES_API = '/api/content-sources/v1';
|
|
export const PROVISIONING_API = '/api/provisioning/v1';
|
|
export const RHEL_8 = 'rhel-89';
|
|
export const RHEL_9 = 'rhel-93';
|
|
export const CENTOS_8 = 'centos-8';
|
|
export const CENTOS_9 = 'centos-9';
|
|
export const X86_64 = 'x86_64';
|
|
export const AARCH64 = 'aarch64';
|
|
|
|
export const CREATE_BLUEPRINT = `${IMAGE_BUILDER_API}/experimental/blueprints`;
|
|
|
|
export const UNIT_KIB = 1024 ** 1;
|
|
export const UNIT_MIB = 1024 ** 2;
|
|
export const UNIT_GIB = 1024 ** 3;
|
|
|
|
// Use a Map() to ensure order is preserved (order is not gauranteed by an Object())
|
|
export const RELEASES = new Map([
|
|
[RHEL_9, 'Red Hat Enterprise Linux (RHEL) 9'],
|
|
[RHEL_8, 'Red Hat Enterprise Linux (RHEL) 8'],
|
|
[CENTOS_9, 'CentOS Stream 9'],
|
|
[CENTOS_8, 'CentOS Stream 8'],
|
|
]);
|
|
|
|
export const RHEL_9_FULL_SUPPORT = ['2022-05-18', '2027-05-31'];
|
|
export const RHEL_8_FULL_SUPPORT = ['2019-05-07', '2024-05-31'];
|
|
export const RHEL_9_MAINTENANCE_SUPPORT = ['2027-05-31', '2032-05-31'];
|
|
export const RHEL_8_MAINTENANCE_SUPPORT = ['2024-05-31', '2029-05-31'];
|
|
|
|
export const ARCHS = [X86_64, AARCH64];
|
|
|
|
export const DEFAULT_AWS_REGION = 'us-east-1';
|
|
|
|
// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
|
|
export const AWS_REGIONS = [
|
|
{ description: 'US East (Ohio)', value: 'us-east-2', disableRegion: false },
|
|
{
|
|
description: 'US East (N. Virginia)',
|
|
value: 'us-east-1',
|
|
// disable default region
|
|
disableRegion: true,
|
|
},
|
|
{
|
|
description: 'US West (N. California)',
|
|
value: 'us-west-1',
|
|
disableRegion: false,
|
|
},
|
|
{ description: 'US West (Oregon)', value: 'us-west-2', disableRegion: false },
|
|
{
|
|
description: 'Africa (Cape Town)',
|
|
value: 'af-south-1',
|
|
disableRegion: true,
|
|
},
|
|
{
|
|
description: 'Asia Pacific (Hong Kong)',
|
|
value: 'ap-east-1',
|
|
disableRegion: true,
|
|
},
|
|
{
|
|
description: 'Asia Pacific (Jakarta)',
|
|
value: 'ap-southeast-3',
|
|
disableRegion: true,
|
|
},
|
|
{
|
|
description: 'Asia Pacific (Mumbai)',
|
|
value: 'ap-south-1',
|
|
disableRegion: false,
|
|
},
|
|
{
|
|
description: 'Asia Pacific (Osaka)',
|
|
value: 'ap-northeast-3',
|
|
disableRegion: false,
|
|
},
|
|
{
|
|
description: 'Asia Pacific (Seoul)',
|
|
value: 'ap-northeast-2',
|
|
disableRegion: false,
|
|
},
|
|
{
|
|
description: 'Asia Pacific (Singapore)',
|
|
value: 'ap-southeast-1',
|
|
disableRegion: false,
|
|
},
|
|
{
|
|
description: 'Asia Pacific (Sydney)',
|
|
value: 'ap-southeast-2',
|
|
disableRegion: false,
|
|
},
|
|
{
|
|
description: 'Asia Pacific (Tokyo)',
|
|
value: 'ap-northeast-1',
|
|
disableRegion: false,
|
|
},
|
|
{
|
|
description: 'Canada (Central)',
|
|
value: 'ca-central-1',
|
|
disableRegion: false,
|
|
},
|
|
{
|
|
description: 'Europe (Frankfurt)',
|
|
value: 'eu-central-1',
|
|
disableRegion: false,
|
|
},
|
|
{ description: 'Europe (Ireland)', value: 'eu-west-1', disableRegion: false },
|
|
{ description: 'Europe (London)', value: 'eu-west-2', disableRegion: false },
|
|
{ description: 'Europe (Milan)', value: 'eu-south-1', disableRegion: true },
|
|
{ description: 'Europe (Paris)', value: 'eu-west-3', disableRegion: false },
|
|
{
|
|
description: 'Europe (Stockholm)',
|
|
value: 'eu-north-1',
|
|
disableRegion: false,
|
|
},
|
|
{
|
|
description: 'Middle East (Bahrain)',
|
|
value: 'me-south-1',
|
|
disableRegion: true,
|
|
},
|
|
{
|
|
description: 'Middle East (UAE)',
|
|
value: 'me-central-1',
|
|
disableRegion: true,
|
|
},
|
|
{
|
|
description: 'South America (S\u00e3o Paolo)',
|
|
value: 'sa-east-1',
|
|
disableRegion: false,
|
|
},
|
|
];
|
|
|
|
export const AWS_S3_EXPIRATION_TIME_IN_HOURS = 6;
|
|
export const OCI_STORAGE_EXPIRATION_TIME_IN_DAYS = 7;
|
|
|
|
// Anchor element for all modals that we display so that they play nice with top-most components like Quickstarts
|
|
export const MODAL_ANCHOR = '.pf-c-page.chr-c-page';
|
|
|
|
export const STATUS_POLLING_INTERVAL = 8000;
|