mirror of
https://github.com/coder/coder.git
synced 2026-09-21 20:51:01 +08:00
chore(site): Remove template editor out of experimental (#7165)
This commit is contained in:
Generated
-2
@@ -7165,11 +7165,9 @@ const docTemplate = `{
|
||||
"codersdk.Experiment": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"template_editor",
|
||||
"moons"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"ExperimentTemplateEditor",
|
||||
"ExperimentMoons"
|
||||
]
|
||||
},
|
||||
|
||||
Generated
+2
-2
@@ -6420,8 +6420,8 @@
|
||||
},
|
||||
"codersdk.Experiment": {
|
||||
"type": "string",
|
||||
"enum": ["template_editor", "moons"],
|
||||
"x-enum-varnames": ["ExperimentTemplateEditor", "ExperimentMoons"]
|
||||
"enum": ["moons"],
|
||||
"x-enum-varnames": ["ExperimentMoons"]
|
||||
},
|
||||
"codersdk.Feature": {
|
||||
"type": "object",
|
||||
|
||||
@@ -1605,10 +1605,6 @@ func (c *Client) BuildInfo(ctx context.Context) (BuildInfoResponse, error) {
|
||||
type Experiment string
|
||||
|
||||
const (
|
||||
// ExperimentTemplateEditor is an internal experiment that enables the template editor
|
||||
// for all users.
|
||||
ExperimentTemplateEditor Experiment = "template_editor"
|
||||
|
||||
// ExperimentMoons enabled the workspace proxy endpoints and CRUD. This
|
||||
// feature is not yet complete in functionality.
|
||||
ExperimentMoons Experiment = "moons"
|
||||
@@ -1621,7 +1617,7 @@ const (
|
||||
// users to opt-in to via --experimental='*'.
|
||||
// Experiments that are not ready for consumption by all users should
|
||||
// not be included here and will be essentially hidden.
|
||||
var ExperimentsAll = Experiments{ExperimentTemplateEditor}
|
||||
var ExperimentsAll = Experiments{}
|
||||
|
||||
// Experiments is a list of experiments that are enabled for the deployment.
|
||||
// Multiple experiments may be enabled at the same time.
|
||||
|
||||
+1
-1
@@ -507,7 +507,7 @@ curl -X GET http://coder-server:8080/api/v2/experiments \
|
||||
> 200 Response
|
||||
|
||||
```json
|
||||
["template_editor"]
|
||||
["moons"]
|
||||
```
|
||||
|
||||
### Responses
|
||||
|
||||
+4
-5
@@ -2447,17 +2447,16 @@ CreateParameterRequest is a structure used to create a new parameter value for a
|
||||
## codersdk.Experiment
|
||||
|
||||
```json
|
||||
"template_editor"
|
||||
"moons"
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
#### Enumerated Values
|
||||
|
||||
| Value |
|
||||
| ----------------- |
|
||||
| `template_editor` |
|
||||
| `moons` |
|
||||
| Value |
|
||||
| ------- |
|
||||
| `moons` |
|
||||
|
||||
## codersdk.Feature
|
||||
|
||||
|
||||
@@ -1309,8 +1309,8 @@ export const Entitlements: Entitlement[] = [
|
||||
]
|
||||
|
||||
// From codersdk/deployment.go
|
||||
export type Experiment = "moons" | "template_editor"
|
||||
export const Experiments: Experiment[] = ["moons", "template_editor"]
|
||||
export type Experiment = "moons"
|
||||
export const Experiments: Experiment[] = ["moons"]
|
||||
|
||||
// From codersdk/deployment.go
|
||||
export type FeatureName =
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
getTemplateVersion,
|
||||
} from "api/api"
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
import { useDashboard } from "components/Dashboard/DashboardProvider"
|
||||
import { AuthorizationRequest } from "api/typesGenerated"
|
||||
|
||||
const templatePermissions = (
|
||||
@@ -72,7 +71,6 @@ export const TemplateLayout: FC<{ children?: JSX.Element }> = ({
|
||||
queryKey: ["template", templateName],
|
||||
queryFn: () => fetchTemplate(orgId, templateName),
|
||||
})
|
||||
const dashboard = useDashboard()
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
@@ -92,7 +90,6 @@ export const TemplateLayout: FC<{ children?: JSX.Element }> = ({
|
||||
template={data.template}
|
||||
activeVersion={data.activeVersion}
|
||||
permissions={data.permissions}
|
||||
canEditFiles={dashboard.experiments.includes("template_editor")}
|
||||
onDeleteTemplate={() => {
|
||||
navigate("/templates")
|
||||
}}
|
||||
|
||||
@@ -29,9 +29,8 @@ import FileCopyOutlined from "@material-ui/icons/FileCopyOutlined"
|
||||
const TemplateMenu: FC<{
|
||||
templateName: string
|
||||
templateVersion: string
|
||||
canEditFiles: boolean
|
||||
onDelete: () => void
|
||||
}> = ({ templateName, templateVersion, canEditFiles, onDelete }) => {
|
||||
}> = ({ templateName, templateVersion, onDelete }) => {
|
||||
const menuTriggerRef = useRef<HTMLButtonElement>(null)
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false)
|
||||
const navigate = useNavigate()
|
||||
@@ -69,28 +68,24 @@ const TemplateMenu: FC<{
|
||||
<SettingsOutlined />
|
||||
Settings
|
||||
</MenuItem>
|
||||
{canEditFiles && (
|
||||
<MenuItem
|
||||
onClick={onMenuItemClick(() =>
|
||||
navigate(`/templates/new?fromTemplate=${templateName}`),
|
||||
)}
|
||||
>
|
||||
<FileCopyOutlined />
|
||||
Duplicate
|
||||
</MenuItem>
|
||||
)}
|
||||
{canEditFiles && (
|
||||
<MenuItem
|
||||
onClick={onMenuItemClick(() =>
|
||||
navigate(
|
||||
`/templates/${templateName}/versions/${templateVersion}/edit`,
|
||||
),
|
||||
)}
|
||||
>
|
||||
<EditOutlined />
|
||||
Edit files
|
||||
</MenuItem>
|
||||
)}
|
||||
<MenuItem
|
||||
onClick={onMenuItemClick(() =>
|
||||
navigate(`/templates/new?fromTemplate=${templateName}`),
|
||||
)}
|
||||
>
|
||||
<FileCopyOutlined />
|
||||
Duplicate
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
onClick={onMenuItemClick(() =>
|
||||
navigate(
|
||||
`/templates/${templateName}/versions/${templateVersion}/edit`,
|
||||
),
|
||||
)}
|
||||
>
|
||||
<EditOutlined />
|
||||
Edit files
|
||||
</MenuItem>
|
||||
<MenuItem onClick={onMenuItemClick(onDelete)}>
|
||||
<DeleteOutlined />
|
||||
Delete
|
||||
@@ -117,7 +112,6 @@ export type TemplatePageHeaderProps = {
|
||||
template: Template
|
||||
activeVersion: TemplateVersion
|
||||
permissions: AuthorizationResponse
|
||||
canEditFiles: boolean
|
||||
onDeleteTemplate: () => void
|
||||
}
|
||||
|
||||
@@ -125,7 +119,6 @@ export const TemplatePageHeader: FC<TemplatePageHeaderProps> = ({
|
||||
template,
|
||||
activeVersion,
|
||||
permissions,
|
||||
canEditFiles,
|
||||
onDeleteTemplate,
|
||||
}) => {
|
||||
const hasIcon = template.icon && template.icon !== ""
|
||||
@@ -142,7 +135,6 @@ export const TemplatePageHeader: FC<TemplatePageHeaderProps> = ({
|
||||
templateVersion={activeVersion.name}
|
||||
templateName={template.name}
|
||||
onDelete={deleteTemplate.openDeleteConfirmation}
|
||||
canEditFiles={canEditFiles}
|
||||
/>
|
||||
</Maybe>
|
||||
</>
|
||||
|
||||
@@ -8,10 +8,8 @@ import { VersionsTable } from "components/VersionsTable/VersionsTable"
|
||||
import { useState } from "react"
|
||||
import { Helmet } from "react-helmet-async"
|
||||
import { getTemplatePageTitle } from "../utils"
|
||||
import { useDashboard } from "components/Dashboard/DashboardProvider"
|
||||
|
||||
const TemplateVersionsPage = () => {
|
||||
const dashboard = useDashboard()
|
||||
const { template, permissions } = useTemplateLayoutContext()
|
||||
const { data } = useQuery({
|
||||
queryKey: ["template", "versions", template.id],
|
||||
@@ -39,9 +37,6 @@ const TemplateVersionsPage = () => {
|
||||
const [selectedVersionIdToPromote, setSelectedVersionIdToPromote] = useState<
|
||||
string | undefined
|
||||
>()
|
||||
const canPromoteVersion =
|
||||
dashboard.experiments.includes("template_editor") &&
|
||||
permissions.canUpdateTemplate
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -51,7 +46,9 @@ const TemplateVersionsPage = () => {
|
||||
<VersionsTable
|
||||
versions={data}
|
||||
onPromoteClick={
|
||||
canPromoteVersion ? setSelectedVersionIdToPromote : undefined
|
||||
permissions.canUpdateTemplate
|
||||
? setSelectedVersionIdToPromote
|
||||
: undefined
|
||||
}
|
||||
activeVersionId={latestActiveVersion}
|
||||
/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useMachine } from "@xstate/react"
|
||||
import { useDashboard } from "components/Dashboard/DashboardProvider"
|
||||
import { useOrganizationId } from "hooks/useOrganizationId"
|
||||
import { useTab } from "hooks/useTab"
|
||||
import { FC } from "react"
|
||||
@@ -23,7 +22,6 @@ export const TemplateVersionPage: FC = () => {
|
||||
})
|
||||
const tab = useTab("file", "0")
|
||||
const { t } = useTranslation("templateVersionPage")
|
||||
const dashboard = useDashboard()
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -38,7 +36,6 @@ export const TemplateVersionPage: FC = () => {
|
||||
versionName={versionName}
|
||||
templateName={templateName}
|
||||
tab={tab}
|
||||
canEdit={dashboard.experiments.includes("template_editor")}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -25,7 +25,6 @@ export interface TemplateVersionPageViewProps {
|
||||
*/
|
||||
versionName: string
|
||||
templateName: string
|
||||
canEdit: boolean
|
||||
tab: UseTabResult
|
||||
context: TemplateVersionMachineContext
|
||||
}
|
||||
@@ -35,7 +34,6 @@ export const TemplateVersionPageView: FC<TemplateVersionPageViewProps> = ({
|
||||
tab,
|
||||
versionName,
|
||||
templateName,
|
||||
canEdit,
|
||||
}) => {
|
||||
const { currentFiles, error, currentVersion, previousFiles } = context
|
||||
const { t } = useTranslation("templateVersionPage")
|
||||
@@ -44,17 +42,15 @@ export const TemplateVersionPageView: FC<TemplateVersionPageViewProps> = ({
|
||||
<Margins>
|
||||
<PageHeader
|
||||
actions={
|
||||
canEdit ? (
|
||||
<Link
|
||||
underline="none"
|
||||
component={RouterLink}
|
||||
to={`/templates/${templateName}/versions/${versionName}/edit`}
|
||||
>
|
||||
<Button variant="outlined" startIcon={<EditIcon />}>
|
||||
Edit
|
||||
</Button>
|
||||
</Link>
|
||||
) : undefined
|
||||
<Link
|
||||
underline="none"
|
||||
component={RouterLink}
|
||||
to={`/templates/${templateName}/versions/${versionName}/edit`}
|
||||
>
|
||||
<Button variant="outlined" startIcon={<EditIcon />}>
|
||||
Edit
|
||||
</Button>
|
||||
</Link>
|
||||
}
|
||||
>
|
||||
<PageHeaderCaption>{t("header.caption")}</PageHeaderCaption>
|
||||
|
||||
@@ -76,7 +76,6 @@ export const WorkspaceReadyPage = ({
|
||||
queryFn: () => getTemplateVersions(workspace.template_id),
|
||||
enabled: changeVersionDialogOpen,
|
||||
})
|
||||
const dashboard = useDashboard()
|
||||
|
||||
// keep banner machine in sync with workspace
|
||||
useEffect(() => {
|
||||
@@ -137,9 +136,7 @@ export const WorkspaceReadyPage = ({
|
||||
builds={builds}
|
||||
canUpdateWorkspace={canUpdateWorkspace}
|
||||
canUpdateTemplate={canUpdateTemplate}
|
||||
canChangeVersions={
|
||||
canUpdateTemplate && dashboard.experiments.includes("template_editor")
|
||||
}
|
||||
canChangeVersions={canUpdateTemplate}
|
||||
hideSSHButton={featureVisibility["browser_only"]}
|
||||
hideVSCodeDesktopButton={featureVisibility["browser_only"]}
|
||||
workspaceErrors={{
|
||||
|
||||
Reference in New Issue
Block a user