Skip to content

feature: allow editing workspace deadline in UI #2721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 30, 2022
Prev Previous commit
Next Next commit
fmt
  • Loading branch information
johnstcn committed Jun 30, 2022
commit ef4ea0c0845b371d8a39bdecc7e4321a89ae03f3
2 changes: 1 addition & 1 deletion site/src/api/api.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import axios, { AxiosRequestHeaders } from "axios"
import dayjs from "dayjs"
import * as Types from "./types"
import { WorkspaceBuildTransition } from "./types"
import * as TypesGen from "./typesGenerated"
import dayjs from "dayjs"

const CONTENT_TYPE_JSON: AxiosRequestHeaders = {
"Content-Type": "application/json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
* @fileoverview workspaceScheduleBanner is an xstate machine backing a form,
* presented as an Alert/banner, for reactively updating a workspace schedule.
*/
import dayjs from "dayjs"
import { createMachine } from "xstate"
import * as API from "../../api/api"
import dayjs from "dayjs"
import { displayError, displaySuccess } from "../../components/GlobalSnackbar/utils"

export const Language = {
errorExtension: "Failed to extend workspace deadline.",
successExtension: "Successfully extended workspace deadline.",
}

export type WorkspaceScheduleBannerEvent = { type: "UPDATE_DEADLINE"; workspaceId: string, newDeadline: dayjs.Dayjs }
export type WorkspaceScheduleBannerEvent = {
type: "UPDATE_DEADLINE"
workspaceId: string
newDeadline: dayjs.Dayjs
}

export const workspaceScheduleBannerMachine = createMachine(
{
Expand Down Expand Up @@ -57,7 +61,7 @@ export const workspaceScheduleBannerMachine = createMachine(

services: {
updateDeadline: async (_, event) => {
await API.putWorkspaceExtension(event.workspaceId, event.newDeadline )
await API.putWorkspaceExtension(event.workspaceId, event.newDeadline)
},
},
},
Expand Down