-
Notifications
You must be signed in to change notification settings - Fork 21
feat(ui): snapshot versions table, page, info widget #1017
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,20 @@ | ||
| <script lang="ts" setup> | ||
| const { t } = useNuxtApp().$i18n | ||
| const exStore = useExaminerStore() | ||
| const { snapshotInfo } = storeToRefs(exStore) | ||
| </script> | ||
|
|
||
| <template> | ||
| <div | ||
| class="flex flex-col gap-y-2 rounded-xl border-[3px] border-[#E2E8EE] | ||
| bg-white px-4 py-3 text-sm md:absolute md:right-0 md:top-0" | ||
| data-testid="snapshot-info" | ||
| > | ||
| <span> | ||
| <b>{{ t('strr.label.version') }}</b> {{ snapshotInfo.version }} | ||
| </span> | ||
| <span> | ||
| <b>{{ t('strr.label.date') }}</b> {{ dateToString(snapshotInfo.snapshotDateTime, 'y-MM-dd a', true) }} | ||
| </span> | ||
| </div> | ||
| </template> |
85 changes: 85 additions & 0 deletions
85
strr-examiner-web/app/components/SnapshotVersionsTable.vue
This file contains hidden or 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,85 @@ | ||
| <script lang="ts" setup> | ||
| const { t } = useNuxtApp().$i18n | ||
|
|
||
| defineProps<{ | ||
| snapshots: ApiSnapshot[] | ||
| }>() | ||
|
|
||
| const localePath = useLocalePath() | ||
|
|
||
| const columns = [ | ||
| { key: 'version', label: t('table.registrationSnapshots.version') }, | ||
| { key: 'date', label: t('table.registrationSnapshots.date') }, | ||
| { key: 'decision', label: t('table.registrationSnapshots.decision') }, | ||
| { key: 'assignee', label: t('table.registrationSnapshots.assignee') }, | ||
| { key: 'action', label: t('table.registrationSnapshots.action'), class: 'w-[200px]' } | ||
| ] | ||
|
|
||
| const onViewSnapshot = async (snapshotEndpoint: string) => { | ||
| await navigateTo(localePath(snapshotEndpoint.replace('registrations', 'registration'))) | ||
| } | ||
|
|
||
| </script> | ||
|
|
||
| <template> | ||
| <div class="app-inner-container mb-4"> | ||
| <!-- Header --> | ||
| <div class="flex items-center justify-between rounded-t-lg bg-[#E2E8EE] px-6 py-4"> | ||
| <div class="flex items-center gap-2"> | ||
| <UIcon | ||
| name="i-mdi-folder-outline" | ||
| class="size-6 text-str-blue" | ||
| /> | ||
| <h3 class="text-lg text-str-textGray"> | ||
| {{ t('label.versions') }} | ||
| </h3> | ||
| </div> | ||
| </div> | ||
| <!-- Table --> | ||
| <UTable | ||
| :rows="snapshots" | ||
| :columns="columns" | ||
| :ui="{ | ||
| wrapper: 'h-auto', | ||
| divide: 'divide-y divide-gray-200', | ||
| th: { | ||
| base: 'text-sm text-gray-700', | ||
| padding: 'px-6 py-3' | ||
| }, | ||
| td: { | ||
| base: 'align-middle text-sm text-gray-700 bg-white', | ||
| padding: 'px-6' | ||
| } | ||
| }" | ||
| data-testid="snapshot-versions-table" | ||
| > | ||
| <template #version-data="{ row }"> | ||
| {{ row.version }} | ||
| </template> | ||
| <template #date-data="{ row }"> | ||
| {{ dateToString(row.snapshotDateTime, 'y-MM-dd', true) }} | ||
| </template> | ||
| <template #decision-data> | ||
| - | ||
| </template> | ||
| <template #assignee-data> | ||
| - | ||
| </template> | ||
| <template #action-data="{ row }"> | ||
| <UButton | ||
| :label="t('btn.viewSnapshot')" | ||
| color="primary" | ||
| variant="solid" | ||
| size="lg" | ||
| class="whitespace-nowrap px-6" | ||
| data-testid="view-snapshot-button" | ||
| @click="onViewSnapshot(row.snapshotEndpoint)" | ||
| /> | ||
| </template> | ||
| </UTable> | ||
| </div> | ||
| </template> | ||
|
|
||
| <style> | ||
|
|
||
| </style> | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
54 changes: 54 additions & 0 deletions
54
strr-examiner-web/app/pages/registration/[registrationId]/snapshots/[snapshotId].vue
This file contains hidden or 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,54 @@ | ||
| <script setup lang="ts"> | ||
| const { t } = useNuxtApp().$i18n | ||
| const route = useRoute() | ||
| const { getSnapshotById } = useExaminerStore() | ||
| const { activeRecord, snapshotInfo } = storeToRefs(useExaminerStore()) | ||
|
|
||
| useHead({ | ||
| title: t('page.snapshot.title') | ||
| }) | ||
|
|
||
| definePageMeta({ | ||
| layout: 'examine', | ||
| middleware: ['auth'] | ||
| }) | ||
|
|
||
| const initialMount = ref(true) | ||
|
|
||
| const { data: snapshot, status, error } = await useLazyAsyncData< | ||
| HousRegistrationResponse | undefined, ApplicationError | ||
| >( | ||
| 'snapshot-details-view', | ||
| async () => { | ||
| const registrationId = route.params.registrationId as string | ||
| const snapshotId = route.params.snapshotId as string | ||
| const resp = await getSnapshotById(registrationId, snapshotId) | ||
| activeRecord.value = resp.snapshotData // used for the data needed to render the details page | ||
| snapshotInfo.value = resp // user for data needed for snapshot info widget on details page | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry for being nitpicky haha, a super small typo here, used instead of user
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cleaned up in next pr, thanks for noticing |
||
| return resp | ||
| } | ||
| ) | ||
|
|
||
| watch( | ||
| [snapshot, error], | ||
| () => { | ||
| initialMount.value = false | ||
| } | ||
| ) | ||
| </script> | ||
|
|
||
| <template> | ||
| <div class="app-body"> | ||
| <ConnectSpinner | ||
| v-if="initialMount || status === 'pending'" | ||
| overlay | ||
| /> | ||
| <template v-else> | ||
| <ApplicationDetailsView> | ||
| <template #header> | ||
| <RegistrationInfoHeader /> | ||
| </template> | ||
| </ApplicationDetailsView> | ||
| </template> | ||
| </div> | ||
| </template> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An empty style block here if we can remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleaned up in next pr