diff --git a/catalog/app/containers/Bucket/PackageList/PackageList.tsx b/catalog/app/containers/Bucket/PackageList/PackageList.tsx
index eebe523256f..b66cdaf1182 100644
--- a/catalog/app/containers/Bucket/PackageList/PackageList.tsx
+++ b/catalog/app/containers/Bucket/PackageList/PackageList.tsx
@@ -224,20 +224,30 @@ interface RevisionMetaProps {
function RevisionMeta({ revision }: RevisionMetaProps) {
const classes = useRevisionMetaStyles()
+ const { preferences } = BucketPreferences.use()
return (
{!!revision.message &&
{revision.message}
}
{!!revision.userMeta && (
- {Object.entries(revision.userMeta).map(([name, value]) => (
- /* @ts-expect-error */
+ {preferences?.ui.packageDescription.userMetaMultiline ? (
+ Object.entries(revision.userMeta).map(([name, value]) => (
+ // @ts-expect-error
+
+ ))
+ ) : (
+ // @ts-expect-error
- ))}
+ )}
)}
@@ -259,9 +269,9 @@ function usePackageDescription(
): BucketPreferences.PackagePreferences | null {
const { preferences } = BucketPreferences.use()
return React.useMemo(() => {
- if (!preferences?.ui.package_description) return null
+ if (!preferences?.ui.packageDescription.packages) return null
return (
- Object.entries(preferences?.ui.package_description)
+ Object.entries(preferences?.ui.packageDescription.packages)
.reverse() // The last found config wins
.find(([nameRegex]) => new RegExp(nameRegex).test(name))?.[1] || {}
)
diff --git a/catalog/app/utils/BucketPreferences/BucketPreferences.spec.ts b/catalog/app/utils/BucketPreferences/BucketPreferences.spec.ts
index 6707a0d15f6..934e54acdd1 100644
--- a/catalog/app/utils/BucketPreferences/BucketPreferences.spec.ts
+++ b/catalog/app/utils/BucketPreferences/BucketPreferences.spec.ts
@@ -30,10 +30,13 @@ const expectedDefaults = {
packages: true,
queries: true,
},
- package_description: {
- '.*': {
- message: true,
+ packageDescription: {
+ packages: {
+ '.*': {
+ message: true,
+ },
},
+ userMetaMultiline: false,
},
sourceBuckets: {
list: [],
diff --git a/catalog/app/utils/BucketPreferences/BucketPreferences.ts b/catalog/app/utils/BucketPreferences/BucketPreferences.ts
index ce86c184b6d..0fae6f34015 100644
--- a/catalog/app/utils/BucketPreferences/BucketPreferences.ts
+++ b/catalog/app/utils/BucketPreferences/BucketPreferences.ts
@@ -56,9 +56,13 @@ export interface PackagePreferences {
userMeta?: ReadonlyArray
}
type PackagesListPreferencesInput = Record
-type PackagesListPreferences = Record
+interface PackagesListPreferences {
+ packages: Record
+ userMetaMultiline: boolean
+}
type DefaultSourceBucketInput = string
+type PackageDescriptionMultiline = boolean
type SourceBucketsInput = Record
export interface AthenaPreferencesInput {
@@ -77,6 +81,7 @@ interface UiPreferencesInput {
defaultSourceBucket?: DefaultSourceBucketInput
nav?: Partial
package_description?: PackagesListPreferencesInput
+ package_description_multiline?: PackageDescriptionMultiline
sourceBuckets?: SourceBucketsInput
}
@@ -94,7 +99,7 @@ interface UiPreferences {
athena: AthenaPreferences
blocks: BlocksPreferences
nav: NavPreferences
- package_description: PackagesListPreferences
+ packageDescription: PackagesListPreferences
sourceBuckets: SourceBuckets
}
@@ -132,10 +137,13 @@ const defaultPreferences: BucketPreferences = {
packages: true,
queries: true,
},
- package_description: {
- '.*': {
- message: true,
+ packageDescription: {
+ packages: {
+ '.*': {
+ message: true,
+ },
},
+ userMetaMultiline: false,
},
sourceBuckets: {
getDefault: () => '',
@@ -186,16 +194,25 @@ function parseBlocks(blocks?: BlocksPreferencesInput): BlocksPreferences {
}
}
-function parsePackages(packages?: PackagesListPreferencesInput): PackagesListPreferences {
+function parsePackages(
+ packages?: PackagesListPreferencesInput,
+ userMetaMultiline: boolean = false,
+): PackagesListPreferences {
return Object.entries(packages || {}).reduce(
- (memo, [name, { message, user_meta }]) => ({
- ...memo,
- [name]: {
- message,
- userMeta: user_meta,
- },
- }),
- defaultPreferences.ui.package_description,
+ (memo, [name, { message, user_meta }]) =>
+ R.assocPath(
+ ['packages', name],
+ {
+ message,
+ userMeta: user_meta,
+ },
+ memo,
+ ),
+ {
+ packages: defaultPreferences.ui.packageDescription.packages,
+ userMetaMultiline:
+ userMetaMultiline || defaultPreferences.ui.packageDescription.userMetaMultiline,
+ },
)
}
@@ -232,7 +249,10 @@ export function extendDefaults(
...R.mergeDeepRight(defaultPreferences.ui, data?.ui || {}),
athena: parseAthena(data?.ui?.athena),
blocks: parseBlocks(data?.ui?.blocks),
- package_description: parsePackages(data?.ui?.package_description),
+ packageDescription: parsePackages(
+ data?.ui?.package_description,
+ data?.ui?.package_description_multiline,
+ ),
sourceBuckets: parseSourceBuckets(
sentry,
data?.ui?.sourceBuckets,
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 40c2195c987..c2094ef7df5 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -27,6 +27,7 @@ Entries inside each section should be ordered by type:
* [Changed] Show collapsed values in JSON viewer ([#3249](https://github.com/quiltdata/quilt/pull/3249))
* [Changed] Rename "Metadata" to "User metadata" ([#3255](https://github.com/quiltdata/quilt/pull/3255))
* [Changed] Show selective metadata for packages as JSON ([#3259](https://github.com/quiltdata/quilt/pull/3259))
+* [Changed] Show selective metadata on one line and optionaly on multiple lines ([#3284](https://github.com/quiltdata/quilt/pull/3284))
# 5.1.0 - 2022-12-09
## Python API
diff --git a/docs/Catalog/Preferences.md b/docs/Catalog/Preferences.md
index 10dac6c2c49..42da1979d13 100644
--- a/docs/Catalog/Preferences.md
+++ b/docs/Catalog/Preferences.md
@@ -33,6 +33,7 @@ ui:
package_description:
.*:
message: True
+ package_description_multiline: False
```
### Properties
@@ -62,6 +63,7 @@ that is selected by default; if it doesn't match any bucket then it's ignored
that maps package handle regular expressions
or literals to JSONPath expressions of fields to show from package metadata
in the package list view.
+* `ui.package_description_multiline: True` - expands package metadata's root key/values
* `ui.athena.defaultWorkgroup` - default workgroup to select on the Athena page
#### `ui.sourceBuckets` example
diff --git a/docs/imgs/package-list-selective-metadata.png b/docs/imgs/package-list-selective-metadata.png
index 35ebf582513..544476f05db 100644
Binary files a/docs/imgs/package-list-selective-metadata.png and b/docs/imgs/package-list-selective-metadata.png differ
diff --git a/shared/schemas/bucketConfig.yml.json b/shared/schemas/bucketConfig.yml.json
index b22ddeb5ef5..94672cfa24d 100644
--- a/shared/schemas/bucketConfig.yml.json
+++ b/shared/schemas/bucketConfig.yml.json
@@ -163,6 +163,11 @@
}
]
},
+ "package_description_multiline": {
+ "type": "boolean",
+ "description": "Expands package metadata's root key/values",
+ "default": false
+ },
"sourceBuckets": {
"type": "object",
"description": "Buckets usable as sources for adding objects from while editing a package via web UI.",