-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add feedback detail component * fix: jwt expired time, project box, feedback table deletion reload * feat: feedback detail component * fix: auth service spec
- Loading branch information
Showing
14 changed files
with
247 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,27 +70,29 @@ npm run migration:run | |
|
||
## Environment Variables | ||
|
||
| Environment | Description | Default Value | | ||
| -------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------ | | ||
| JWT_SECRET | JWT secret | # required | | ||
| MYSQL_PRIMARY_URL | mysql url | mysql://userfeedback:userfeedback@localhost:13306/userfeedback | | ||
| MYSQL_SECONDARY_URLS | mysql sub urls (must be json array format) | ["mysql://userfeedback:userfeedback@localhost:13306/userfeedback"] | | ||
| SMTP_USE | flag for using smtp server (for email verification on creating user) | false | | ||
| SMTP_HOST | smtp server host | localhost | | ||
| SMTP_PORT | smtp server port | 25 | | ||
| SMTP_USERNAME | smtp auth username | | | ||
| SMTP_PASSWORD | smtp auth password | | | ||
| SMTP_SENDER | mail sender email | [email protected] | | ||
| SMTP_BASE_URL | default UserFeedback URL for mail to be redirected | http://localhost:3000 | | ||
| APP_PORT | the post that the server is running on | 4000 | | ||
| APP_ADDRESS | the address that the server is running on | 0.0.0.0 | | ||
| OS_USE | flag for using opensearch (for better performance on searching feedbacks) | false | | ||
| OS_NODE | opensearch node url | http://localhost:9200 | | ||
| OS_USERNAME | opensearch username if exists | | | ||
| OS_PASSWORD | opensearch password if exists | | | ||
| AUTO_MIGRATION | set 'true' if you want to make the database migration automatically | | | ||
| MASTER_API_KEY | set a key if you want to make a master key for creating feedback | | | ||
| NODE_OPTIONS | set some options if you want to add for node execution (e.g. max_old_space_size) | | | ||
| Environment | Description | Default Value | | ||
| ------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------ | | ||
| JWT_SECRET | JWT secret | # required | | ||
| MYSQL_PRIMARY_URL | mysql url | mysql://userfeedback:userfeedback@localhost:13306/userfeedback | | ||
| MYSQL_SECONDARY_URLS | mysql sub urls (must be json array format) | ["mysql://userfeedback:userfeedback@localhost:13306/userfeedback"] | | ||
| SMTP_USE | flag for using smtp server (for email verification on creating user) | false | | ||
| SMTP_HOST | smtp server host | localhost | | ||
| SMTP_PORT | smtp server port | 25 | | ||
| SMTP_USERNAME | smtp auth username | | | ||
| SMTP_PASSWORD | smtp auth password | | | ||
| SMTP_SENDER | mail sender email | [email protected] | | ||
| SMTP_BASE_URL | default UserFeedback URL for mail to be redirected | http://localhost:3000 | | ||
| APP_PORT | the post that the server is running on | 4000 | | ||
| APP_ADDRESS | the address that the server is running on | 0.0.0.0 | | ||
| OS_USE | flag for using opensearch (for better performance on searching feedbacks) | false | | ||
| OS_NODE | opensearch node url | http://localhost:9200 | | ||
| OS_USERNAME | opensearch username if exists | | | ||
| OS_PASSWORD | opensearch password if exists | | | ||
| AUTO_MIGRATION | set 'true' if you want to make the database migration automatically | | | ||
| MASTER_API_KEY | set a key if you want to make a master key for creating feedback | | | ||
| NODE_OPTIONS | set some options if you want to add for node execution (e.g. max_old_space_size) | | | ||
| ACCESS_TOKEN_EXPIRED_TIME | set expired time of access token | 10m | | ||
| REFESH_TOKEN_EXPIRED_TIME | set expired time of refresh token | 1h | | ||
|
||
## Swagger | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
apps/web/src/containers/tables/FeedbackTable/FeedbackDetail/FeedbackDetail.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
/** | ||
* Copyright 2023 LINE Corporation | ||
* | ||
* LINE Corporation licenses this file to you under the Apache License, | ||
* version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at: | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import { | ||
autoUpdate, | ||
FloatingFocusManager, | ||
FloatingOverlay, | ||
FloatingPortal, | ||
useClick, | ||
useDismiss, | ||
useFloating, | ||
useInteractions, | ||
useRole, | ||
} from '@floating-ui/react'; | ||
import dayjs from 'dayjs'; | ||
|
||
import { Badge, Icon } from '@ufb/ui'; | ||
|
||
import { DATE_TIME_FORMAT } from '@/constants/dayjs-format'; | ||
import { getStatusColor } from '@/constants/issues'; | ||
import { useFeedbackSearch, useOAIQuery } from '@/hooks'; | ||
import type { FieldType } from '@/types/field.type'; | ||
import type { IssueType } from '@/types/issue.type'; | ||
|
||
interface IProps { | ||
id: number; | ||
projectId: number; | ||
channelId: number; | ||
open: boolean; | ||
onOpenChange: (open: boolean) => void; | ||
} | ||
|
||
const FeedbackDetail: React.FC<IProps> = (props) => { | ||
const { channelId, id, projectId, onOpenChange, open } = props; | ||
const { data } = useFeedbackSearch(projectId, channelId, { | ||
query: { ids: [id] }, | ||
}); | ||
const feedbackData = data?.items?.[0] ?? {}; | ||
|
||
const { data: channelData } = useOAIQuery({ | ||
path: '/api/projects/{projectId}/channels/{channelId}', | ||
variables: { channelId, projectId }, | ||
}); | ||
|
||
const { refs, context } = useFloating({ | ||
open, | ||
onOpenChange, | ||
whileElementsMounted: autoUpdate, | ||
}); | ||
const click = useClick(context); | ||
const dismiss = useDismiss(context); | ||
const role = useRole(context); | ||
|
||
const { getFloatingProps } = useInteractions([click, dismiss, role]); | ||
|
||
return ( | ||
<FloatingPortal> | ||
<FloatingFocusManager context={context} modal> | ||
<FloatingOverlay | ||
lockScroll={true} | ||
className="bg-dim" | ||
style={{ display: 'grid', placeItems: 'center', zIndex: 20 }} | ||
> | ||
<div | ||
className="bg-primary fixed right-0 top-0 h-screen w-[760px] overflow-auto" | ||
ref={refs.setFloating} | ||
{...getFloatingProps()} | ||
onClick={(e) => e.stopPropagation()} | ||
> | ||
<div className="overflow-y-auto p-10"> | ||
<div className="flex items-center"> | ||
<h1 className="font-20-bold flex-1">피드백 상세</h1> | ||
<button | ||
className="icon-btn icon-btn-tertiary icon-btn-md" | ||
onClick={() => context.onOpenChange(false)} | ||
> | ||
<Icon name="CloseCircleFill" size={20} /> | ||
</button> | ||
</div> | ||
<table className="border-separate border-spacing-y-5"> | ||
<colgroup> | ||
<col style={{ minWidth: 80 }} /> | ||
</colgroup> | ||
<tbody> | ||
{channelData?.fields.sort(fieldSortType).map((field) => ( | ||
<tr key={field.name}> | ||
<th className="font-14-regular text-secondary mr-2 text-left align-text-top"> | ||
{field.name} | ||
</th> | ||
<td className="font-14-regular text-primary"> | ||
{field.key === 'issues' ? ( | ||
<div className="flex gap-2"> | ||
{( | ||
feedbackData[field.key] ?? ([] as IssueType[]) | ||
).map((v) => ( | ||
<Badge | ||
key={v.id} | ||
color={getStatusColor(v.status)} | ||
type="secondary" | ||
> | ||
{v.name} | ||
</Badge> | ||
))} | ||
</div> | ||
) : field.format === 'multiSelect' ? ( | ||
(feedbackData[field.key] ?? ([] as string[])).join( | ||
', ', | ||
) | ||
) : field.format === 'date' ? ( | ||
dayjs(feedbackData[field.key]).format( | ||
DATE_TIME_FORMAT, | ||
) | ||
) : ( | ||
feedbackData[field.key] | ||
)} | ||
</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</FloatingOverlay> | ||
</FloatingFocusManager> | ||
</FloatingPortal> | ||
); | ||
}; | ||
const fieldSortType = (a: FieldType, b: FieldType) => { | ||
const aNum = a.type === 'DEFAULT' ? 1 : a.type === 'API' ? 2 : 3; | ||
const bNum = b.type === 'DEFAULT' ? 1 : b.type === 'API' ? 2 : 3; | ||
return aNum - bNum; | ||
}; | ||
|
||
export default FeedbackDetail; |
16 changes: 16 additions & 0 deletions
16
apps/web/src/containers/tables/FeedbackTable/FeedbackDetail/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Copyright 2023 LINE Corporation | ||
* | ||
* LINE Corporation licenses this file to you under the Apache License, | ||
* version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at: | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
export { default } from './FeedbackDetail'; |
Oops, something went wrong.