mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Copy whole drawer title if no colon exists (#4120)
This commit is contained in:
parent
f1c2023533
commit
983304f824
@ -135,11 +135,10 @@ export class Drawer extends React.Component<DrawerProps> {
|
||||
if (open) onClose();
|
||||
};
|
||||
|
||||
copyK8sObjName = () => {
|
||||
const { title } = this.props;
|
||||
const k8sObjName = title.toString().split(": ")[1];
|
||||
copyTitle = (title: string) => {
|
||||
const k8sObjName = title.split(":")[1] || title; // copy whole if no :
|
||||
|
||||
clipboard.writeText(k8sObjName);
|
||||
clipboard.writeText(k8sObjName.trim());
|
||||
this.setState({isCopied: true});
|
||||
setTimeout(() => {
|
||||
this.setState({isCopied: false});
|
||||
@ -163,8 +162,8 @@ export class Drawer extends React.Component<DrawerProps> {
|
||||
<div className="drawer-title flex align-center">
|
||||
<div className="drawer-title-text flex gaps align-center">
|
||||
{title}
|
||||
{typeof title == "string" && (
|
||||
<Icon material={copyIcon} tooltip={copyTooltip} onClick={this.copyK8sObjName}/>
|
||||
{title && typeof title == "string" && (
|
||||
<Icon material={copyIcon} tooltip={copyTooltip} onClick={() => this.copyTitle(title)}/>
|
||||
)}
|
||||
</div>
|
||||
{toolbar}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user