feat: Add Error Reporting to community templates (#19140)

* feat: Add Error Reporting to community templates

* Update ui/src/templates/components/CommunityTemplateImportOverlay.tsx

Co-authored-by: Bucky Schwarz <hoorayimhelping@users.noreply.github.com>

* Update ui/src/templates/containers/CommunityTemplatesIndex.tsx

Co-authored-by: Bucky Schwarz <hoorayimhelping@users.noreply.github.com>

* feat: Add Error Reporting to community templates

fix prettier

Co-authored-by: Bucky Schwarz <hoorayimhelping@users.noreply.github.com>
pull/19151/head
Zoe Steinkamp 2020-07-29 15:36:01 -06:00 committed by GitHub
parent baa8323431
commit c4972715c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -19,6 +19,7 @@ import {ComponentStatus} from '@influxdata/clockface'
// Utils
import {getByID} from 'src/resources/selectors'
import {getGithubUrlFromTemplateDetails} from 'src/templates/utils'
import {reportError} from 'src/shared/utils/errors'
import {
installTemplate,
@ -96,6 +97,9 @@ class UnconnectedTemplateImportOverlay extends PureComponent<Props> {
return summary
} catch (err) {
this.props.notify(communityTemplateInstallFailed(err.message))
reportError(err, {
name: 'The community template fetch for preview failed',
})
}
}
@ -126,14 +130,16 @@ class UnconnectedTemplateImportOverlay extends PureComponent<Props> {
)
} catch (err) {
this.props.notify(communityTemplateInstallFailed(err.message))
reportError(err, {name: 'Failed to install community template'})
}
try {
await updateStackName(summary.stackID, templateName)
this.props.notify(communityTemplateInstallSucceeded(templateName))
} catch {
} catch (err) {
this.props.notify(communityTemplateRenameFailed())
reportError(err, {name: 'The community template rename failed'})
} finally {
this.props.fetchAndSetStacks(org.id)
this.onDismiss()

View File

@ -28,6 +28,9 @@ import {TemplateKind} from 'src/client'
// API
import {deleteStack} from 'src/templates/api'
//Utils
import {reportError} from 'src/shared/utils/errors'
interface OwnProps {
orgID: string
}
@ -53,6 +56,7 @@ class CommunityTemplatesInstalledListUnconnected extends PureComponent<Props> {
this.props.fetchAndSetStacks(this.props.orgID)
} catch (err) {
this.props.notify(communityTemplateFetchStackFailed(err.message))
reportError(err, {name: 'The community template fetch stack failed'})
}
}
@ -89,6 +93,7 @@ class CommunityTemplatesInstalledListUnconnected extends PureComponent<Props> {
this.props.notify(communityTemplateDeleteSucceeded(stackID))
} catch (err) {
this.props.notify(communityTemplateDeleteFailed(err.message))
reportError(err, {name: 'The community template delete failed'})
} finally {
this.props.fetchAndSetStacks(this.props.orgID)
}

View File

@ -40,6 +40,7 @@ import {
getGithubUrlFromTemplateDetails,
getTemplateDetails,
} from 'src/templates/utils'
import {reportError} from 'src/shared/utils/errors'
import {communityTemplateUnsupportedFormatError} from 'src/shared/copy/notifications'
// Types
@ -169,6 +170,9 @@ class UnconnectedTemplatesIndex extends Component<Props> {
)
} catch (err) {
this.props.notify(communityTemplateUnsupportedFormatError())
reportError(err, {
name: 'The community template getTemplateDetails failed',
})
}
}