Skip to content

Commit 49a1fe0

Browse files
fix(front): Expand button UI bugs (#349)
## 📝 Description When I implemented the Expand Button I forgot to treat the following cases: - Dark Theme ENABLED: Add dark style to expand button - Sticky Commands Disabled: Don't show expand buttons for non-sticky commands since it is not required, and it will not fix any ui issues. All values used in this UI are mocks. https://github.com/user-attachments/assets/30b2ebfa-0969-402b-84c9-993caee8790b ## ✅ Checklist - [x] I have tested this change - [ ] This change requires documentation update Co-authored-by: Pedro Foresti Leão <[email protected]>
1 parent 076b8ca commit 49a1fe0

File tree

3 files changed

+44
-12
lines changed

3 files changed

+44
-12
lines changed

front/assets/css/app-semaphore-min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

front/assets/css/app-semaphore.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,16 @@ li.projects-menu-item-special:hover {
14661466
background-color: #c7edff;
14671467
color: #202B30;
14681468
}
1469+
1470+
.job-log-container--dark .job-log-line-expand {
1471+
background-color: #242f32;
1472+
}
1473+
1474+
.job-log-container--dark .job-log-line-expand:hover {
1475+
background-color: #0d1517;
1476+
color: #B5BCC0;
1477+
}
1478+
14691479
.job-log-loading {
14701480
position: relative;
14711481
overflow: hidden;

front/assets/js/job_logs/logs.js

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,7 @@ export class JobLogs {
117117
}
118118

119119
setupFoldExpandButtons() {
120-
document.querySelectorAll('.job-log-line.command').forEach((element) => {
121-
const fold = element.closest(".job-log-fold");
122-
const expandButton = fold?.querySelector(".job-log-line-expand");
123-
124-
if (element.offsetHeight >= 250) {
125-
expandButton.style.top = element.offsetHeight.toString() + "px"
126-
expandButton?.classList.remove("dn");
127-
} else {
128-
expandButton?.classList.add("dn");
129-
}
130-
});
120+
this.configureExpandsButton()
131121

132122
this.on("click", ".job-log-line-expand", (e) => {
133123
const fold = e.target.closest(".job-log-fold");
@@ -156,8 +146,40 @@ export class JobLogs {
156146
expandButton.style.top = jobCommand.offsetHeight.toString() + "px"
157147
}
158148

149+
configureExpandsButton() {
150+
if (State.get("sticky")) {
151+
this.enableExpandsButton()
152+
} else {
153+
this.disableExpandsButton()
154+
}
155+
}
156+
157+
enableExpandsButton() {
158+
document.querySelectorAll('.job-log-line.command').forEach((element) => {
159+
const fold = element.closest(".job-log-fold");
160+
const expandButton = fold?.querySelector(".job-log-line-expand");
161+
162+
if (element.offsetHeight >= 250) {
163+
expandButton.style.top = element.offsetHeight.toString() + "px"
164+
expandButton?.classList.remove("dn");
165+
} else {
166+
expandButton?.classList.add("dn");
167+
}
168+
});
169+
}
170+
171+
disableExpandsButton() {
172+
document.querySelectorAll('.job-log-line.command').forEach((element) => {
173+
const fold = element.closest(".job-log-fold");
174+
const expandButton = fold?.querySelector(".job-log-line-expand");
175+
176+
expandButton?.classList.add("dn");
177+
});
178+
}
179+
159180
update() {
160181
_.forIn(this.components, (component) => component.update())
182+
this.configureExpandsButton()
161183
}
162184

163185
on(event, selector, callback) {

0 commit comments

Comments
 (0)