Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb7550bf

Browse files
chore(site): remove unecessary types and move types to where they are used (#9621)
1 parent0e28397 commitb7550bf

File tree

21 files changed

+70
-87
lines changed

21 files changed

+70
-87
lines changed

‎site/src/api/api.ts‎

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
importaxiosfrom"axios";
22
importdayjsfrom"dayjs";
3-
import*asTypesfrom"./types";
4-
import{DeploymentConfig}from"./types";
53
import*asTypesGenfrom"./typesGenerated";
64
import{delay}from"utils/delay";
75
importuserAgentParserfrom"ua-parser-js";
@@ -365,8 +363,8 @@ export const createTemplate = async (
365363
exportconstupdateActiveTemplateVersion=async(
366364
templateId:string,
367365
data:TypesGen.UpdateActiveTemplateVersion,
368-
):Promise<Types.Message>=>{
369-
constresponse=awaitaxios.patch<Types.Message>(
366+
)=>{
367+
constresponse=awaitaxios.patch<TypesGen.Response>(
370368
`/api/v2/templates/${templateId}/versions`,
371369
data,
372370
);
@@ -547,7 +545,7 @@ export const deleteWorkspace = (
547545

548546
exportconstcancelWorkspaceBuild=async(
549547
workspaceBuildId:TypesGen.WorkspaceBuild["id"],
550-
):Promise<Types.Message>=>{
548+
):Promise<TypesGen.Response>=>{
551549
constresponse=awaitaxios.patch(
552550
`/api/v2/workspacebuilds/${workspaceBuildId}/cancel`,
553551
);
@@ -595,7 +593,7 @@ export const restartWorkspace = async ({
595593

596594
exportconstcancelTemplateVersionBuild=async(
597595
templateVersionId:TypesGen.TemplateVersion["id"],
598-
):Promise<Types.Message>=>{
596+
):Promise<TypesGen.Response>=>{
599597
constresponse=awaitaxios.patch(
600598
`/api/v2/templateversions/${templateVersionId}/cancel`,
601599
);
@@ -985,6 +983,29 @@ export const getDeploymentSSHConfig =
985983
returnresponse.data;
986984
};
987985

986+
// The Deployment types are not generated on from the Go generator yet because
987+
// it does not know how to generate OptionSet
988+
exportinterfaceDeploymentGroup{
989+
readonlyname:string;
990+
readonlyparent?:DeploymentGroup;
991+
readonlydescription:string;
992+
readonlychildren:DeploymentGroup[];
993+
}
994+
exportinterfaceDeploymentOption{
995+
readonlyname:string;
996+
readonlydescription:string;
997+
readonlyflag:string;
998+
readonlyflag_shorthand:string;
999+
readonlyvalue:unknown;
1000+
readonlyhidden:boolean;
1001+
readonlygroup?:DeploymentGroup;
1002+
}
1003+
1004+
exporttypeDeploymentConfig={
1005+
readonlyconfig:TypesGen.DeploymentValues;
1006+
readonlyoptions:DeploymentOption[];
1007+
};
1008+
9881009
exportconstgetDeploymentValues=async():Promise<DeploymentConfig>=>{
9891010
constresponse=awaitaxios.get(`/api/v2/deployment/config`);
9901011
returnresponse.data;

‎site/src/api/types.ts‎

Lines changed: 0 additions & 40 deletions
This file was deleted.

‎site/src/components/DeploySettingsLayout/DeploySettingsLayout.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { deploymentConfigMachine } from "xServices/deploymentConfig/deploymentCo
1010
import{RequirePermission}from"components/RequirePermission/RequirePermission";
1111
import{usePermissions}from"hooks/usePermissions";
1212
import{Outlet}from"react-router-dom";
13-
import{DeploymentConfig}from"api/types";
13+
import{DeploymentConfig}from"api/api";
1414

1515
typeDeploySettingsContextValue={
1616
deploymentValues:DeploymentConfig;

‎site/src/components/DeploySettingsLayout/OptionsTable.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import TableCell from "@mui/material/TableCell";
55
importTableContainerfrom"@mui/material/TableContainer";
66
importTableHeadfrom"@mui/material/TableHead";
77
importTableRowfrom"@mui/material/TableRow";
8-
import{DeploymentOption}from"api/types";
98
import{
109
OptionDescription,
1110
OptionName,
1211
OptionValue,
1312
}from"components/DeploySettingsLayout/Option";
1413
import{FC}from"react";
1514
import{optionValue}from"./optionValue";
15+
import{DeploymentOption}from"api/api";
1616

1717
constOptionsTable:FC<{
1818
options:DeploymentOption[];

‎site/src/components/DeploySettingsLayout/optionValue.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import{DeploymentOption}from"api/api";
12
import{optionValue}from"./optionValue";
2-
import{DeploymentOption}from"api/types";
33

44
constdefaultOption:DeploymentOption={
55
name:"",

‎site/src/components/DeploySettingsLayout/optionValue.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import{DeploymentOption}from"api/types";
1+
import{DeploymentOption}from"api/api";
22
import{intervalToDuration,formatDuration}from"date-fns";
33

44
// optionValue is a helper function to format the value of a specific deployment options

‎site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
importBoxfrom"@mui/material/Box";
2-
import{DeploymentOption}from"api/types";
32
import{DAUsResponse}from"api/typesGenerated";
43
import{ErrorAlert}from"components/Alert/ErrorAlert";
54
import{DAUChart,DAUTitle}from"components/DAUChart/DAUChart";
@@ -9,6 +8,7 @@ import { Stack } from "components/Stack/Stack";
98
import{ChartSection}from"./ChartSection";
109
import{useDeploymentOptions}from"utils/deployOptions";
1110
import{docs}from"utils/docs";
11+
import{DeploymentOption}from"api/api";
1212

1313
exporttypeGeneralSettingsPageViewProps={
1414
deploymentOptions:DeploymentOption[];

‎site/src/pages/DeploySettingsPage/NetworkSettingsPage/NetworkSettingsPageView.stories.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import{DeploymentGroup}from"api/types";
1+
import{DeploymentGroup}from"api/api";
22
import{NetworkSettingsPageView}from"./NetworkSettingsPageView";
33
importtype{Meta,StoryObj}from"@storybook/react";
44

‎site/src/pages/DeploySettingsPage/NetworkSettingsPage/NetworkSettingsPageView.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import{DeploymentOption}from"api/types";
1+
import{DeploymentOption}from"api/api";
22
import{
33
Badges,
44
EnabledBadge,

‎site/src/pages/DeploySettingsPage/SecuritySettingsPage/SecuritySettingsPageView.stories.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import{DeploymentGroup,DeploymentOption}from"api/types";
1+
import{DeploymentGroup,DeploymentOption}from"api/api";
22
import{SecuritySettingsPageView}from"./SecuritySettingsPageView";
33
importtype{Meta,StoryObj}from"@storybook/react";
44

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp