Handle error codes for bad package selection

Handles 409 and 422 HTTP codes for bad package selection. Shows
popup for appropriate error message and gives a link for build
logs.

Fixes #12
Fixes #8

Signed-off-by: Sudhanshu Gautam <me@sudhanshug.com>
This commit is contained in:
Sudhanshu Gautam 2019-08-26 01:15:05 +05:30
parent 5e3b827489
commit acdb7741e8
6 changed files with 123 additions and 65 deletions

View file

@ -9,7 +9,7 @@ import {
import React from 'react';
import PropTypes from 'prop-types';
function AlertDialog({open, cancelHandler, acceptHandler, text, title, cancelComponent, acceptComponent}) {
function AlertDialog({open, cancelHandler, acceptHandler, body, title, cancelComponent, acceptComponent}) {
return (
<Dialog
open={open}
@ -21,17 +21,24 @@ function AlertDialog({open, cancelHandler, acceptHandler, text, title, cancelCom
id="alert-dialog-title">{title}</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-description">
{text}
{body}
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={acceptHandler} color="primary">
{acceptComponent}
</Button>
<Button onClick={cancelHandler} color="secondary"
variant="contained" autoFocus>
{cancelComponent}
</Button>
{
acceptHandler && (
<Button onClick={acceptHandler} color="primary">
{acceptComponent}
</Button>
)
}
{
cancelHandler && (
<Button onClick={cancelHandler} color="secondary" variant="contained" autoFocus>
{cancelComponent}
</Button>
)
}
</DialogActions>
</Dialog>
);
@ -41,7 +48,7 @@ AlertDialog.propTypes = {
open: PropTypes.bool,
cancelHandler: PropTypes.func,
acceptHandler: PropTypes.func,
text: PropTypes.string,
body: PropTypes.object,
title: PropTypes.string,
cancelComponent: PropTypes.elementType,
acceptComponent: PropTypes.object,