Skip to content

Commit 0e93914

Browse files
authored
Some updates from QA (#1124)
1 parent 38ae87c commit 0e93914

File tree

8 files changed

+73
-23
lines changed

8 files changed

+73
-23
lines changed

pgml-dashboard/src/components/accordian/accordian.scss

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@ div[data-controller="accordian"] {
44
}
55

66
.accordian-body {
7-
display: none;
8-
height: 0px;
9-
transition: all 0.5s ease-in-out;
10-
}
11-
12-
.accordian-body.selected {
13-
display: block;
14-
height: auto;
7+
overflow: hidden;
8+
transition: all 0.3s ease-in-out;
159
}
1610
}
Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
11
import { Controller } from "@hotwired/stimulus";
22

33
export default class extends Controller {
4+
initialize() {
5+
this.bodies = document.getElementsByClassName("accordian-body");
6+
this.headers = document.getElementsByClassName("accordian-header");
7+
8+
this.heights = new Map();
9+
for (let i = 0; i < this.bodies.length; i++) {
10+
this.heights.set(this.bodies[i], this.bodies[i].offsetHeight);
11+
if (i > 0) {
12+
this.bodies[i].style.maxHeight = "0px";
13+
} else {
14+
this.bodies[i].style.maxHeight = this.bodies[i].offsetHeight + "px";
15+
}
16+
}
17+
}
18+
19+
420
titleClick(e) {
521
let target = e.currentTarget.getAttribute("data-value");
6-
let elements = document.getElementsByClassName("accordian-body");
7-
for (let i = 0; i < elements.length; i++) {
8-
elements[i].classList.remove("selected");
9-
}
10-
elements = document.getElementsByClassName("accordian-header");
11-
for (let i = 0; i < elements.length; i++) {
12-
elements[i].classList.remove("selected");
13-
}
14-
let element = document.querySelector(`[data-accordian-target="${target}"]`);
15-
element.classList.add("selected");
1622
e.currentTarget.classList.add("selected");
23+
24+
let body = document.querySelector(`[data-accordian-target="${target}"]`);
25+
body.classList.add("selected");
26+
body.style.maxHeight = this.heights.get(body) + "px";
27+
28+
for (let i = 0; i < this.bodies.length; i++) {
29+
if (body != this.bodies[i]) {
30+
this.bodies[i].classList.remove("selected");
31+
this.bodies[i].style.maxHeight = "0px";
32+
}
33+
if (e.currentTarget != this.headers[i])
34+
this.headers[i].classList.remove("selected");
35+
}
1736
}
1837
}

pgml-dashboard/src/components/chatbot/chatbot.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ div[data-controller="chatbot"] {
5959
}
6060

6161
.chatbot-brain-option-logo {
62-
height: 34px;
63-
width: 34px;
62+
height: 30px;
63+
width: 30px;
6464
background-position: center;
6565
background-repeat: no-repeat;
6666
background-size: contain;

pgml-dashboard/src/components/chatbot/chatbot_controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const knowledgeBaseIdToName = (knowledgeBase) => {
6565

6666
const createKnowledgeBaseNotice = (knowledgeBase) => {
6767
return `
68-
<div class="chatbot-knowledge-base-notice text-center p-1">Chatting with Knowledge Base ${knowledgeBaseIdToName(
68+
<div class="chatbot-knowledge-base-notice text-center p-3">Chatting with Knowledge Base ${knowledgeBaseIdToName(
6969
knowledgeBase,
7070
)}</div>
7171
`;

pgml-dashboard/src/components/chatbot/template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div id="chatbot" data-controller="chatbot" class="container">
22
<div id="chatbot-inner-wrapper" class="d-flex rounded-3 overflow-hidden">
3-
<div id="chatbot-left-column" class="">
3+
<div id="chatbot-left-column" class="d-none d-sm-block">
44

55
<!-- This is temporary until we have brains -->
66
<h5 id="chatbot-change-the-brain-title">Knowledge Base:</h5>
@@ -101,7 +101,7 @@ <h5 id="knowledge-base-title">Knowledge Base:</h5>
101101

102102
<div id="chatbot-right-column" class="flex-grow-1 d-flex flex-column overflow-hidden">
103103
<div class="d-flex justify-content-between align-items-center pt-3 pb-3 pe-3 m-0">
104-
<h3 id="chatbot-chatbot-title">Chatbot</h3>
104+
<h3 id="chatbot-chatbot-title" class="mb-0">Chatbot</h3>
105105
<div id="chatbot-expand-contract-image-wrapper" class="p-1 rounded-2" data-action="click->chatbot#handleExpandClick">
106106
<img id="chatbot-expand-contract-image" width="28px" height="28px" src="/dashboard/static/images/icons/arrow_expanded.svg"/>
107107
</div>

pgml-dashboard/src/components/star/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ const SVGS: Lazy<HashMap<&'static str, &'static str>> = Lazy::new(|| {
2626
"give_it_a_spin",
2727
include_str!("../../../static/images/icons/stars/give_it_a_spin.svg"),
2828
);
29+
map.insert(
30+
"give_it_a_spin_outline",
31+
include_str!("../../../static/images/icons/stars/give_it_a_spin_outline.svg"),
32+
);
2933
map
3034
});
3135

Lines changed: 9 additions & 0 deletions
Loading
Lines changed: 24 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)