Skip to content

Commit

Permalink
Minor improvements and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolea PLESCO authored and Kolea PLESCO committed Dec 19, 2024
1 parent b33e5ca commit 0d84746
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ async def route_search_structural_elements_versioned_view_by_eforms_version(
status_code=status.HTTP_201_CREATED
)
async def route_task_import_eforms_xsd(
github_repository_url: str = Form(...),
github_repository_url: str = Form(default=None),
branch_or_tag_name: str = Form(...),
project_id: PydanticObjectId = Form(...),
user: User = Depends(current_active_user)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def route_import_package_archive(
user: User = Depends(current_active_user)
):
imported_mapping_package: ImportedMappingSuiteResponse = await import_mapping_package_from_archive(
file.file.read(), await get_project(project), package_type, user
file.file.read(), await get_project(project), package_type, False, user
)

return imported_mapping_package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ async def import_mapping_package(
package_type: PackageType, user: User = None,
task_response: TaskResponse = None
) -> ImportedMappingSuiteResponse:

MappingPackageStructureValidator(mapping_package_dir_path).validate()

if package_type == PackageType.STANDARD:
Expand Down Expand Up @@ -62,7 +61,9 @@ async def import_and_process_mapping_package_from_archive(
) -> ImportedMappingSuiteResponse:
if not task_response:
task_response = TaskResponse()
result = await import_mapping_package_from_archive(file_content, project, package_type, cleanup_project, user, task_response)
result = await import_mapping_package_from_archive(
file_content, project, package_type, cleanup_project, user, task_response
)

await process_mapping_package(
package_id=result.mapping_package.id,
Expand All @@ -75,7 +76,8 @@ async def import_and_process_mapping_package_from_archive(

async def import_mapping_package_from_archive(
file_content: bytes, project: Project, package_type: PackageType,
cleanup_project: bool = False, user: User = None,
cleanup_project: bool = False,
user: User = None,
task_response: TaskResponse = None
) -> ImportedMappingSuiteResponse:
if not task_response:
Expand All @@ -84,7 +86,7 @@ async def import_mapping_package_from_archive(
tempdir = tempfile.TemporaryDirectory()
tempdir_name = tempdir.name
tempdir_path = pathlib.Path(tempdir_name)
zf.extractall(tempdir_name) # NOSONAR
zf.extractall(tempdir_name) # NOSONAR
dir_contents = list(tempdir_path.iterdir())
try:
assert len(dir_contents) == 1, "Archive must contain only the package folder!"
Expand Down
3 changes: 2 additions & 1 deletion mapping_workbench/frontend/src/api/mapping-packages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export const PACKAGE_TYPE = {
EFORMS: 'eForms', STANDARD: 'Standard'
};

export const DEFAULT_PACKAGE_TYPE = "EFORMS";
export const EFORMS_PACKAGE_TYPE = "EFORMS";
export const DEFAULT_PACKAGE_TYPE = EFORMS_PACKAGE_TYPE;

class MappingPackagesApi extends SectionApi {
get SECTION_TITLE() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {toastError, toastLoad, toastSuccess} from "src/components/app-toast";
import Divider from "@mui/material/Divider";



export const PackageImporter = (props) => {
const {onClose, open = false, sectionApi} = props;

Expand Down Expand Up @@ -119,7 +118,7 @@ export const PackageImporter = (props) => {
<MenuItem key={key} value={key}>{PACKAGE_TYPE[key]}</MenuItem>
))}
</TextField>
<FormGroup sx={{ mb: 2}}>
<FormGroup sx={{mb: 2}}>
<Typography variant="h7" sx={{mb: 1}}>After Import</Typography>
<FormControlLabel
control={
Expand Down

0 comments on commit 0d84746

Please sign in to comment.