Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #598 from votdev/improve_err_msg
Browse files Browse the repository at this point in the history
glass: Improve error message.
  • Loading branch information
votdev committed Jul 1, 2021
2 parents 148d57d + 1c05bda commit dec8909
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { InstallWizardContext } from '~/app/pages/install-wizard/models/install-
import { StatusStageEnum } from '~/app/shared/services/api/local.service';
import { LocalNodeService, NodeStatus } from '~/app/shared/services/api/local.service';
import {
DeploymentBasicReply,
DeploymentStartReply,
DeploymentStatusReply,
NodesService,
NodeStageEnum
Expand Down Expand Up @@ -214,13 +214,15 @@ export class InstallCreateWizardPageComponent implements OnInit {
hostname: this.context.config.hostname
})
.subscribe({
next: (basicReplay: DeploymentBasicReply) => {
if (basicReplay.success) {
next: (startReplay: DeploymentStartReply) => {
if (startReplay.success) {
this.context.stage = 'bootstrapping';
this.blockUI.update(translate(TEXT('Please wait, bootstrapping in progress ...')));
this.pollBootstrapStatus();
} else {
this.handleError(TEXT('Failed to start bootstrapping the system.'));
this.handleError(
TEXT(`Failed to start bootstrapping the system: ${startReplay.error.message}`)
);
}
},
error: (err) => {
Expand Down
21 changes: 18 additions & 3 deletions src/glass/src/app/shared/services/api/nodes.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';

export enum DeploymentErrorEnum {
none = 0,
cantBootstrap = 1,
nodeNotStarted = 2,
cantJoin = 3,
cantAssimilate = 4,
unknownError = 5
}

export type DeploymentError = {
code: DeploymentErrorEnum;
message?: string;
};

export type DeploymentStartRequest = {
ntpaddr: string;
hostname: string;
Expand All @@ -17,8 +31,9 @@ export type TokenReply = {
token: string;
};

export type DeploymentBasicReply = {
export type DeploymentStartReply = {
success: boolean;
error: DeploymentError;
};

// eslint-disable-next-line no-shadow
Expand Down Expand Up @@ -98,8 +113,8 @@ export class NodesService {
/**
* Start node deployment.
*/
deploymentStart(request: DeploymentStartRequest): Observable<DeploymentBasicReply> {
return this.http.post<DeploymentBasicReply>(`${this.deploymentURL}/start`, request, {});
deploymentStart(request: DeploymentStartRequest): Observable<DeploymentStartReply> {
return this.http.post<DeploymentStartReply>(`${this.deploymentURL}/start`, request, {});
}

/**
Expand Down

0 comments on commit dec8909

Please sign in to comment.