Files
canine/app/javascript/controllers/processes_controller.js
Chris Zhu c65c7557c4 processes
2024-10-15 10:17:04 -07:00

32 lines
730 B
JavaScript

import { Controller } from "@hotwired/stimulus"
import tippy from "tippy.js";
export default class extends Controller {
static targets = ["command"]
connect() {
}
copyToClick(event) {
navigator.clipboard.writeText(this.commandTarget.textContent)
this.tooltip(event.target)
}
tooltip(target) {
tippy(target, {
content: "Copied!",
showOnCreate: true,
onHidden: (instance) => {
instance.destroy()
}
})
}
showConnectionInstructions(event) {
event.preventDefault();
const text = `KUBECONFIG=/path/to/kubeconfig kubectl exec -it ${event.target.dataset.podName} -- /bin/bash`
this.commandTarget.textContent = text
click_outside_modal.showModal()
}
}