Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/routes/org.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ router.get("/stacks/:searchText?", asyncRouter(orgController.getAllStacks));
*/
router.post(
"/stacks",
validator("project"),
validator("stack"),
asyncRouter(orgController.createStack)
);

Expand Down
2 changes: 2 additions & 0 deletions api/src/validators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import destinationStackValidator from "./destination-stack.validator.js";
import affixValidator from "./affix.validator.js";
import affixConfirmationValidator from "./affix-confirmation.validator.js";
import fileformatConfirmationValidator from "./fileformat-confirmation.validator.js";
import stackValidator from "./stack.validator.js";

/**
* Middleware function that validates the request based on the specified route.
Expand All @@ -26,6 +27,7 @@ export default (route: string = "") =>
affix: affixValidator,
affix_confirmation_validator: affixConfirmationValidator,
fileformat_confirmation_validator: fileformatConfirmationValidator,
stack: stackValidator
};

const validator = appValidators[route as keyof typeof appValidators];
Expand Down
46 changes: 46 additions & 0 deletions api/src/validators/stack.validator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { checkSchema } from "express-validator";
import { VALIDATION_ERRORS } from "../constants/index.js";

/**
* Validates the stack data.
*
* @returns {Object} The validation schema for the stack data.
*/

export default checkSchema({
name: {
in: "body",
isString: {
errorMessage: VALIDATION_ERRORS.STRING_REQUIRED.replace("$", "Name"),
bail: true,
},
trim: true,
isLength: {
errorMessage: VALIDATION_ERRORS.LENGTH_LIMIT.replace("$", "Name"),
options: {
min: 1,
max: 255,
},
bail: true,
},
},
description: {
in: "body",
isString: {
errorMessage: VALIDATION_ERRORS.STRING_REQUIRED.replace(
"$",
"Description"
),
bail: true,
},
trim: true,
isLength: {
errorMessage: VALIDATION_ERRORS.LENGTH_LIMIT.replace("$", "Description"),
options: {
min: 1,
max: 512,
},
bail: true,
},
},
});
8 changes: 3 additions & 5 deletions ui/src/components/ContentMapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -373,18 +373,17 @@ const ContentMapper = forwardRef(({projectData}: ContentMapperComponentProps, re
handleOpenContentType();

};
if(isModalOpen){

if(isModalOpen || isDropDownChanged){
window.history.pushState(null, '', window.location.href);
}
window.history.pushState(null, '', window.location.href);
window.addEventListener('popstate',handlePopState);


return () => {
window.removeEventListener('popstate', handlePopState);
};

},[isModalOpen,newMigrationData]);
},[isModalOpen]);

// Method to fetch content types
const fetchContentTypes = async (searchText: string) => {
Expand Down Expand Up @@ -496,7 +495,6 @@ const ContentMapper = forwardRef(({projectData}: ContentMapperComponentProps, re

// Method to change the content type
const handleOpenContentType = async (i = 0) => {
if(isModalOpen) return;
if (isDropDownChanged) {
setIsModalOpen(true);
handleDropdownState();
Expand Down