Skip to content
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

Refactor command copier #1998

Merged
merged 3 commits into from
Jul 24, 2024
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
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Please follow the established format:
- Migrate from `toposort` to `graphlib`. (#1942)
- Fix packaging. (#1766)
- Adjust requirements file and dependabot versioning strategy. (#1978)
- Refactor CommandCopier component. (#1998)

# Release 9.1.0

Expand Down
1 change: 1 addition & 0 deletions src/components/metadata/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ const MetaData = ({
<MetaDataRow label="Run Command:" visible={Boolean(runCommand)}>
<CommandCopier
command={runCommand}
classNames={'pipeline-metadata__value'}
isCommand={metadata?.runCommand}
dataTest={'metadata-copy-command'}
/>
Expand Down
10 changes: 3 additions & 7 deletions src/components/ui/command-copier/command-copier.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useState } from 'react';
import MetaDataValue from '../../metadata/metadata-value';
import classnames from 'classnames';
import IconButton from '../../ui/icon-button';
import Tooltip from '../tooltip';
import CopyIcon from '../../icons/copy';
import './command-copier.scss';

const CommandCopier = ({ command, isCommand, dataTest }) => {
const CommandCopier = ({ command, classNames, isCommand, dataTest }) => {
const [showCopied, setShowCopied] = useState(false);

const onCopyClick = () => {
Expand All @@ -17,11 +17,7 @@ const CommandCopier = ({ command, isCommand, dataTest }) => {

return (
<div className="container">
<MetaDataValue
container={'code'}
className="command-value"
value={command}
/>
<code className={classnames('command-value', classNames)}>{command}</code>
{window.navigator.clipboard && isCommand && (
<ul className="toolbox">
<IconButton
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/command-copier/command-copier.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('command copier', () => {
it('shows the node command', () => {
const wrapper = mount(<CommandCopier command={command} isCommand={true} />);

const row = wrapper.find('.pipeline-metadata__value');
const row = wrapper.find('.command-value');
expect(row.text()).toEqual('test command');
});

Expand Down
Loading