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

prevent problems with long job argument list #533

Merged
merged 2 commits into from
Jul 15, 2023
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
2 changes: 1 addition & 1 deletion saltgui/static/scripts/CommandBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ export class CommandBox {
minions = ["WHEEL"];
}
// do not suppress the jobId (even when we can)
Output.addResponseOutput(outputContainer, null, minions, pResponse, pCommand, "done", undefined);
Output.addResponseOutput(outputContainer, null, minions, pResponse, pCommand, "done", undefined, undefined);
const targetField = document.getElementById("target");
const commandField = document.getElementById("command");
const button = document.querySelector(".run-command input[type='submit']");
Expand Down
8 changes: 7 additions & 1 deletion saltgui/static/scripts/output/Output.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ export class Output {

// the orchestrator for the output
// determines what format should be used and uses that
static addResponseOutput (pOutputContainer, pJobId, pMinionData, pResponse, pCommand, pInitialStatus, pHighlightMinionId) {
static addResponseOutput (pOutputContainer, pJobId, pMinionData, pResponse, pCommand, pInitialStatus, pHighlightMinionId, pArguments) {

// remove old content
pOutputContainer.innerText = "";
Expand Down Expand Up @@ -737,6 +737,12 @@ export class Output {
topSummaryDiv.appendChild(summaryJobsListJobSpan);
}

if (pArguments) {
const div = Utils.createDiv("", pArguments);
div.style.lineBreak = "anywhere";
pOutputContainer.appendChild(div);
}

const masterTriangle = Utils.createSpan();
// use cntMinions instead of cntResponses to be predictable
// hide details when there are many minions to show
Expand Down
17 changes: 12 additions & 5 deletions saltgui/static/scripts/panels/Job.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,15 @@ export class JobPanel extends Panel {
this.output.innerText = "";

// use same formatter as direct commands
const argumentsText = JobPanel.decodeArgumentsArray(info.Arguments);
const commandText = info.Function + argumentsText;
let argumentsText = JobPanel.decodeArgumentsArray(info.Arguments);

this.targettype = info["Target-type"];
if (Array.isArray(info.Target)) {
this.target = info.Target.join(",");
} else {
this.target = info.Target;
}
this.commandtext = commandText;
this.commandtext = info.Function + argumentsText;
this.jobid = pJobId;
this.minions = info.Minions;
this.result = info.Result;
Expand All @@ -197,7 +196,15 @@ export class JobPanel extends Panel {

// ============================

const functionText = commandText + " on " +
const maxTextLength = 50;
let displayArguments = null;
if (argumentsText.length > maxTextLength) {
// prevent column becoming too wide
displayArguments = this.commandtext;
argumentsText = argumentsText.substring(0, maxTextLength) + "...";
}

const functionText = info.Function + argumentsText + " on " +
TargetType.makeTargetText(info);
this.updateTitle(functionText);

Expand Down Expand Up @@ -229,7 +236,7 @@ export class JobPanel extends Panel {
initialStatus = "(loading)";
this.jobIsTerminated = false;
}
Output.addResponseOutput(this.output, pJobId, minions, info.Result, info.Function, initialStatus, pMinionId);
Output.addResponseOutput(this.output, pJobId, minions, info.Result, info.Function, initialStatus, pMinionId, displayArguments);

// replace any jobid
// Don't do this with output.innerHTML as there are already
Expand Down