-
Notifications
You must be signed in to change notification settings - Fork 22
Add source cell for disks, with side modal #3214
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
Open
charliepark
wants to merge
15
commits into
main
Choose a base branch
from
add_disk_source_cell
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ec80503
Add source cell for disks, with side modal
charliepark 32cef5b
defer loading, with skeleton; add badge to sidemodal source cell
charliepark acf5d01
Merge branch 'main' into add_disk_source_cell
charliepark 509331f
add PropertiesTable.SizeRow
charliepark cc0a7bb
Merge branch 'main' into add_disk_source_cell
charliepark 9ecc9b0
merge main and resolve conflicts
charliepark 625d227
Use existing sizeCellInner function
charliepark d388ee2
increase gap next to image badge
david-crespo 3203d80
invalidate diskView on disk delete
david-crespo 6a4416b
include source type in Deleted badge
david-crespo d63b3d1
dedupe source name resolution
david-crespo 99dfb39
remove no-op snapshot invalidations in image upload
david-crespo d3aac53
restore IdRow e2e coverage in disk detail modal
david-crespo 31005cf
consolidate image details views
charliepark 5262f96
Remove /edit suffix on URL
charliepark 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
| * | ||
| * Copyright Oxide Computer Company | ||
| */ | ||
| import { type Image } from '@oxide/api' | ||
| import { Images16Icon } from '@oxide/design-system/icons/react' | ||
|
|
||
| import { ReadOnlySideModalForm } from '~/components/form/ReadOnlySideModalForm' | ||
| import { SideModalFormDocs } from '~/ui/lib/ModalLinks' | ||
| import { PropertiesTable } from '~/ui/lib/PropertiesTable' | ||
| import { ResourceLabel } from '~/ui/lib/SideModal' | ||
| import { docLinks } from '~/util/links' | ||
|
|
||
| type ImageDetailSideModalProps = { | ||
| image: Image | ||
| onDismiss: () => void | ||
| /** Pass `true` for state-driven usage (e.g., DiskSourceCell). Omit for route usage. */ | ||
| animate?: boolean | ||
| } | ||
|
|
||
| export function ImageDetailSideModal({ | ||
| image, | ||
| onDismiss, | ||
| animate, | ||
| }: ImageDetailSideModalProps) { | ||
| // projectId is only set on project images; silo images leave it null | ||
| const visibility = image.projectId ? 'Project' : 'Silo' | ||
| return ( | ||
| <ReadOnlySideModalForm | ||
| title="Image details" | ||
| onDismiss={onDismiss} | ||
| animate={animate} | ||
| subtitle={ | ||
| <ResourceLabel> | ||
| <Images16Icon /> {image.name} | ||
| </ResourceLabel> | ||
| } | ||
| > | ||
| <PropertiesTable> | ||
| <PropertiesTable.IdRow id={image.id} /> | ||
| <PropertiesTable.DescriptionRow description={image.description} sideModal /> | ||
| <PropertiesTable.Row label="Visibility">{visibility}</PropertiesTable.Row> | ||
| <PropertiesTable.Row label="OS">{image.os}</PropertiesTable.Row> | ||
| <PropertiesTable.Row label="Version">{image.version}</PropertiesTable.Row> | ||
| <PropertiesTable.SizeRow bytes={image.size} /> | ||
| <PropertiesTable.Row label="Block size"> | ||
| {image.blockSize.toLocaleString()} bytes | ||
| </PropertiesTable.Row> | ||
| <PropertiesTable.DateRow label="Created" date={image.timeCreated} /> | ||
| <PropertiesTable.DateRow label="Last Modified" date={image.timeModified} /> | ||
| </PropertiesTable> | ||
| <SideModalFormDocs docs={[docLinks.images]} /> | ||
| </ReadOnlySideModalForm> | ||
| ) | ||
| } |
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,55 @@ | ||
| /* | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
| * | ||
| * Copyright Oxide Computer Company | ||
| */ | ||
| import { type Snapshot } from '@oxide/api' | ||
| import { Snapshots16Icon } from '@oxide/design-system/icons/react' | ||
|
|
||
| import { ReadOnlySideModalForm } from '~/components/form/ReadOnlySideModalForm' | ||
| import { SnapshotStateBadge } from '~/components/StateBadge' | ||
| import { DiskNameFromId } from '~/table/cells/SourceNameCell' | ||
| import { SideModalFormDocs } from '~/ui/lib/ModalLinks' | ||
| import { PropertiesTable } from '~/ui/lib/PropertiesTable' | ||
| import { ResourceLabel } from '~/ui/lib/SideModal' | ||
| import { docLinks } from '~/util/links' | ||
|
|
||
| type SnapshotDetailSideModalProps = { | ||
| snapshot: Snapshot | ||
| onDismiss: () => void | ||
| } | ||
|
|
||
| export function SnapshotDetailSideModal({ | ||
| snapshot, | ||
| onDismiss, | ||
| }: SnapshotDetailSideModalProps) { | ||
| return ( | ||
| <ReadOnlySideModalForm | ||
| title="Snapshot details" | ||
| onDismiss={onDismiss} | ||
| animate | ||
| subtitle={ | ||
| <ResourceLabel> | ||
| <Snapshots16Icon /> {snapshot.name} | ||
| </ResourceLabel> | ||
| } | ||
| > | ||
| <PropertiesTable> | ||
| <PropertiesTable.IdRow id={snapshot.id} /> | ||
| <PropertiesTable.DescriptionRow description={snapshot.description} sideModal /> | ||
| <PropertiesTable.Row label="State"> | ||
| <SnapshotStateBadge state={snapshot.state} /> | ||
| </PropertiesTable.Row> | ||
| <PropertiesTable.SizeRow bytes={snapshot.size} /> | ||
| <PropertiesTable.Row label="Source disk"> | ||
| <DiskNameFromId diskId={snapshot.diskId} /> | ||
| </PropertiesTable.Row> | ||
| <PropertiesTable.DateRow label="Created" date={snapshot.timeCreated} /> | ||
| <PropertiesTable.DateRow label="Last Modified" date={snapshot.timeModified} /> | ||
| </PropertiesTable> | ||
| <SideModalFormDocs docs={[docLinks.snapshots]} /> | ||
| </ReadOnlySideModalForm> | ||
| ) | ||
| } |
This file was deleted.
Oops, something went wrong.
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
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
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.
There were some invalidations added here that were probably harmless but I'd rather avoid them because they give the impression of being necessary. On the other hand I'm always wondering #3083 whether we should be more aggressive about invalidations. But I don't think we tend to have issues.