mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
refactor(site): Only show status after first edition (#6701)
This commit is contained in:
@@ -89,6 +89,7 @@ export const TemplateVersionEditor: FC<TemplateVersionEditorProps> = ({
|
||||
const [createFileOpen, setCreateFileOpen] = useState(false)
|
||||
const [deleteFileOpen, setDeleteFileOpen] = useState<string>()
|
||||
const [renameFileOpen, setRenameFileOpen] = useState<string>()
|
||||
const [dirty, setDirty] = useState(false)
|
||||
const [activePath, setActivePath] = useState<string | undefined>(() =>
|
||||
findInitialFile(fileTree),
|
||||
)
|
||||
@@ -139,11 +140,11 @@ export const TemplateVersionEditor: FC<TemplateVersionEditorProps> = ({
|
||||
previousVersion.current = templateVersion
|
||||
}, [templateVersion])
|
||||
|
||||
const [dirty, setDirty] = useState(false)
|
||||
const hasIcon = template.icon && template.icon !== ""
|
||||
const templateVersionSucceeded = templateVersion.job.status === "succeeded"
|
||||
const showBuildLogs = Boolean(buildLogs)
|
||||
const editorValue = getFileContent(activePath ?? "", fileTree) as string
|
||||
const firstTemplateVersionOnEditor = useRef(templateVersion)
|
||||
|
||||
useEffect(() => {
|
||||
window.dispatchEvent(new Event("resize"))
|
||||
@@ -170,9 +171,12 @@ export const TemplateVersionEditor: FC<TemplateVersionEditorProps> = ({
|
||||
</div>
|
||||
|
||||
<div className={styles.topbarSides}>
|
||||
<div className={styles.buildStatus}>
|
||||
<TemplateVersionStatusBadge version={templateVersion} />
|
||||
</div>
|
||||
{/* Only start to show the build when a new template version is building */}
|
||||
{templateVersion.id !== firstTemplateVersionOnEditor.current.id && (
|
||||
<div className={styles.buildStatus}>
|
||||
<TemplateVersionStatusBadge version={templateVersion} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Button
|
||||
title="Build template (Ctrl + Enter)"
|
||||
@@ -387,7 +391,7 @@ const useStyles = makeStyles<
|
||||
{
|
||||
templateVersionSucceeded: boolean
|
||||
showBuildLogs: boolean
|
||||
deploymentBannerVisible: boolean
|
||||
deploymentBannerVisible?: boolean
|
||||
}
|
||||
>((theme) => ({
|
||||
root: {
|
||||
|
||||
Reference in New Issue
Block a user