Skip to content

Commit

Permalink
Merge pull request #533 from erwindon/jobargs
Browse files Browse the repository at this point in the history
prevent problems with long job argument list
  • Loading branch information
erwindon authored Jul 15, 2023
2 parents 2ae72ef + a832a96 commit 9d089bc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
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

0 comments on commit 9d089bc

Please sign in to comment.