Skip to content

Commit e592065

Browse files
committed
src: Move customization options to constant
This moves `'disk' | 'fileSystem'` to a constant.
1 parent 4543f6e commit e592065

File tree

8 files changed

+28
-15
lines changed

8 files changed

+28
-15
lines changed

src/Components/CreateImageWizard/steps/FileSystem/components/MinimumSize.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ValidatedInputAndTextArea } from '../../../ValidatedInput';
1010
import {
1111
FilesystemPartition,
1212
LogicalVolumeWithBase,
13+
PartitioningCustomization,
1314
VolumeGroupWithExtendedLV,
1415
} from '../fscTypes';
1516

@@ -18,7 +19,7 @@ type MinimumSizePropTypes = {
1819
| FilesystemPartition
1920
| LogicalVolumeWithBase
2021
| VolumeGroupWithExtendedLV;
21-
customization: 'disk' | 'fileSystem';
22+
customization: PartitioningCustomization;
2223
};
2324

2425
const MinimumSize = ({ partition, customization }: MinimumSizePropTypes) => {

src/Components/CreateImageWizard/steps/FileSystem/components/MountpointPrefix.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010

1111
import { useAppDispatch } from '../../../../../store/hooks';
1212
import { changePartitionMountpoint } from '../../../../../store/wizardSlice';
13-
import { FilesystemPartition } from '../fscTypes';
13+
import { FilesystemPartition, PartitioningCustomization } from '../fscTypes';
1414
import { getPrefix, getSuffix } from '../fscUtilities';
1515

1616
export const mountpointPrefixes = [
@@ -27,7 +27,7 @@ export const mountpointPrefixes = [
2727

2828
type MountpointPrefixPropTypes = {
2929
partition: FilesystemPartition;
30-
customization: 'disk' | 'fileSystem';
30+
customization: PartitioningCustomization;
3131
};
3232

3333
const MountpointPrefix = ({

src/Components/CreateImageWizard/steps/FileSystem/components/MountpointSuffix.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { TextInput } from '@patternfly/react-core';
44

55
import { useAppDispatch } from '../../../../../store/hooks';
66
import { changePartitionMountpoint } from '../../../../../store/wizardSlice';
7-
import { FilesystemPartition } from '../fscTypes';
7+
import { FilesystemPartition, PartitioningCustomization } from '../fscTypes';
88
import { getPrefix, getSuffix, normalizeSuffix } from '../fscUtilities';
99

1010
type MountpointSuffixPropTypes = {
1111
partition: FilesystemPartition;
12-
customization: 'disk' | 'fileSystem';
12+
customization: PartitioningCustomization;
1313
};
1414

1515
const MountpointSuffix = ({

src/Components/CreateImageWizard/steps/FileSystem/components/PartitionName.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ import { VolumeGroup } from '../../../../../store/imageBuilderApi';
55
import { changePartitionName } from '../../../../../store/wizardSlice';
66
import { useFilesystemValidation } from '../../../utilities/useValidation';
77
import { ValidatedInputAndTextArea } from '../../../ValidatedInput';
8-
import { DiskPartitionBase, LogicalVolumeWithBase } from '../fscTypes';
8+
import {
9+
DiskPartitionBase,
10+
LogicalVolumeWithBase,
11+
PartitioningCustomization,
12+
} from '../fscTypes';
913

1014
type PartitionNamePropTypes = {
1115
partition: (VolumeGroup & DiskPartitionBase) | LogicalVolumeWithBase;
12-
customization: 'disk' | 'fileSystem';
16+
customization: PartitioningCustomization;
1317
};
1418

1519
const PartitionName = ({

src/Components/CreateImageWizard/steps/FileSystem/components/PartitionType.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ import {
1010

1111
import { useAppDispatch } from '../../../../../store/hooks';
1212
import { changePartitionType } from '../../../../../store/wizardSlice';
13-
import { FSType, LogicalVolumeWithBase } from '../fscTypes';
13+
import {
14+
FSType,
15+
LogicalVolumeWithBase,
16+
PartitioningCustomization,
17+
} from '../fscTypes';
1418

1519
const fs_types = ['ext4', 'xfs', 'vfat', 'swap'];
1620

1721
type PartitionTypePropTypes = {
1822
partition: LogicalVolumeWithBase;
19-
customization: 'disk' | 'fileSystem';
23+
customization: PartitioningCustomization;
2024
};
2125

2226
const PartitionType = ({

src/Components/CreateImageWizard/steps/FileSystem/components/SizeUnit.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
import {
1717
FilesystemPartition,
1818
LogicalVolumeWithBase,
19+
PartitioningCustomization,
1920
Units,
2021
VolumeGroupWithExtendedLV,
2122
} from '../fscTypes';
@@ -27,7 +28,7 @@ type SizeUnitPropTypes = {
2728
| FilesystemPartition
2829
| LogicalVolumeWithBase
2930
| VolumeGroupWithExtendedLV;
30-
customization: 'disk' | 'fileSystem';
31+
customization: PartitioningCustomization;
3132
};
3233

3334
const SizeUnit = ({ partition, customization }: SizeUnitPropTypes) => {

src/Components/CreateImageWizard/steps/FileSystem/fscTypes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {
55
Minsize,
66
} from '../../../../store/imageBuilderApi';
77

8+
export type PartitioningCustomization = 'disk' | 'fileSystem';
9+
810
export type FilesystemPartition = {
911
id: string;
1012
mountpoint: string;

src/store/wizardSlice.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import type {
2323
FilesystemPartition,
2424
FscDisk,
2525
FSType,
26+
PartitioningCustomization,
2627
Units,
2728
} from '../Components/CreateImageWizard/steps/FileSystem/fscTypes';
2829
import type {
@@ -805,7 +806,7 @@ export const wizardSlice = createSlice({
805806
action: PayloadAction<{
806807
id: string;
807808
mountpoint: string;
808-
customization: 'disk' | 'fileSystem';
809+
customization: PartitioningCustomization;
809810
}>,
810811
) => {
811812
const { id, mountpoint, customization } = action.payload;
@@ -839,7 +840,7 @@ export const wizardSlice = createSlice({
839840
action: PayloadAction<{
840841
id: string;
841842
unit: Units;
842-
customization: 'disk' | 'fileSystem';
843+
customization: PartitioningCustomization;
843844
}>,
844845
) => {
845846
const { id, unit, customization } = action.payload;
@@ -868,7 +869,7 @@ export const wizardSlice = createSlice({
868869
action: PayloadAction<{
869870
id: string;
870871
min_size: string;
871-
customization: 'disk' | 'fileSystem';
872+
customization: PartitioningCustomization;
872873
}>,
873874
) => {
874875
const { id, min_size, customization } = action.payload;
@@ -897,7 +898,7 @@ export const wizardSlice = createSlice({
897898
action: PayloadAction<{
898899
id: string;
899900
fs_type: FSType;
900-
customization: 'disk' | 'fileSystem';
901+
customization: PartitioningCustomization;
901902
}>,
902903
) => {
903904
const { id, fs_type, customization } = action.payload;
@@ -929,7 +930,7 @@ export const wizardSlice = createSlice({
929930
action: PayloadAction<{
930931
id: string;
931932
name: string;
932-
customization: 'disk' | 'fileSystem';
933+
customization: PartitioningCustomization;
933934
}>,
934935
) => {
935936
const { id, name, customization } = action.payload;

0 commit comments

Comments
 (0)