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

Commit

Permalink
fix(alerting): fixed error handling
Browse files Browse the repository at this point in the history
When deleting an application that didn't exist, no error was
returned.
Now the error is correctly visualised to the user together
with the details of what happened.
This required the admin client
library to be updated.
  • Loading branch information
ziccardi authored and secondsun committed Sep 16, 2020
1 parent 97bd7c1 commit 0fddbd9
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 12 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@aerogear/unifiedpush-admin-client": "4.1.0",
"@aerogear/unifiedpush-admin-client": "4.2.1",
"@fortawesome/fontawesome-free": "^5.13.0",
"@patternfly/react-core": "4.18.5",
"@types/react-router-dom": "^5.1.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,11 @@ export class RenewVariantSecret extends Component<Props, State> {
this.props.variant.variantID
)
.execute();
console.log({ old: this.props.variant, new: variant });
await this.setState({ refreshing: false });
this.props.onRefreshed(variant);
};

const handleAppNameInput = (value: string) => {
console.log('verify', value);
if (value === this.props.variant.name) {
this.setState({ nameValid: ValidatedOptions.success });
} else {
Expand Down
2 changes: 0 additions & 2 deletions src/application/ApplicationList/ApplicationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,11 @@ export class ApplicationList extends Component<Props, State> {
variant={PaginationVariant.bottom}
onNextClick={(_event, currentPage) => {
this.setState({ currentPage });
console.log(currentPage);
refresh(currentPage - 1);
}}
onPreviousClick={(_event, currentPage) => {
this.setState({ currentPage });
refresh(currentPage - 1);
console.log(currentPage);
}}
/>
</>
Expand Down
1 change: 0 additions & 1 deletion src/application/VariantForms/VariantSelectionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ export class VariantSelectionForm extends Component<Props, State> {
variant: VariantDefinition,
variantType: VariantType
) => {
console.log('Creating Variant');
try {
const newVariant = await UpsClientFactory.getUpsClient()
.variants[variantType].create(
Expand Down
7 changes: 6 additions & 1 deletion src/application/crud/CreateApplicationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import {
} from '@patternfly/react-core';
import { UpsClientFactory } from '../../utils/UpsClientFactory';
import { PushApplication } from '@aerogear/unifiedpush-admin-client';
import {
ApplicationListContext,
ContextInterface,
} from '../../context/Context';

interface State {
appName: string;
Expand All @@ -39,7 +43,7 @@ export class CreateApplicationPage extends Component<Props, State> {
.execute();
this.props.onFinished(app);
} catch (err) {
console.log(err);
(this.context as ContextInterface).alert(err);
}
};

Expand Down Expand Up @@ -88,3 +92,4 @@ export class CreateApplicationPage extends Component<Props, State> {
);
}
}
CreateApplicationPage.contextType = ApplicationListContext;
8 changes: 7 additions & 1 deletion src/application/crud/DeleteApplicationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import {
Modal,
} from '@patternfly/react-core';
import { PushApplication } from '@aerogear/unifiedpush-admin-client';
import {
ApplicationListContext,
ContextInterface,
} from '../../context/Context';

interface State {
name: string;
Expand Down Expand Up @@ -40,7 +44,7 @@ export class DeleteApplicationPage extends Component<Props, State> {
this.props.close();
}
} catch (err) {
console.log(err);
(this.context as ContextInterface).alert(err);
}
};

Expand All @@ -66,6 +70,7 @@ export class DeleteApplicationPage extends Component<Props, State> {
fieldId="simple-form-input"
>
<TextInput
id="app-name"
className="formInput"
onChange={value => this.setState({ name: value })}
isRequired
Expand All @@ -91,3 +96,4 @@ export class DeleteApplicationPage extends Component<Props, State> {
);
}
}
DeleteApplicationPage.contextType = ApplicationListContext;
7 changes: 6 additions & 1 deletion src/application/crud/UpdateApplicationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import {
Modal,
} from '@patternfly/react-core';
import { PushApplication } from '@aerogear/unifiedpush-admin-client';
import {
ApplicationListContext,
ContextInterface,
} from '../../context/Context';

interface State {
name?: string;
Expand Down Expand Up @@ -35,7 +39,7 @@ export class UpdateApplicationPage extends Component<Props, State> {
.execute();
this.props.close();
} catch (err) {
console.log(err);
(this.context as ContextInterface).alert(err);
}
};

Expand Down Expand Up @@ -75,3 +79,4 @@ export class UpdateApplicationPage extends Component<Props, State> {
);
}
}
UpdateApplicationPage.contextType = ApplicationListContext;

0 comments on commit 0fddbd9

Please sign in to comment.