Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Web] Handle case where creator is inaccessible #2817

Merged
merged 3 commits into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOGS/unreleased/2817-creator-exception.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Fixed

- [Web] avoids crash when the creator of a check is inaccessible.
2 changes: 1 addition & 1 deletion backend/apid/graphql/schema/silenced.gql.go

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

2 changes: 1 addition & 1 deletion backend/apid/graphql/schema/silenced.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Silenced implements Node, Namespaced, HasMetadata {
expireOnResolve: Boolean!

"Creator is the author of the silenced entry"
creator: User!
creator: User

"Check is the name of the check event to be silenced."
check: CheckConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import DialogContentParagraph from "/components/DialogContentParagraph";
import DialogTitle from "@material-ui/core/DialogTitle";
import ListController from "/components/controller/ListController";
import Loader from "/components/util/Loader";
import Maybe from "/components/Maybe";
import ResourceDetails from "/components/partials/ResourceDetails";
import SilenceExpiration from "/components/partials/SilenceExpiration";
import Table from "@material-ui/core/Table";
Expand Down Expand Up @@ -109,7 +110,9 @@ class ClearSilencedEntriesDialog extends React.PureComponent {
/>
</TableOverflowCell>
<TableCell>
<ResourceDetails title={silence.creator.username} />
<ResourceDetails
title={<Maybe value={silence.creator}>{u => u.username}</Maybe>}
/>
</TableCell>
</TableSelectableRow>
);
Expand Down
27 changes: 15 additions & 12 deletions dashboard/src/components/partials/SilencesList/SilencesListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import FaceIcon from "@material-ui/icons/Face";
import Hidden from "@material-ui/core/Hidden";
import HoverController from "/components/controller/HoverController";
import IconButton from "@material-ui/core/IconButton";
import Maybe from "/components/Maybe";
import ModalController from "/components/controller/ModalController";
import NotesIcon from "@material-ui/icons/Notes";
import { RelativeToCurrentDate } from "/components/RelativeDate";
Expand Down Expand Up @@ -114,18 +115,20 @@ class SilencesListItem extends React.Component {
paddingTop: 8, // one spacing unit
}}
>
<Chip
avatar={
<Avatar>
<FaceIcon />
</Avatar>
}
label={silence.creator.username}
style={{
// TODO: ideally have Chip scale to current fontSize(?)
transform: "scale(0.87)",
}}
/>
<Maybe value={silence.creator}>
<Chip
avatar={
<Avatar>
<FaceIcon />
</Avatar>
}
label={silence.creator.username}
style={{
// TODO: ideally have Chip scale to current fontSize(?)
transform: "scale(0.87)",
}}
/>
</Maybe>
</TableCell>
</Hidden>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable react/no-unused-prop-types */

import React from "react";
import PropTypes from "prop-types";

Expand All @@ -13,8 +15,6 @@ const styles = theme => ({

class FloatingTableToolbarCell extends React.Component {
static propTypes = {
// the linter isn't smart enough to see we use this
// eslint-disable-next-line
classes: PropTypes.object.isRequired,
disabled: PropTypes.bool,
hovered: PropTypes.bool,
Expand Down