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

Move constant added in #3448 to Constants.ts #3478

Merged
merged 3 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions packages/zowe-explorer/src/configuration/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class Constants {
public static readonly COMMAND_COUNT = 105;
public static readonly MAX_SEARCH_HISTORY = 5;
public static readonly MAX_FILE_HISTORY = 10;
public static readonly MAX_DISPLAYED_DELETE_NAMES = 10;
public static readonly MS_PER_SEC = 1000;
public static readonly STATUS_BAR_TIMEOUT_MS = 5000;
public static readonly CONTEXT_PREFIX = "_";
Expand Down
9 changes: 4 additions & 5 deletions packages/zowe-explorer/src/trees/dataset/DatasetActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -587,9 +587,8 @@ export class DatasetActions {
return SharedContext.isDsMember(deletedNode) ? deletedNode.getParent() : ` ${deletedNode.getLabel().toString()}`;
});

const MAX_DISPLAYED_DATASET_NAMES = 10;
const displayedDatasetNames = nodesToDelete.slice(0, MAX_DISPLAYED_DATASET_NAMES).join("\n");
const additionalDatasetsCount = nodesToDelete.length - MAX_DISPLAYED_DATASET_NAMES;
const displayedDatasetNames = nodesToDelete.slice(0, Constants.MAX_DISPLAYED_DELETE_NAMES).join("\n");
const additionalDatasetsCount = nodesToDelete.length - Constants.MAX_DISPLAYED_DELETE_NAMES;

// Confirm that the user really wants to delete
ZoweLogger.debug(
Expand Down Expand Up @@ -657,8 +656,8 @@ export class DatasetActions {
}
if (nodesDeleted.length > 0) {
nodesDeleted.sort((a, b) => a.localeCompare(b));
const displayedDeletedNames = nodesDeleted.slice(0, MAX_DISPLAYED_DATASET_NAMES).join("\n");
const additionalDeletedCount = nodesDeleted.length - MAX_DISPLAYED_DATASET_NAMES;
const displayedDeletedNames = nodesDeleted.slice(0, Constants.MAX_DISPLAYED_DELETE_NAMES).join("\n");
const additionalDeletedCount = nodesDeleted.length - Constants.MAX_DISPLAYED_DELETE_NAMES;
Gui.showMessage(
vscode.l10n.t({
message: "The following {0} item(s) were deleted:\n{1}{2}",
Expand Down
9 changes: 4 additions & 5 deletions packages/zowe-explorer/src/trees/job/JobActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ export class JobActions {
const deleteButton = vscode.l10n.t("Delete");
const toJobname = (jobNode: IZoweJobTreeNode): string => `${jobNode.job.jobname}(${jobNode.job.jobid})`;
const jobNames = jobs.map(toJobname);
const MAX_DISPLAYED_JOB_NAMES = 10;
let displayedJobNames = jobNames.slice(0, MAX_DISPLAYED_JOB_NAMES).join("\n");
let additionalJobsCount = jobNames.length - MAX_DISPLAYED_JOB_NAMES;
let displayedJobNames = jobNames.slice(0, Constants.MAX_DISPLAYED_DELETE_NAMES).join("\n");
let additionalJobsCount = jobNames.length - Constants.MAX_DISPLAYED_DELETE_NAMES;
const message = vscode.l10n.t({
message:
"Are you sure you want to delete the following {0} items?\n" +
Expand Down Expand Up @@ -106,8 +105,8 @@ export class JobActions {
})
.filter((result) => result !== undefined);
if (deletedJobs.length) {
displayedJobNames = deletedJobs.slice(0, MAX_DISPLAYED_JOB_NAMES).map(toJobname).join(", ");
additionalJobsCount = deletedJobs.length - MAX_DISPLAYED_JOB_NAMES;
displayedJobNames = deletedJobs.slice(0, Constants.MAX_DISPLAYED_DELETE_NAMES).map(toJobname).join(", ");
additionalJobsCount = deletedJobs.length - Constants.MAX_DISPLAYED_DELETE_NAMES;
Gui.showMessage(
vscode.l10n.t({
message: "The following jobs were deleted: {0}{1}",
Expand Down
5 changes: 2 additions & 3 deletions packages/zowe-explorer/src/trees/uss/USSActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,8 @@ export class USSActions {
}
selectedNodes = selectedNodes.filter((x) => SharedContext.isDocument(x) || SharedContext.isUssDirectory(x) || SharedContext.isBinary(x));
const fileNames = selectedNodes.map(({ label }) => label.toString());
const MAX_DISPLAYED_FILE_NAMES = 10;
const displayedFileNames = fileNames.slice(0, MAX_DISPLAYED_FILE_NAMES).join("\n");
const additionalFilesCount = fileNames.length - MAX_DISPLAYED_FILE_NAMES;
const displayedFileNames = fileNames.slice(0, Constants.MAX_DISPLAYED_DELETE_NAMES).join("\n");
const additionalFilesCount = fileNames.length - Constants.MAX_DISPLAYED_DELETE_NAMES;
const message = vscode.l10n.t({
message:
"Are you sure you want to delete the following item?\n" +
Expand Down