Merge branch 'ui-fix-markdown-edit' of _OKE5H2PQKOUfzFFDuD4FA/default/CODE/gitness (#166)

This commit is contained in:
Tan Nhu 2023-06-27 21:27:52 +00:00 committed by Harness
commit 14f6c2460f
2 changed files with 18 additions and 7 deletions

View File

@ -53,7 +53,7 @@ export function FileContent({
const { routes } = useAppContext()
const { getString } = useStrings()
const downloadFile = useDownloadRawFile()
const { category, isFileTooLarge, isViewable, filename, extension, size, base64Data, rawURL } =
const { category, isText, isFileTooLarge, isViewable, filename, extension, size, base64Data, rawURL } =
useFileContentViewerDecision({ repoMetadata, gitRef, resourcePath, resourceContent })
const history = useHistory()
const [activeTab, setActiveTab] = React.useState<string>(FileSection.CONTENT)
@ -91,7 +91,6 @@ export function FileContent({
const { standalone } = useAppContext()
const { hooks } = useAppContext()
const space = useGetSpaceParam()
const isATextFile = category === FileCategory.TEXT
const permPushResult = hooks?.usePermissionTranslate?.(
{
resource: {
@ -177,7 +176,7 @@ export function FileContent({
icon="code-edit"
tooltipProps={{ isDark: true }}
tooltip={permsFinal.tooltip}
disabled={permsFinal.disabled || !isATextFile}
disabled={permsFinal.disabled || !isText}
onClick={() => {
history.push(
routes.toCODEFileEdit({

View File

@ -60,14 +60,12 @@ export function useFileContentViewerDecision({
const isFileTooLarge = resourceData?.size !== resourceData?.data_size
const rawURL = `/code/api/v1/repos/${repoMetadata?.path}/+/raw/${resourcePath}?routingId=${routingId}&git_ref=${gitRef}`
// TODO: TEST ONLY
// const rawURL = `https://localhost:8181/rawfile/${filename}`
return {
category,
isFileTooLarge,
isViewable,
isText,
filename,
extension,
@ -439,7 +437,21 @@ const TextExtensions = [
'yml',
'zsh',
'zshrc',
'ics'
'ics',
'rego',
'tf',
'hcl',
'mod',
'sum',
'rst',
'toml',
'abap',
'uos',
'uot',
'ahk',
'asciidoc',
'slk'
]
const SpecialTextFiles = [