mirror of
https://github.com/harness/drone.git
synced 2025-05-31 11:43:15 +00:00
fix: [code-411]: addressed comments
This commit is contained in:
parent
8ef7a3f98a
commit
c3b945623b
@ -92,7 +92,7 @@ export function FileContent({
|
||||
},
|
||||
[space]
|
||||
)
|
||||
function checkPermTagTooltip(): { disabled: boolean; tooltip: JSX.Element | string | undefined } {
|
||||
const permsFinal = useMemo(() => {
|
||||
const perms = permissionProps(permPushResult, standalone)
|
||||
if (isRefATag(gitRef) && perms) {
|
||||
return { tooltip: perms.tooltip, disabled: true }
|
||||
@ -103,8 +103,8 @@ export function FileContent({
|
||||
} else if (perms?.disabled) {
|
||||
return { disabled: perms.disabled, tooltip: perms.tooltip }
|
||||
}
|
||||
return { disabled: isRefATag(gitRef), tooltip: undefined }
|
||||
}
|
||||
return { disabled: isRefATag(gitRef) || false, tooltip: undefined }
|
||||
}, [permPushResult, gitRef])
|
||||
|
||||
return (
|
||||
<Container className={css.tabsContainer}>
|
||||
@ -139,7 +139,8 @@ export function FileContent({
|
||||
text={getString('edit')}
|
||||
icon="code-edit"
|
||||
tooltipProps={{ isDark: true }}
|
||||
{...checkPermTagTooltip()}
|
||||
tooltip={permsFinal.tooltip}
|
||||
disabled={permsFinal.disabled}
|
||||
onClick={() => {
|
||||
history.push(
|
||||
routes.toCODEFileEdit({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React from 'react'
|
||||
import React, { useMemo } from 'react'
|
||||
import { Container, Color, Layout, FlexExpander, ButtonVariation, Heading, Icon, ButtonSize } from '@harness/uicore'
|
||||
import { Render } from 'react-jsx-match'
|
||||
import { useHistory } from 'react-router-dom'
|
||||
@ -51,7 +51,8 @@ function ReadmeViewer({ metadata, gitRef, readmeInfo, contentOnly, maxWidth }: F
|
||||
},
|
||||
[space]
|
||||
)
|
||||
function checkPermTagTooltip(): { disabled: boolean; tooltip: JSX.Element | string | undefined } {
|
||||
|
||||
const permsFinal = useMemo(() => {
|
||||
const perms = permissionProps(permPushResult, standalone)
|
||||
if (gitRef && isRefATag(gitRef) && perms) {
|
||||
return { tooltip: perms.tooltip, disabled: true }
|
||||
@ -63,7 +64,8 @@ function ReadmeViewer({ metadata, gitRef, readmeInfo, contentOnly, maxWidth }: F
|
||||
return { disabled: perms.disabled, tooltip: perms.tooltip }
|
||||
}
|
||||
return { disabled: (gitRef && isRefATag(gitRef)) || false, tooltip: undefined }
|
||||
}
|
||||
}, [permPushResult, gitRef])
|
||||
|
||||
return (
|
||||
<Container
|
||||
className={cx(css.readmeContainer, { [css.contentOnly]: contentOnly })}
|
||||
@ -81,7 +83,8 @@ function ReadmeViewer({ metadata, gitRef, readmeInfo, contentOnly, maxWidth }: F
|
||||
iconProps={{ size: 16 }}
|
||||
text={getString('edit')}
|
||||
icon="code-edit"
|
||||
{...checkPermTagTooltip()}
|
||||
tooltip={permsFinal.tooltip}
|
||||
disabled={permsFinal.disabled}
|
||||
onClick={() => {
|
||||
history.push(
|
||||
routes.toCODEFileEdit({
|
||||
|
Loading…
x
Reference in New Issue
Block a user