From 06c13a966837458b7160f4d79043bc2f4df5df60 Mon Sep 17 00:00:00 2001
From: Bryttanie <28575816+xbhouse@users.noreply.github.com>
Date: Wed, 17 Jan 2024 10:24:53 -0500
Subject: [PATCH] Fixes 3336: expose module_hotfixes flag as checkbox for repo
(#196)
* Fixes 3336: expose module_hotfixes flag as checkbox for repo
* clarification in tooltips
* added ouiaid
* change tooltip to selecting
---
.../components/AddContent/AddContent.tsx | 22 +++++++++++++++++++
.../components/AddContent/helpers.test.ts | 2 ++
.../components/AddContent/helpers.ts | 5 ++++-
.../EditContentModal/EditContentForm.tsx | 22 +++++++++++++++++++
.../EditContentModal/helpers.test.ts | 4 ++++
.../components/EditContentModal/helpers.ts | 6 ++++-
src/services/Content/ContentApi.ts | 3 +++
src/testingHelpers.tsx | 2 ++
8 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/src/Pages/ContentListTable/components/AddContent/AddContent.tsx b/src/Pages/ContentListTable/components/AddContent/AddContent.tsx
index eb2f76da..75b84722 100644
--- a/src/Pages/ContentListTable/components/AddContent/AddContent.tsx
+++ b/src/Pages/ContentListTable/components/AddContent/AddContent.tsx
@@ -480,6 +480,7 @@ const AddContent = () => {
gpgLoading,
metadataVerification,
snapshot,
+ moduleHotfixesEnabled
},
index,
) => (
@@ -651,6 +652,27 @@ const AddContent = () => {
setSelected={(value) => setVersionSelected(value, index)}
/>
+
+ {
+ updateVariable(index, { moduleHotfixesEnabled: !moduleHotfixesEnabled });
+ }}
+ />
+
+
+
+
{
expanded: false,
metadataVerification: false,
snapshot: true,
+ moduleHotfixesEnabled: false
},
];
@@ -47,6 +48,7 @@ it('mapFormikToAPIValues', () => {
gpg_key: '',
metadata_verification: false,
snapshot: true,
+ module_hotfixes: false
},
];
diff --git a/src/Pages/ContentListTable/components/AddContent/helpers.ts b/src/Pages/ContentListTable/components/AddContent/helpers.ts
index 364dba11..d4384173 100644
--- a/src/Pages/ContentListTable/components/AddContent/helpers.ts
+++ b/src/Pages/ContentListTable/components/AddContent/helpers.ts
@@ -33,6 +33,7 @@ export interface FormikValues {
metadataVerification: boolean;
expanded: boolean;
snapshot: boolean;
+ moduleHotfixesEnabled: boolean;
}
export const getDefaultFormikValues = (overrides: Partial = {}): FormikValues => ({
@@ -45,6 +46,7 @@ export const getDefaultFormikValues = (overrides: Partial = {}): F
expanded: true,
metadataVerification: false,
snapshot: false,
+ moduleHotfixesEnabled: false,
...overrides,
});
@@ -58,7 +60,7 @@ export const isValidURL = (val: string) => {
};
export const mapFormikToAPIValues = (formikValues: FormikValues[]) =>
- formikValues.map(({ name, url, arch, versions, gpgKey, metadataVerification, snapshot }) => ({
+ formikValues.map(({ name, url, arch, versions, gpgKey, metadataVerification, snapshot, moduleHotfixesEnabled }) => ({
name,
url,
distribution_arch: arch,
@@ -66,6 +68,7 @@ export const mapFormikToAPIValues = (formikValues: FormikValues[]) =>
gpg_key: gpgKey,
snapshot,
metadata_verification: metadataVerification,
+ module_hotfixes: moduleHotfixesEnabled,
}));
const mapNoMetaDataError = (validationData: ValidationResponse) =>
diff --git a/src/Pages/ContentListTable/components/EditContentModal/EditContentForm.tsx b/src/Pages/ContentListTable/components/EditContentModal/EditContentForm.tsx
index 226ad935..6b5574a6 100644
--- a/src/Pages/ContentListTable/components/EditContentModal/EditContentForm.tsx
+++ b/src/Pages/ContentListTable/components/EditContentModal/EditContentForm.tsx
@@ -365,6 +365,7 @@ const EditContentForm = ({
gpgLoading,
metadataVerification,
snapshot,
+ moduleHotfixesEnabled,
},
index,
) => (
@@ -522,6 +523,27 @@ const EditContentForm = ({
setSelected={(value) => setVersionSelected(value, index)}
/>
+
+ {
+ updateVariable(index, { moduleHotfixesEnabled: !moduleHotfixesEnabled });
+ }}
+ />
+
+
+
+
{
uuid: 'stuff',
metadataVerification: false,
snapshot: false,
+ moduleHotfixesEnabled: false,
},
];
@@ -27,6 +28,7 @@ it('mapFormikToEditAPIValues', () => {
uuid: 'stuff',
snapshot: false,
metadata_verification: false,
+ module_hotfixes: false,
},
];
@@ -51,6 +53,7 @@ it('mapToDefaultFormikValues', () => {
gpg_key: 'stuffAndThings',
metadata_verification: false,
snapshot: false,
+ module_hotfixes: false,
},
];
const mapped = [
@@ -65,6 +68,7 @@ it('mapToDefaultFormikValues', () => {
metadataVerification: false,
expanded: true,
uuid: 'stuffAndThings',
+ moduleHotfixesEnabled: false,
},
];
diff --git a/src/Pages/ContentListTable/components/EditContentModal/helpers.ts b/src/Pages/ContentListTable/components/EditContentModal/helpers.ts
index 581b5371..0ec15308 100644
--- a/src/Pages/ContentListTable/components/EditContentModal/helpers.ts
+++ b/src/Pages/ContentListTable/components/EditContentModal/helpers.ts
@@ -11,11 +11,12 @@ export interface FormikEditValues {
expanded: boolean;
uuid: string;
snapshot: boolean;
+ moduleHotfixesEnabled: boolean;
}
export const mapFormikToEditAPIValues = (formikValues: FormikEditValues[]): EditContentRequest =>
formikValues.map(
- ({ name, url, arch, versions, gpgKey, metadataVerification, uuid, snapshot }) => ({
+ ({ name, url, arch, versions, gpgKey, metadataVerification, uuid, snapshot, moduleHotfixesEnabled }) => ({
uuid,
name,
url,
@@ -24,6 +25,7 @@ export const mapFormikToEditAPIValues = (formikValues: FormikEditValues[]): Edit
gpg_key: gpgKey,
metadata_verification: metadataVerification,
snapshot,
+ module_hotfixes: moduleHotfixesEnabled,
}),
);
@@ -39,6 +41,7 @@ export const mapToDefaultFormikValues = (values: ContentItem[]): FormikEditValue
gpg_key: gpgKey,
metadata_verification: metadataVerification,
snapshot,
+ module_hotfixes: moduleHotfixesEnabled,
},
index,
) => ({
@@ -52,6 +55,7 @@ export const mapToDefaultFormikValues = (values: ContentItem[]): FormikEditValue
expanded: index + 1 === values.length,
uuid,
snapshot,
+ moduleHotfixesEnabled,
}),
);
diff --git a/src/services/Content/ContentApi.ts b/src/services/Content/ContentApi.ts
index 023b238e..152f0d7c 100644
--- a/src/services/Content/ContentApi.ts
+++ b/src/services/Content/ContentApi.ts
@@ -18,6 +18,7 @@ export interface ContentItem {
snapshot: boolean;
last_snapshot_uuid?: string;
last_snapshot?: SnapshotItem;
+ module_hotfixes: boolean;
}
export interface PopularRepository {
@@ -39,6 +40,7 @@ export interface CreateContentRequestItem {
gpg_key?: string;
metadata_verification?: boolean;
snapshot?: boolean;
+ module_hotfixes?: boolean;
}
export interface ErrorItem {
@@ -64,6 +66,7 @@ export interface EditContentRequestItem {
gpg_key: string;
metadata_verification: boolean;
snapshot: boolean;
+ module_hotfixes: boolean;
}
export type EditContentRequest = Array;
diff --git a/src/testingHelpers.tsx b/src/testingHelpers.tsx
index 63ddb675..eaa753d0 100644
--- a/src/testingHelpers.tsx
+++ b/src/testingHelpers.tsx
@@ -144,6 +144,7 @@ export const defaultContentItem: ContentItem = {
failed_introspections_count: 0,
metadata_verification: false,
snapshot: false,
+ module_hotfixes: false,
};
export const defaultIntrospectTask: AdminTask = {
@@ -227,4 +228,5 @@ export const defaultContentItemWithSnapshot: ContentItem = {
metadata_verification: false,
snapshot: true,
last_snapshot: defaultSnapshotItem,
+ module_hotfixes: false,
};