mirror of
https://github.com/czhu12/canine.git
synced 2025-12-30 15:49:54 -06:00
32 lines
730 B
JavaScript
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()
|
|
}
|
|
} |