-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent download of empty files and view raw logs in Pipeline Logs
- Loading branch information
1 parent
5b8f4c5
commit 617082d
Showing
4 changed files
with
129 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
.../src/concepts/pipelines/content/pipelinesDetails/pipelineRun/runLogs/DownloadDropdown.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React from 'react'; | ||
import { | ||
Dropdown, | ||
DropdownItem, | ||
DropdownToggle, | ||
KebabToggle, | ||
} from '@patternfly/react-core/deprecated'; | ||
import { Truncate } from '@patternfly/react-core'; | ||
|
||
type DownloadDropdownProps = { | ||
onDownload: () => void; | ||
onDownloadAll: () => void; | ||
isSmallScreen: boolean; | ||
isSingleStepLogsEmpty: boolean; | ||
}; | ||
|
||
const DownloadDropdown: React.FC<DownloadDropdownProps> = ({ | ||
onDownload, | ||
onDownloadAll, | ||
isSmallScreen, | ||
isSingleStepLogsEmpty, | ||
}) => { | ||
const [isDownloadDropdownOpen, setIsDownloadDropdownOpen] = React.useState(false); | ||
|
||
return isSmallScreen ? ( | ||
<Dropdown | ||
toggle={<KebabToggle onToggle={() => setIsDownloadDropdownOpen(!isDownloadDropdownOpen)} />} | ||
isOpen={isDownloadDropdownOpen} | ||
isPlain={isSmallScreen} | ||
dropdownItems={[ | ||
<DropdownItem | ||
isDisabled={isSingleStepLogsEmpty} | ||
key="current-container-logs" | ||
onClick={onDownload} | ||
> | ||
<Truncate content={'Download current step log'} /> | ||
</DropdownItem>, | ||
<DropdownItem key="all-container-logs" onClick={onDownloadAll}> | ||
<Truncate content={'Download all step logs'} /> | ||
</DropdownItem>, | ||
]} | ||
/> | ||
) : ( | ||
<Dropdown | ||
toggle={ | ||
<DropdownToggle | ||
id="download-steps-logs-toggle" | ||
onToggle={() => setIsDownloadDropdownOpen(!isDownloadDropdownOpen)} | ||
> | ||
Download | ||
</DropdownToggle> | ||
} | ||
isOpen={isDownloadDropdownOpen} | ||
dropdownItems={[ | ||
<DropdownItem | ||
isDisabled={isSingleStepLogsEmpty} | ||
key="current-container-logs" | ||
onClick={onDownload} | ||
> | ||
<Truncate content={'Current step log'} /> | ||
</DropdownItem>, | ||
<DropdownItem key="all-container-logs" onClick={onDownloadAll}> | ||
<Truncate content={'All step logs'} /> | ||
</DropdownItem>, | ||
]} | ||
/> | ||
); | ||
}; | ||
export default DownloadDropdown; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters