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

Commit7049d7a

Browse files
authored
fix: display trial errors in the dashboard (#13601)
* fix: display trial errors in the dashboardThe error was essentially being ignored before!* Remove day mention in product of trial* fmt
1 parent84cdcac commit7049d7a

File tree

4 files changed

+45
-2
lines changed

4 files changed

+45
-2
lines changed

‎cli/login.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ func (r *RootCmd) login() *serpent.Command {
239239

240240
if!inv.ParsedFlags().Changed("first-user-trial")&&os.Getenv(firstUserTrialEnv)=="" {
241241
v,_:=cliui.Prompt(inv, cliui.PromptOptions{
242-
Text:"Start a30-daytrial of Enterprise?",
242+
Text:"Start a trial of Enterprise?",
243243
IsConfirm:true,
244244
Default:"yes",
245245
})

‎enterprise/trialer/trialer.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ func New(db database.Store, url string, keys map[string]ed25519.PublicKey) func(
3939
returnxerrors.Errorf("perform license request: %w",err)
4040
}
4141
deferres.Body.Close()
42+
ifres.StatusCode>300 {
43+
body,err:=io.ReadAll(res.Body)
44+
iferr!=nil {
45+
returnxerrors.Errorf("read license response: %w",err)
46+
}
47+
// This is the format of the error response from
48+
// the license server.
49+
varmsgstruct {
50+
Errorstring`json:"error"`
51+
}
52+
err=json.Unmarshal(body,&msg)
53+
iferr!=nil {
54+
returnxerrors.Errorf("unmarshal error: %w",err)
55+
}
56+
returnxerrors.New(msg.Error)
57+
}
4258
raw,err:=io.ReadAll(res.Body)
4359
iferr!=nil {
4460
returnxerrors.Errorf("read license: %w",err)

‎site/src/pages/SetupPage/SetupPageView.stories.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ export const FormError: Story = {
2222
},
2323
};
2424

25+
exportconstTrialError:Story={
26+
args:{
27+
error:mockApiError({
28+
message:"Couldn't generate trial!",
29+
detail:"It looks like your team is already trying Coder.",
30+
}),
31+
},
32+
};
33+
2534
exportconstLoading:Story={
2635
args:{
2736
isLoading:true,

‎site/src/pages/SetupPage/SetupPageView.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
importLoadingButtonfrom"@mui/lab/LoadingButton";
2+
importAlertTitlefrom"@mui/material/AlertTitle";
23
importAutocompletefrom"@mui/material/Autocomplete";
34
importCheckboxfrom"@mui/material/Checkbox";
45
importLinkfrom"@mui/material/Link";
56
importMenuItemfrom"@mui/material/MenuItem";
67
importTextFieldfrom"@mui/material/TextField";
8+
import{isAxiosError}from"axios";
79
import{typeFormikContextType,useFormik}from"formik";
810
importtype{FC}from"react";
911
import*asYupfrom"yup";
1012
importtype*asTypesGenfrom"api/typesGenerated";
13+
import{Alert,AlertDetail}from"components/Alert/Alert";
1114
import{FormFields,VerticalForm}from"components/Form/Form";
1215
import{CoderIcon}from"components/Icons/CoderIcon";
1316
import{SignInLayout}from"components/SignInLayout/SignInLayout";
@@ -187,7 +190,7 @@ export const SetupPageView: FC<SetupPageViewProps> = ({
187190

188191
<divcss={{fontSize:14,paddingTop:4}}>
189192
<spancss={{display:"block",fontWeight:600}}>
190-
Start a30-dayfree trial of Enterprise
193+
Start a free trial of Enterprise
191194
</span>
192195
<span
193196
css={(theme)=>({
@@ -316,6 +319,21 @@ export const SetupPageView: FC<SetupPageViewProps> = ({
316319
</>
317320
)}
318321

322+
{isAxiosError(error)&&error.response?.data?.message&&(
323+
<Alertseverity="error">
324+
<AlertTitle>{error.response.data.message}</AlertTitle>
325+
{error.response.data.detail&&(
326+
<AlertDetail>
327+
{error.response.data.detail}
328+
<br/>
329+
<Linktarget="_blank"href="https://coder.com/contact/sales">
330+
Contact Sales
331+
</Link>
332+
</AlertDetail>
333+
)}
334+
</Alert>
335+
)}
336+
319337
<LoadingButton
320338
fullWidth
321339
loading={isLoading}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp