diff --git a/src/commands/org/list/shape.ts b/src/commands/org/list/shape.ts index adf0276d..2f8275cf 100644 --- a/src/commands/org/list/shape.ts +++ b/src/commands/org/list/shape.ts @@ -40,17 +40,13 @@ export class OrgShapeListCommand extends SfCommand { this.table({ data: orgShapes.map((shape) => ({ - ALIAS: shape.alias ?? '', - USERNAME: shape.username, 'ORG ID': shape.orgId, + USERNAME: shape.username, + ALIAS: shape.alias ?? '', 'Shape ID': shape.shapeId, + 'Shape Status': shape.status === 'Active' ? StandardColors.success(shape.status) : shape.status, 'CREATED BY': shape.createdBy, 'CREATED DATE': shape.createdDate, - ...(shape.status === 'Active' - ? { - STATUS: StandardColors.success(shape.status), - } - : {}), })), title: 'Org Shapes', }); diff --git a/src/shared/snapshot.ts b/src/shared/snapshot.ts index bd9220f4..bb6688f5 100644 --- a/src/shared/snapshot.ts +++ b/src/shared/snapshot.ts @@ -92,10 +92,11 @@ export const printSingleRecordTable = (snapshotRecord: OrgSnapshot): void => { .map(([key, value]: [string, string]) => ({ Name: capitalCase(key), // format the datetime values - Value: ['LastModifiedDate', 'CreatedDate'].includes(key) ? dateTimeFormatter(value) : value, - })) - // null/undefined becomes empty string - .map((row) => (row.Value ? row : { ...row, Value: '' })), + Value: ['LastModifiedDate', 'CreatedDate'].includes(key) ? dateTimeFormatter(value) : value ?? '', + })), + // null/undefined becomes empty string + // .map((row) => (row.Value ? row : { ...row, Value: '' })), + columns: ['Name', 'Value'], }); }; @@ -107,12 +108,13 @@ export const printRecordTable = (snapshotRecords: OrgSnapshot[]): void => { new Ux().table({ // we know what columns we want, so filter out the other fields data: snapshotRecords.map((s) => ({ + // ...Object.fromEntries(Object.entries(s).filter(([key]) => Object.keys(s).includes(key))), Id: s.Id, 'Snapshot Name': s.SnapshotName, Status: s.Status, 'Source Org Id': s.SourceOrg, - CreatedDate: s.CreatedDate, - 'Last Modified Date': s.LastModifiedDate, + 'Created Date': dateTimeFormatter(s.CreatedDate), + 'Last Modified Date': dateTimeFormatter(s.LastModifiedDate), 'Expiration Date': s.ExpirationDate ? new Date(s.ExpirationDate).toLocaleDateString() : '', })), title: `Org Snapshots [${snapshotRecords.length}]`,