Skip to content
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

fix: don't truncate at PDR level #654

Merged
merged 4 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export default class Deploy extends SfCommand<void> {
errorMessage: failure.error.message,
}));
this.styledHeader(messages.getMessage('error.initialization.title'));
this.table(failureData, columns);
this.table(failureData, columns, { 'no-truncate': true });
const err = messages.createError('error.initialization');
err.data = hookResults.failures;
throw err;
Expand Down
16 changes: 10 additions & 6 deletions src/commands/project/delete/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,16 @@ export class Source extends SfCommand<DeleteSourceJson> {
return;
}

this.table(conflicts, {
state: { header: 'STATE' },
fullName: { header: 'FULL NAME' },
type: { header: 'TYPE' },
filePath: { header: 'FILE PATH' },
});
this.table(
conflicts,
{
state: { header: 'STATE' },
fullName: { header: 'FULL NAME' },
type: { header: 'TYPE' },
filePath: { header: 'FILE PATH' },
},
{ 'no-truncate': true }
);

// map do dedupe by name-type-filename
const conflictMap = new Map<string, ConflictResponse>();
Expand Down
8 changes: 6 additions & 2 deletions src/formatters/deleteResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export class DeleteResultFormatter implements Formatter<DeleteSourceJson> {
fullName: { header: 'FULL NAME' },
type: { header: 'TYPE' },
filePath: { header: 'PROJECT PATH' },
}
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd rather have the commands instantiate a new sf-plugins/core Ux and pass that to the formatters' constructor. Then future style/ui changes become one-place-to-change.

There's some other UI inconsistencies between Ux and the SfCommand (colored warnings, for example) that we'd get consistency on.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into that, but it kept expanding what was required when implementing it for the now deprecated project deploy command.

This approach will be the smallest change in the plugin, and if we wanted a one-place-to-change it, we would change this at the oclif level 🤷‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe if there was another level of inheritance involved that provided common options for all source commands and formatters it could be changed in that one place. Maybe call it, SourceCommand or ResultFormatter.

{ 'no-truncate': true }
);
} else {
this.displayFailures();
Expand All @@ -92,7 +93,10 @@ export class DeleteResultFormatter implements Formatter<DeleteSourceJson> {
fullName: { header: 'Name' },
error: { header: 'Problem' },
};
const options = { title: StandardColors.error(bold(`Component Failures [${failures.length}]`)) };
const options: ux.Table.table.Options = {
title: StandardColors.error(bold(`Component Failures [${failures.length}]`)),
'no-truncate': true,
};
ux.log();
ux.table(
failures.map((f) => ({ problemType: f.problemType, fullName: f.fullName, error: f.problem })),
Expand Down
4 changes: 2 additions & 2 deletions src/formatters/deployReportResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class DeployReportResultFormatter extends DeployResultFormatter {
);

ux.log();
ux.table(response, { key: {}, value: {} }, { title: tableHeader('Deploy Info') });
ux.table(response, { key: {}, value: {} }, { title: tableHeader('Deploy Info'), 'no-truncate': true });

const opts = Object.entries(this.flags).reduce<Array<{ key: string; value: unknown }>>((result, [key, value]) => {
if (key === 'timestamp') return result;
Expand All @@ -38,7 +38,7 @@ export class DeployReportResultFormatter extends DeployResultFormatter {
return result.concat({ key, value });
}, []);
ux.log();
ux.table(opts, { key: {}, value: {} }, { title: tableHeader('Deploy Options') });
ux.table(opts, { key: {}, value: {} }, { title: tableHeader('Deploy Options'), 'no-truncate': true });
super.display();
}
}
Expand Down
21 changes: 13 additions & 8 deletions src/formatters/deployResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ export class DeployResultFormatter implements Formatter<DeployResultJson> {
},
{
title: tableHeader('Metadata Replacements'),
'no-truncate': true,
}
);
}
Expand All @@ -236,7 +237,7 @@ export class DeployResultFormatter implements Formatter<DeployResultJson> {
filePath: { header: 'Path' },
};
const title = this.result.response.checkOnly ? 'Validated Source' : 'Deployed Source';
const options = { title: tableHeader(title) };
const options = { title: tableHeader(title), 'no-truncate': true };
ux.log();

ux.table(
Expand Down Expand Up @@ -268,7 +269,7 @@ export class DeployResultFormatter implements Formatter<DeployResultJson> {
fullName: { header: 'Name' },
error: { header: 'Problem' },
};
const options = { title: error(`Component Failures [${failures.length}]`) };
const options = { title: error(`Component Failures [${failures.length}]`), 'no-truncate': true };
ux.log();
ux.table(
failures.map((f) => ({ problemType: f.problemType, fullName: f.fullName, error: f.error })),
Expand All @@ -288,7 +289,7 @@ export class DeployResultFormatter implements Formatter<DeployResultJson> {
filePath: { header: 'Path' },
};

const options = { title: tableHeader('Deleted Source') };
const options = { title: tableHeader('Deleted Source'), 'no-truncate': true };
ux.log();

ux.table(getFileResponseSuccessProps(deletions), columns, options);
Expand Down Expand Up @@ -358,11 +359,15 @@ export class DeployResultFormatter implements Formatter<DeployResultJson> {
ux.log();
ux.log(tableHeader('Apex Code Coverage'));

ux.table(coverage.map(coverageOutput), {
name: { header: 'Name' },
numLocations: { header: '% Covered' },
lineNotCovered: { header: 'Uncovered Lines' },
});
ux.table(
coverage.map(coverageOutput),
{
name: { header: 'Name' },
numLocations: { header: '% Covered' },
lineNotCovered: { header: 'Uncovered Lines' },
},
{ 'no-truncate': true }
);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/formatters/metadataConvertResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export class MetadataConvertResultFormatter implements Formatter<ConvertMdapiJso
fullName: { header: 'FULL NAME' },
type: { header: 'TYPE' },
filePath: { header: 'PROJECT PATH' },
}
},
{ 'no-truncate': true }
);
} else {
ux.log('No metadata found to convert');
Expand Down
4 changes: 2 additions & 2 deletions src/formatters/retrieveResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class RetrieveResultFormatter implements Formatter<RetrieveResultJson> {
filePath: { header: 'Path' },
};
const title = 'Retrieved Source';
const options = { title: tableHeader(title) };
const options = { title: tableHeader(title), 'no-truncate': true };
ux.log();

ux.table(getFileResponseSuccessProps(successes), columns, options);
Expand All @@ -57,7 +57,7 @@ export class RetrieveResultFormatter implements Formatter<RetrieveResultJson> {
fullPath: { header: 'Converted Location' },
};
const title = 'Retrieved Packages';
const options = { title: tableHeader(title) };
const options = { title: tableHeader(title), 'no-truncate': true };
ux.log();
ux.table(packages, columns, options);
}
Expand Down
3 changes: 2 additions & 1 deletion src/utils/conflicts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const writeConflictTable = (conflicts: ConflictResponse[]): void => {
fullName: { header: 'FULL NAME' },
type: { header: 'TYPE' },
filePath: { header: 'FILE PATH' },
}
},
{ 'no-truncate': true }
);
};