Skip to content

Some updates from QA #1124

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

Merged
merged 1 commit into from
Oct 26, 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
10 changes: 2 additions & 8 deletions pgml-dashboard/src/components/accordian/accordian.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ div[data-controller="accordian"] {
}

.accordian-body {
display: none;
height: 0px;
transition: all 0.5s ease-in-out;
}

.accordian-body.selected {
display: block;
height: auto;
overflow: hidden;
transition: all 0.3s ease-in-out;
}
}
39 changes: 29 additions & 10 deletions pgml-dashboard/src/components/accordian/accordian_controller.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
import { Controller } from "@hotwired/stimulus";

export default class extends Controller {
initialize() {
this.bodies = document.getElementsByClassName("accordian-body");
this.headers = document.getElementsByClassName("accordian-header");

this.heights = new Map();
for (let i = 0; i < this.bodies.length; i++) {
this.heights.set(this.bodies[i], this.bodies[i].offsetHeight);
if (i > 0) {
this.bodies[i].style.maxHeight = "0px";
} else {
this.bodies[i].style.maxHeight = this.bodies[i].offsetHeight + "px";
}
}
}


titleClick(e) {
let target = e.currentTarget.getAttribute("data-value");
let elements = document.getElementsByClassName("accordian-body");
for (let i = 0; i < elements.length; i++) {
elements[i].classList.remove("selected");
}
elements = document.getElementsByClassName("accordian-header");
for (let i = 0; i < elements.length; i++) {
elements[i].classList.remove("selected");
}
let element = document.querySelector(`[data-accordian-target="${target}"]`);
element.classList.add("selected");
e.currentTarget.classList.add("selected");

let body = document.querySelector(`[data-accordian-target="${target}"]`);
body.classList.add("selected");
body.style.maxHeight = this.heights.get(body) + "px";

for (let i = 0; i < this.bodies.length; i++) {
if (body != this.bodies[i]) {
this.bodies[i].classList.remove("selected");
this.bodies[i].style.maxHeight = "0px";
}
if (e.currentTarget != this.headers[i])
this.headers[i].classList.remove("selected");
}
}
}
4 changes: 2 additions & 2 deletions pgml-dashboard/src/components/chatbot/chatbot.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ div[data-controller="chatbot"] {
}

.chatbot-brain-option-logo {
height: 34px;
width: 34px;
height: 30px;
width: 30px;
background-position: center;
background-repeat: no-repeat;
background-size: contain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const knowledgeBaseIdToName = (knowledgeBase) => {

const createKnowledgeBaseNotice = (knowledgeBase) => {
return `
<div class="chatbot-knowledge-base-notice text-center p-1">Chatting with Knowledge Base ${knowledgeBaseIdToName(
<div class="chatbot-knowledge-base-notice text-center p-3">Chatting with Knowledge Base ${knowledgeBaseIdToName(
knowledgeBase,
)}</div>
`;
Expand Down
4 changes: 2 additions & 2 deletions pgml-dashboard/src/components/chatbot/template.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div id="chatbot" data-controller="chatbot" class="container">
<div id="chatbot-inner-wrapper" class="d-flex rounded-3 overflow-hidden">
<div id="chatbot-left-column" class="">
<div id="chatbot-left-column" class="d-none d-sm-block">

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

<div id="chatbot-right-column" class="flex-grow-1 d-flex flex-column overflow-hidden">
<div class="d-flex justify-content-between align-items-center pt-3 pb-3 pe-3 m-0">
<h3 id="chatbot-chatbot-title">Chatbot</h3>
<h3 id="chatbot-chatbot-title" class="mb-0">Chatbot</h3>
<div id="chatbot-expand-contract-image-wrapper" class="p-1 rounded-2" data-action="click->chatbot#handleExpandClick">
<img id="chatbot-expand-contract-image" width="28px" height="28px" src="/dashboard/static/images/icons/arrow_expanded.svg"/>
</div>
Expand Down
4 changes: 4 additions & 0 deletions pgml-dashboard/src/components/star/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const SVGS: Lazy<HashMap<&'static str, &'static str>> = Lazy::new(|| {
"give_it_a_spin",
include_str!("../../../static/images/icons/stars/give_it_a_spin.svg"),
);
map.insert(
"give_it_a_spin_outline",
include_str!("../../../static/images/icons/stars/give_it_a_spin_outline.svg"),
);
map
});

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions pgml-dashboard/static/images/icons/stars/give_it_a_spin_text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.