Skip to content

Commit

Permalink
Move constant added in #3448 to Constants.ts (#3478)
Browse files Browse the repository at this point in the history
Signed-off-by: JWaters02 <watersjoshua2002@gmail.com>
Co-authored-by: Billie Simmons <BillieJean.Simmons@ibm.com>
Co-authored-by: Fernando Rijo Cedeno <37381190+zFernand0@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 26, 2025
1 parent cf9146e commit ce106c9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
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

0 comments on commit ce106c9

Please sign in to comment.