feat: add template editor to the ui (#5963)

* Add initial editor

* Fix editor file being reset onChange

* Add updating the active build version

* Update nav height

* Add tabs

* Fix title

* Hide timestamps in build logs

* Add create file dialog

* Add validation for empty path

* Hide resources tab

* Fix label names

* Add rename and delete

* Improve UX

* Add padding to the editor

* Add dirty state

* Hide build logs until a build is made

* Add stories

* Add experiment to enable the template editor

* Fix linting errors

* Fix duplicate fields

* Fix theme type
This commit is contained in:
Kyle Carberry
2023-02-07 01:24:04 +00:00
committed by GitHub
parent 71a893764e
commit dd9e1f3d3f
27 changed files with 1751 additions and 40 deletions
+33
View File
@@ -5,6 +5,7 @@ import * as Types from "../api/types"
import * as TypesGen from "../api/typesGenerated"
import range from "lodash/range"
import { Permissions } from "xServices/auth/authXService"
import { TemplateVersionFiles } from "util/templateVersion"
export const MockTemplateDAUResponse: TypesGen.TemplateDAUsResponse = {
entries: [
@@ -270,6 +271,38 @@ export const MockTemplate: TypesGen.Template = {
allow_user_cancel_workspace_jobs: true,
}
export const MockTemplateVersionFiles: TemplateVersionFiles = {
"README.md": "# Example\n\nThis is an example template.",
"main.tf": `// Provides info about the workspace.
data "coder_workspace" "me" {}
// Provides the startup script used to download
// the agent and communicate with Coder.
resource "coder_agent" "dev" {
os = "linux"
arch = "amd64"
}
resource "kubernetes_pod" "main" {
// Ensures that the Pod dies when the workspace shuts down!
count = data.coder_workspace.me.start_count
metadata {
name = "dev-\${data.coder_workspace.me.id}"
}
spec {
container {
image = "ubuntu"
command = ["sh", "-c", coder_agent.main.init_script]
env {
name = "CODER_AGENT_TOKEN"
value = coder_agent.main.token
}
}
}
}
`,
}
export const MockWorkspaceApp: TypesGen.WorkspaceApp = {
id: "test-app",
slug: "test-app",