Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/hotosm/fmtm into dev…
Browse files Browse the repository at this point in the history
…elopment
  • Loading branch information
spwoodcock committed Dec 6, 2024
2 parents 6a5f3de + ea196ee commit bc51568
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 48 deletions.
6 changes: 3 additions & 3 deletions src/backend/app/organisations/organisation_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ async def get_org_odk_creds(
)

return central_schemas.ODKCentralDecrypted(
odk_central_url=org.odk_central_url,
odk_central_user=org.odk_central_user,
odk_central_password=org.odk_central_password,
odk_central_url=url,
odk_central_user=user,
odk_central_password=password,
)


Expand Down
12 changes: 4 additions & 8 deletions src/backend/app/organisations/organisation_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,16 @@ def parse_organisation_input(
The parsed data is returned as an OrganisationIn instance, with the
ODKCentralIn fields merged in.
"""
odk_central_data = ODKCentralIn(
odk_central_url=odk_central_url,
odk_central_user=odk_central_user,
odk_central_password=odk_central_password,
)
org_data = OrganisationUpdate(
return OrganisationUpdate(
name=name,
slug=slug,
created_by=created_by,
community_type=community_type,
type=type,
**odk_central_data.dict(exclude_unset=True),
odk_central_url=odk_central_url,
odk_central_user=odk_central_user,
odk_central_password=odk_central_password,
)
return org_data


class OrganisationOut(BaseModel):
Expand Down
1 change: 1 addition & 0 deletions src/backend/app/projects/project_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ class ProjectSummary(BaseModel):
tasks_mapped: Optional[int] = None
tasks_validated: Optional[int] = None
tasks_bad: Optional[int] = None
organisation_logo: Optional[str] = None


class PaginationInfo(BaseModel):
Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/api/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const ProjectById = (projectId: string) => {
custom_tms_url: projectResp?.custom_tms_url,
organisation_id: projectResp?.organisation_id,
organisation_logo: projectResp?.organisation_logo,
organisation_name: projectResp?.organisation_name,
created_at: projectResp?.created_at,
}),
);
Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/api/Submission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { SubmissionActions } from '@/store/slices/SubmissionSlice';

export const SubmissionService: Function = (url: string) => {
return async (dispatch) => {
dispatch(SubmissionActions.SetSubmissionDetails(null));
dispatch(SubmissionActions.SetSubmissionDetailsLoading(true));
const getSubmissionDetails = async (url: string) => {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const ProjectInfo: React.FC = () => {
alt="Organization Photo"
/>
</div>
<p>{projectInfo?.organisation_name}</p>
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ const SubmissionsTable = ({ toggleView }) => {
headerClassName="updatedHeader !fmtm-sticky fmtm-right-0 fmtm-shadow-[-10px_0px_20px_0px_rgba(0,0,0,0.1)] fmtm-text-center"
rowClassName="updatedRow !fmtm-sticky fmtm-right-0 fmtm-bg-white fmtm-shadow-[-10px_0px_20px_0px_rgba(0,0,0,0.1)]"
dataFormat={(row) => {
const taskUid = taskList?.find((task) => task?.id == row?.task_id)?.id;
const taskUid = taskList?.find((task) => task?.index == row?.task_id)?.id;
return (
<div className="fmtm-w-[5rem] fmtm-overflow-hidden fmtm-truncate fmtm-text-center">
<Link to={`/project-submissions/${projectId}/tasks/${taskUid}/submission/${row?.meta?.instanceID}`}>
Expand Down
45 changes: 9 additions & 36 deletions src/frontend/src/components/createnewproject/UploadArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ const uploadAreaOptions = [
},
];

const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpload }) => {
const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpload, setAdditionalFeature }) => {
useDocumentTitle('Create Project: Upload Area');

const dispatch = useDispatch();
const navigate = useNavigate();
// const [uploadAreaFile, setUploadAreaFile] = useState(null);
const [isGeojsonWGS84, setIsGeojsonWG84] = useState(true);

const projectDetails = useAppSelector((state) => state.createproject.projectDetails);
Expand Down Expand Up @@ -66,13 +66,15 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpl
navigate('/upload-survey');
dispatch(CreateProjectActions.SetToggleSplittedGeojsonEdit(false));
};

const {
handleSubmit,
handleCustomChange,
values: formValues,
errors,
}: any = useForm(projectDetails, submission, UploadAreaValidation);
const toggleStep = (step, url) => {

const toggleStep = (step: number, url: string) => {
dispatch(CommonActions.SetCurrentStepFormStep({ flag: flag, step: step }));
navigate(url);
dispatch(CreateProjectActions.SetToggleSplittedGeojsonEdit(false));
Expand Down Expand Up @@ -168,11 +170,14 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpl

const resetFile = () => {
setGeojsonFile(null);
setCustomDataExtractUpload(null);
handleCustomChange('uploadedAreaFile', null);
handleCustomChange('drawnGeojson', null);
setAdditionalFeature(null);
dispatch(CreateProjectActions.SetDrawnGeojson(null));
dispatch(CreateProjectActions.SetTotalAreaSelection(null));
dispatch(CreateProjectActions.ClearProjectStepState(formValues));
dispatch(CreateProjectActions.SetAdditionalFeatureGeojson(null));
dispatch(CreateProjectActions.ClearProjectStepState({ ...formValues, uploadedAreaFile: null, drawnGeojson: null }));
};

useEffect(() => {
Expand Down Expand Up @@ -279,38 +284,6 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpl
btnText="Upload a Geojson"
errorMsg={errors.uploadedAreaFile}
/>
// <div className="fmtm-mt-5 fmtm-pb-3">
// <div className="fmtm-flex fmtm-items-center fmtm-gap-4">
// <label
// id="file-input"
// className="fmtm-bg-primaryRed fmtm-text-white fmtm-px-4 fmtm-py-1 fmtm-rounded-md fmtm-cursor-pointer"
// >
// <p>Select a file</p>
// <input
// id="upload-area-geojson-file"
// ref={geojsonFileRef}
// type="file"
// className="fmtm-hidden"
// onChange={changeFileHandler}
// accept=".geojson, .json"
// />
// </label>
// <div className="fmtm-rounded-full fmtm-p-1 hover:fmtm-bg-slate-100 fmtm-duration-300 fmtm-cursor-pointer">
// <AssetModules.ReplayIcon className="fmtm-text-gray-600" onClick={() => resetFile()} />
// </div>
// </div>
// {geojsonFile && (
// <div className="fmtm-mt-2">
// <p>{geojsonFile?.name}</p>
// </div>
// )}
// <p className="fmtm-text-gray-700 fmtm-mt-3">
// *The supported file formats are zipped shapefile, geojson or kml files.
// </p>
// <p className="fmtm-text-gray-700 fmtm-pt-8">
// Total Area: <span className="fmtm-font-bold">234 sq.km</span>
// </p>
// </div>
)}
</div>
<div className="fmtm-flex fmtm-gap-5 fmtm-mx-auto fmtm-mt-10 fmtm-my-5">
Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/models/project/projectModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export type projectInfoType = {
total_tasks: any;
organisation_id: number;
organisation_logo: string;
organisation_name: string;
instructions: string;
custom_tms_url: string;
created_at: string;
Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/views/CreateNewProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const CreateNewProject = () => {
geojsonFile={geojsonFile}
setGeojsonFile={setGeojsonFile}
setCustomDataExtractUpload={setCustomDataExtractUpload}
setAdditionalFeature={setAdditionalFeature}
/>
);
case '/upload-survey':
Expand Down

0 comments on commit bc51568

Please sign in to comment.