mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
@ -2,7 +2,6 @@ package cli
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -16,10 +15,11 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"cloud.google.com/go/compute/metadata"
|
"cloud.google.com/go/compute/metadata"
|
||||||
"github.com/coder/retry"
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
"gopkg.in/natefinch/lumberjack.v2"
|
"gopkg.in/natefinch/lumberjack.v2"
|
||||||
|
|
||||||
|
"github.com/coder/retry"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
|
||||||
"cdr.dev/slog"
|
"cdr.dev/slog"
|
||||||
@ -66,8 +66,7 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
|
|||||||
Handler: func(inv *serpent.Invocation) error {
|
Handler: func(inv *serpent.Invocation) error {
|
||||||
ctx, cancel := context.WithCancelCause(inv.Context())
|
ctx, cancel := context.WithCancelCause(inv.Context())
|
||||||
defer func() {
|
defer func() {
|
||||||
fmt.Printf(">>>>>CANCELING CONTEXT")
|
cancel(xerrors.New("defer"))
|
||||||
cancel(errors.New("defer"))
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -1070,7 +1070,7 @@ func (api *API) workspaceAgentReinit(rw http.ResponseWriter, r *http.Request) {
|
|||||||
workspace, err := api.Database.GetWorkspaceByAgentID(ctx, workspaceAgent.ID)
|
workspace, err := api.Database.GetWorkspaceByAgentID(ctx, workspaceAgent.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(ctx, "failed to retrieve workspace from agent token", slog.Error(err))
|
log.Error(ctx, "failed to retrieve workspace from agent token", slog.Error(err))
|
||||||
httpapi.InternalServerError(rw, errors.New("failed to determine workspace from agent token"))
|
httpapi.InternalServerError(rw, xerrors.New("failed to determine workspace from agent token"))
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info(ctx, "agent waiting for reinit instruction")
|
log.Info(ctx, "agent waiting for reinit instruction")
|
||||||
@ -1094,7 +1094,7 @@ func (api *API) workspaceAgentReinit(rw http.ResponseWriter, r *http.Request) {
|
|||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(ctx, "failed to subscribe to prebuild claimed channel", slog.Error(err))
|
log.Error(ctx, "failed to subscribe to prebuild claimed channel", slog.Error(err))
|
||||||
httpapi.InternalServerError(rw, errors.New("failed to subscribe to prebuild claimed channel"))
|
httpapi.InternalServerError(rw, xerrors.New("failed to subscribe to prebuild claimed channel"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer cancelSub()
|
defer cancelSub()
|
||||||
|
@ -15,6 +15,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/coder/terraform-provider-coder/provider"
|
||||||
|
|
||||||
"github.com/hashicorp/go-version"
|
"github.com/hashicorp/go-version"
|
||||||
tfjson "github.com/hashicorp/terraform-json"
|
tfjson "github.com/hashicorp/terraform-json"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
import {action} from "@storybook/addon-actions";
|
import { action } from "@storybook/addon-actions";
|
||||||
import type {Meta, StoryObj} from "@storybook/react";
|
import type { Meta, StoryObj } from "@storybook/react";
|
||||||
import {within } from "@testing-library/react";
|
import { within } from "@testing-library/react";
|
||||||
import userEvent from "@testing-library/user-event";
|
import userEvent from "@testing-library/user-event";
|
||||||
import {chromatic} from "testHelpers/chromatic";
|
import { chromatic } from "testHelpers/chromatic";
|
||||||
import {
|
import {
|
||||||
mockApiError,
|
|
||||||
MockTemplate,
|
MockTemplate,
|
||||||
MockTemplateVersionParameter1,
|
MockTemplateVersionParameter1,
|
||||||
MockTemplateVersionParameter2,
|
MockTemplateVersionParameter2,
|
||||||
MockTemplateVersionParameter3,
|
MockTemplateVersionParameter3,
|
||||||
MockUser,
|
MockUser,
|
||||||
|
mockApiError,
|
||||||
} from "testHelpers/entities";
|
} from "testHelpers/entities";
|
||||||
import {CreateWorkspacePageView} from "./CreateWorkspacePageView";
|
import { CreateWorkspacePageView } from "./CreateWorkspacePageView";
|
||||||
|
|
||||||
const meta: Meta<typeof CreateWorkspacePageView> = {
|
const meta: Meta<typeof CreateWorkspacePageView> = {
|
||||||
title: "pages/CreateWorkspacePage",
|
title: "pages/CreateWorkspacePage",
|
||||||
parameters: {chromatic},
|
parameters: { chromatic },
|
||||||
component: CreateWorkspacePageView,
|
component: CreateWorkspacePageView,
|
||||||
args: {
|
args: {
|
||||||
defaultName: "",
|
defaultName: "",
|
||||||
@ -128,8 +128,8 @@ export const PresetsButNoneSelected: Story = {
|
|||||||
{
|
{
|
||||||
Name: MockTemplateVersionParameter1.name,
|
Name: MockTemplateVersionParameter1.name,
|
||||||
Value: "preset 1 override",
|
Value: "preset 1 override",
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ID: "preset-2",
|
ID: "preset-2",
|
||||||
@ -138,8 +138,8 @@ export const PresetsButNoneSelected: Story = {
|
|||||||
{
|
{
|
||||||
Name: MockTemplateVersionParameter2.name,
|
Name: MockTemplateVersionParameter2.name,
|
||||||
Value: "42",
|
Value: "42",
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
parameters: [
|
parameters: [
|
||||||
|
@ -262,7 +262,10 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
form.setFieldValue("template_version_preset_id", option?.value)
|
form.setFieldValue(
|
||||||
|
"template_version_preset_id",
|
||||||
|
option?.value,
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
placeholder="Select a preset"
|
placeholder="Select a preset"
|
||||||
selectedOption={presetOptions[selectedPresetIndex]}
|
selectedOption={presetOptions[selectedPresetIndex]}
|
||||||
|
Reference in New Issue
Block a user