Skip to content

Commit 8359b36

Browse files
committed
Enh(aws/viewer): Save command that was run
1 parent bf10f9e commit 8359b36

6 files changed

Lines changed: 52 additions & 27 deletions

File tree

aws/setup/docker/docker_entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ echo "🔄 Updating repository..."
1313
BRANCH_NAME="$1"
1414
shift # Remove first argument, leaving the rest for exec
1515

16+
# Save the user provided command in environment variable
17+
export AWS_USER_PROVIDED_COMMAND="$*"
18+
1619
echo "🌿 Checking out branch: $BRANCH_NAME"
1720
git fetch
1821
git checkout "$BRANCH_NAME"

codeclash/utils/aws.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def get_aws_metadata() -> dict:
2222
"AWS_BATCH_JOB_ATTEMPT",
2323
"AWS_BATCH_JOB_ID",
2424
"AWS_BATCH_JQ_NAME",
25+
"AWS_USER_PROVIDED_COMMAND", # we defined that ourselves in docker_entrypoint.sh
2526
]
2627
return {env_variable: os.getenv(env_variable) for env_variable in env_variables}
2728

codeclash/viewer/static/css/style.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,22 @@ summary:focus {
11991199
color: #000000;
12001200
}
12011201

1202+
/* AWS Command Display Styling */
1203+
.aws-command-display {
1204+
margin-top: 1rem;
1205+
padding-top: 1rem;
1206+
border-top: 1px solid var(--border-color);
1207+
}
1208+
1209+
.aws-command-display h4 {
1210+
margin: 0 0 0.5rem 0;
1211+
font-size: 1rem;
1212+
color: var(--accent-color);
1213+
display: flex;
1214+
align-items: center;
1215+
gap: 0.5rem;
1216+
}
1217+
12021218
.delete-experiment-btn {
12031219
background: var(--success-color);
12041220
color: white;

codeclash/viewer/static/js/clipboard.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,21 @@ function setupCopyButtons() {
9393
}
9494
});
9595
});
96+
97+
// Add event listeners to AWS command copy buttons
98+
document.querySelectorAll(".copy-aws-command-btn").forEach((button) => {
99+
button.addEventListener("click", function (e) {
100+
e.preventDefault();
101+
e.stopPropagation();
102+
103+
// Get the AWS command from the code element next to this button
104+
const codeElement = this.parentElement.querySelector(".folder-path");
105+
if (codeElement) {
106+
const command = codeElement.textContent.trim();
107+
copyToClipboard(command, this);
108+
} else {
109+
console.error("No AWS command found near button:", this);
110+
}
111+
});
112+
});
96113
}

codeclash/viewer/templates/includes/folder_path.html

Lines changed: 0 additions & 27 deletions
This file was deleted.

codeclash/viewer/templates/includes/storage.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ <h3><i class="bi bi-hdd"></i> Storage</h3>
3131
</div>
3232
</div>
3333

34+
<!-- AWS User Provided Command -->
35+
{% if metadata and metadata.results and metadata.results.aws and metadata.results.aws.AWS_USER_PROVIDED_COMMAND %}
36+
<div class="storage-item">
37+
<div class="storage-label">
38+
<i class="bi bi-cloud"></i> AWS Command:
39+
</div>
40+
<div class="storage-content">
41+
<code class="folder-path">aws/run_job.py -- {{ metadata.results.aws.AWS_USER_PROVIDED_COMMAND }}</code>
42+
<button class="btn btn-outline-primary btn-sm copy-aws-command-btn" title="Copy AWS command">
43+
<i class="bi bi-clipboard"></i> Copy command
44+
</button>
45+
</div>
46+
</div>
47+
{% endif %}
48+
3449
<!-- External Links -->
3550
<div class="storage-item">
3651
<div class="storage-label">

0 commit comments

Comments
 (0)