-
Notifications
You must be signed in to change notification settings - Fork 10
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
W-16736199 Wr/tables #823
W-16736199 Wr/tables #823
Changes from 10 commits
0952806
e1f820b
de5c345
8347cca
87e86b3
f3d3701
af37bcf
6191625
6542c9c
197bc69
15927e7
5e51c51
f222e00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,30 +61,26 @@ export class PackageListCommand extends SfCommand<PackageListCommandResult> { | |
|
||
private displayResults(results: Package2Result[], verbose = false, apiVersion: string): void { | ||
this.styledHeader(chalk.blue(`Packages [${results.length}]`)); | ||
const columns = { | ||
NamespacePrefix: { header: messages.getMessage('namespace') }, | ||
Name: { header: messages.getMessage('name') }, | ||
Id: { header: messages.getMessage('id') }, | ||
Alias: { header: messages.getMessage('alias') }, | ||
Description: { header: messages.getMessage('description') }, | ||
ContainerOptions: { | ||
header: messages.getMessage('package-type'), | ||
}, | ||
|
||
const data = results.map((r) => ({ | ||
'Namespace Prefix': r.NamespacePrefix, | ||
Name: r.Name, | ||
Id: r.Id, | ||
Alias: r.Alias, | ||
Description: r.Description, | ||
ContainerOptions: r.ContainerOptions, | ||
...(verbose | ||
? { | ||
SubscriberPackageId: { header: messages.getMessage('package-id') }, | ||
ConvertedFromPackageId: { header: messages.getMessage('convertedFromPackageId') }, | ||
IsOrgDependent: { header: messages.getMessage('isOrgDependent') }, | ||
PackageErrorUsername: { header: messages.getMessage('error-notification-username') }, | ||
CreatedBy: { header: messages.getMessage('createdBy') }, | ||
'Package Id': r.SubscriberPackageId, | ||
'Converted From Package Id': r.ConvertedFromPackageId, | ||
'Org-Dependent Unlocked Package': r.IsOrgDependent, | ||
'Error Notification Username': r.PackageErrorUsername, | ||
'Created By': r.CreatedBy, | ||
...(parseInt(apiVersion, 10) >= 59 ? { 'App Analytics Enabled': r.AppAnalyticsEnabled } : {}), | ||
} | ||
: {}), | ||
...(verbose && parseInt(apiVersion, 10) >= 59 | ||
? { AppAnalyticsEnabled: { header: messages.getMessage('app-analytics-enabled') } } | ||
: {}), | ||
}; | ||
|
||
this.table(results, columns); | ||
})); | ||
this.table({ data }); | ||
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. replace |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,24 +22,6 @@ export type CreateListCommandResult = Array< | |
} | ||
>; | ||
|
||
type ColumnDataHeader = { | ||
header?: string; | ||
}; | ||
type ColumnData = { | ||
Id: ColumnDataHeader; | ||
Status: ColumnDataHeader; | ||
Package2Id: ColumnDataHeader; | ||
Package2VersionId: ColumnDataHeader; | ||
SubscriberPackageVersionId: ColumnDataHeader; | ||
Tag: ColumnDataHeader; | ||
Branch: ColumnDataHeader; | ||
CreatedDate: ColumnDataHeader; | ||
CreatedBy: ColumnDataHeader; | ||
VersionName?: ColumnDataHeader; | ||
VersionNumber?: ColumnDataHeader; | ||
ConvertedFromVersionId?: ColumnDataHeader; | ||
}; | ||
|
||
type Status = 'Queued' | 'InProgress' | 'Success' | 'Error'; | ||
|
||
export class PackageVersionCreateListCommand extends SfCommand<CreateListCommandResult> { | ||
|
@@ -87,47 +69,31 @@ export class PackageVersionCreateListCommand extends SfCommand<CreateListCommand | |
this.warn('No results found'); | ||
} else { | ||
this.styledHeader(chalk.blue(`Package Version Create Requests [${results.length}]`)); | ||
const columnData: ColumnData = { | ||
Id: {}, | ||
Status: { | ||
header: messages.getMessage('status'), | ||
}, | ||
Package2Id: { | ||
header: messages.getMessage('package-id'), | ||
}, | ||
Package2VersionId: { | ||
header: messages.getMessage('packageVersionId'), | ||
}, | ||
SubscriberPackageVersionId: { | ||
header: messages.getMessage('subscriberPackageVersionId'), | ||
}, | ||
Tag: { | ||
header: messages.getMessage('tag'), | ||
}, | ||
Branch: { | ||
header: messages.getMessage('branch'), | ||
}, | ||
CreatedDate: { header: 'Created Date' }, | ||
CreatedBy: { | ||
header: messages.getMessage('createdBy'), | ||
}, | ||
}; | ||
|
||
if (flags['show-conversions-only']) { | ||
columnData.ConvertedFromVersionId = { header: messages.getMessage('convertedFromVersionId') }; | ||
} | ||
|
||
if (flags.verbose) { | ||
try { | ||
results = await this.fetchVerboseData(results); | ||
columnData.VersionName = { header: 'Version Name' }; | ||
columnData.VersionNumber = { header: 'Version Number' }; | ||
} catch (err) { | ||
const errMsg = typeof err === 'string' ? err : err instanceof Error ? err.message : 'unknown error'; | ||
this.warn(`error when retrieving verbose data (package name and version) due to: ${errMsg}`); | ||
} | ||
} | ||
this.table(results, columnData, { 'no-truncate': true }); | ||
|
||
const data = results.map((r) => ({ | ||
Id: r.Id, | ||
Status: r.Status, | ||
'Package Id': r.Package2Id, | ||
'Package Version Id': r.Package2VersionId, | ||
'Subscriber Package Version Id': r.SubscriberPackageVersionId, | ||
Tag: r.Tag, | ||
Branch: r.Branch, | ||
'Created Date': r.CreatedDate, | ||
'Created By': r.CreatedBy, | ||
...(flags['show-conversions-only'] ? { 'Converted From Version Id': r.ConvertedFromVersionId } : {}), | ||
...(flags.verbose ? { 'Version Name': r.VersionName, 'Version Number': r.VersionNumber } : {}), | ||
})); | ||
|
||
this.table({ data, overflow: 'wrap' }); | ||
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. replace |
||
} | ||
|
||
return results; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,56 +61,53 @@ export class PackageVersionCreateReportCommand extends SfCommand<ReportCommandRe | |
|
||
const data = [ | ||
{ | ||
key: pvclMessages.getMessage('id'), | ||
name: pvclMessages.getMessage('id'), | ||
value: record.Id, | ||
}, | ||
{ | ||
key: pvclMessages.getMessage('status'), | ||
name: pvclMessages.getMessage('status'), | ||
value: camelCaseToTitleCase(record.Status), | ||
}, | ||
{ | ||
key: pvclMessages.getMessage('package-id'), | ||
name: pvclMessages.getMessage('package-id'), | ||
value: record.Package2Id, | ||
}, | ||
{ | ||
key: pvclMessages.getMessage('packageVersionId'), | ||
name: pvclMessages.getMessage('packageVersionId'), | ||
value: record.Package2VersionId, | ||
}, | ||
{ | ||
key: pvclMessages.getMessage('subscriberPackageVersionId'), | ||
name: pvclMessages.getMessage('subscriberPackageVersionId'), | ||
value: record.SubscriberPackageVersionId, | ||
}, | ||
{ | ||
key: pvclMessages.getMessage('tag'), | ||
name: pvclMessages.getMessage('tag'), | ||
value: record.Tag, | ||
}, | ||
{ | ||
key: pvclMessages.getMessage('branch'), | ||
name: pvclMessages.getMessage('branch'), | ||
value: record.Branch, | ||
}, | ||
{ key: 'Created Date', value: record.CreatedDate }, | ||
{ name: 'Created Date', value: record.CreatedDate }, | ||
{ | ||
key: pvclMessages.getMessage('installUrl'), | ||
name: pvclMessages.getMessage('installUrl'), | ||
value: installUrlValue, | ||
}, | ||
{ | ||
key: plMessages.getMessage('createdBy'), | ||
name: plMessages.getMessage('createdBy'), | ||
value: record.CreatedBy, | ||
}, | ||
]; | ||
|
||
if (record.ConvertedFromVersionId) { | ||
data.push({ | ||
key: pvlMessages.getMessage('convertedFromVersionId'), | ||
name: pvlMessages.getMessage('convertedFromVersionId'), | ||
value: record.ConvertedFromVersionId, | ||
}); | ||
} | ||
|
||
this.styledHeader(chalk.blue('Package Version Create Request')); | ||
this.table(data, { | ||
key: { header: 'Name' }, | ||
value: { header: 'Value' }, | ||
}); | ||
this.table({ data }); | ||
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. replace |
||
|
||
if (record.Error?.length > 0) { | ||
this.log(''); | ||
|
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.
you should use the
title
prop now,