From 295fe391e6b2ab352438dfa8b9a9ee55279cc662 Mon Sep 17 00:00:00 2001 From: "shenan.quek" <77522687+sayoungestguy@users.noreply.github.com> Date: Tue, 3 Sep 2024 19:11:02 +0800 Subject: [PATCH] Activity Page Current & Past + Show Skill name instead of ID --- .../scaleup/web/rest/ActivityResource.java | 1 + src/main/resources/.h2.server.properties | 2 +- .../activity-invite-update.tsx | 2 +- .../activity/activity-delete-dialog.tsx | 4 +- .../app/entities/activity/activity-detail.tsx | 26 +- .../app/entities/activity/activity-update.tsx | 77 ++-- .../app/entities/activity/activity.reducer.ts | 10 +- .../webapp/app/entities/activity/activity.tsx | 329 ++++++++++++------ .../entities/skill/skill-delete-dialog.tsx | 4 +- .../app/entities/skill/skill-detail.tsx | 4 +- .../app/entities/skill/skill-reducer.spec.ts | 20 +- .../app/entities/skill/skill-update.tsx | 4 +- .../app/entities/skill/skill.reducer.ts | 10 +- src/main/webapp/app/entities/skill/skill.tsx | 6 +- .../password-reset/password-reset.reducer.ts | 7 +- src/main/webapp/app/modules/login/logout.tsx | 48 ++- 16 files changed, 342 insertions(+), 212 deletions(-) diff --git a/src/main/java/com/teamsixnus/scaleup/web/rest/ActivityResource.java b/src/main/java/com/teamsixnus/scaleup/web/rest/ActivityResource.java index de739de..e34f9f0 100644 --- a/src/main/java/com/teamsixnus/scaleup/web/rest/ActivityResource.java +++ b/src/main/java/com/teamsixnus/scaleup/web/rest/ActivityResource.java @@ -145,6 +145,7 @@ public ResponseEntity partialUpdateActivity( public ResponseEntity> getAllActivities(@org.springdoc.core.annotations.ParameterObject Pageable pageable) { log.debug("REST request to get a page of Activities"); Page page = activityService.findAllByCurrentUser(pageable); + // Page page = activityService.findAll(pageable); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); return ResponseEntity.ok().headers(headers).body(page.getContent()); } diff --git a/src/main/resources/.h2.server.properties b/src/main/resources/.h2.server.properties index 20cc246..73078b4 100644 --- a/src/main/resources/.h2.server.properties +++ b/src/main/resources/.h2.server.properties @@ -1,5 +1,5 @@ #H2 Server Properties -#Thu Aug 29 00:36:11 SGT 2024 +#Sun Sep 01 14:42:04 SGT 2024 0=JHipster H2 (Disk)|org.h2.Driver|jdbc\:h2\:file\:./target/h2db/db/scaleup|scaleup webSSL=false webAllowOthers=true diff --git a/src/main/webapp/app/entities/activity-invite/activity-invite-update.tsx b/src/main/webapp/app/entities/activity-invite/activity-invite-update.tsx index a0c0340..c2cb8c9 100644 --- a/src/main/webapp/app/entities/activity-invite/activity-invite-update.tsx +++ b/src/main/webapp/app/entities/activity-invite/activity-invite-update.tsx @@ -9,7 +9,7 @@ import { mapIdList } from 'app/shared/util/entity-utils'; import { useAppDispatch, useAppSelector } from 'app/config/store'; import { IActivity } from 'app/shared/model/activity.model'; -import { getEntities as getActivities } from 'app/entities/activity/activity.reducer'; +import { getAllActivity as getActivities } from 'app/entities/activity/activity.reducer'; import { IUserProfile } from 'app/shared/model/user-profile.model'; import { getEntities as getUserProfiles } from 'app/entities/user-profile/user-profile.reducer'; import { ICodeTables } from 'app/shared/model/code-tables.model'; diff --git a/src/main/webapp/app/entities/activity/activity-delete-dialog.tsx b/src/main/webapp/app/entities/activity/activity-delete-dialog.tsx index 2042a33..94d301e 100644 --- a/src/main/webapp/app/entities/activity/activity-delete-dialog.tsx +++ b/src/main/webapp/app/entities/activity/activity-delete-dialog.tsx @@ -5,7 +5,7 @@ import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { useAppDispatch, useAppSelector } from 'app/config/store'; -import { getEntity, deleteEntity } from './activity.reducer'; +import { getActivityById, deleteEntity } from './activity.reducer'; export const ActivityDeleteDialog = () => { const dispatch = useAppDispatch(); @@ -17,7 +17,7 @@ export const ActivityDeleteDialog = () => { const [loadModal, setLoadModal] = useState(false); useEffect(() => { - dispatch(getEntity(id)); + dispatch(getActivityById(id)); setLoadModal(true); }, []); diff --git a/src/main/webapp/app/entities/activity/activity-detail.tsx b/src/main/webapp/app/entities/activity/activity-detail.tsx index 4200e0b..0f951e8 100644 --- a/src/main/webapp/app/entities/activity/activity-detail.tsx +++ b/src/main/webapp/app/entities/activity/activity-detail.tsx @@ -7,7 +7,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { APP_DATE_FORMAT, APP_LOCAL_DATE_FORMAT } from 'app/config/constants'; import { useAppDispatch, useAppSelector } from 'app/config/store'; -import { getEntity } from './activity.reducer'; +import { getActivityById } from './activity.reducer'; export const ActivityDetail = () => { const dispatch = useAppDispatch(); @@ -15,7 +15,7 @@ export const ActivityDetail = () => { const { id } = useParams<'id'>(); useEffect(() => { - dispatch(getEntity(id)); + dispatch(getActivityById(id)); }, []); const activityEntity = useAppSelector(state => state.activity.entity); @@ -46,28 +46,6 @@ export const ActivityDetail = () => { Details
{activityEntity.details}
-
- Created By -
-
{activityEntity.createdBy}
-
- Created Date -
-
- {activityEntity.createdDate ? : null} -
-
- Last Modified By -
-
{activityEntity.lastModifiedBy}
-
- Last Modified Date -
-
- {activityEntity.lastModifiedDate ? ( - - ) : null} -
Creator Profile
{activityEntity.creatorProfile ? activityEntity.creatorProfile.id : ''}
Skill
diff --git a/src/main/webapp/app/entities/activity/activity-update.tsx b/src/main/webapp/app/entities/activity/activity-update.tsx index 1a71fbc..e5abbce 100644 --- a/src/main/webapp/app/entities/activity/activity-update.tsx +++ b/src/main/webapp/app/entities/activity/activity-update.tsx @@ -11,9 +11,10 @@ import { useAppDispatch, useAppSelector } from 'app/config/store'; import { IUserProfile } from 'app/shared/model/user-profile.model'; import { getEntities as getUserProfiles } from 'app/entities/user-profile/user-profile.reducer'; import { ISkill } from 'app/shared/model/skill.model'; -import { getEntities as getSkills } from 'app/entities/skill/skill.reducer'; +import { getAllSkills as getSkills } from 'app/entities/skill/skill.reducer'; import { IActivity } from 'app/shared/model/activity.model'; -import { getEntity, updateEntity, createEntity, reset } from './activity.reducer'; +import { getActivityById, updateEntity, createEntity, reset } from './activity.reducer'; +import { min } from 'lodash'; export const ActivityUpdate = () => { const dispatch = useAppDispatch(); @@ -36,7 +37,7 @@ export const ActivityUpdate = () => { useEffect(() => { if (!isNew) { - dispatch(getEntity(id)); + dispatch(getActivityById(id)); } dispatch(getUserProfiles({})); @@ -96,7 +97,7 @@ export const ActivityUpdate = () => {

- Create or edit a Activity + {isNew ? 'Create an Activity' : 'Edit an Activity'}

@@ -118,7 +119,22 @@ export const ActivityUpdate = () => { required: { value: true, message: 'This field is required.' }, }} /> - + Number.isInteger(Number(value)) || 'Value cannot be a decimal', + notNegative: value => value >= 0 || 'Value cannot be negative', + }, + }} + /> { data-cy="venue" type="text" validate={{ + required: { value: true, message: 'This field is required' }, + maxLength: { value: 255, message: 'This field cannot be longer than 255 characters.' }, + }} + /> + - - {/**/} - {/**/} - {/**/} - {/**/} - +