* UI spring cleaning
- fix ~570 outstanding eslint warnings
- make eslint force user to correct warnings
- remove .css files that are not referenced
- remove dummy.tsx as it is not consumed anywhere
- remove a few functions that were "dead code" (ie. not consumed anywhere)
- remove commented out blocks of code that had no explanatory comments surrounding them
* add prettier to pre-commit configuration
* change ignoreRestSiblings to true
we have a few spots in the codebase where we destructure
an object key and then use something like ...restProps
setting this to true allows that
* upgrade from eslint 7.21.0 to 8.25.0
- add @grafana/eslint-config to dev dependencies and pre-commit eslint deps
- add @grafana/eslint-config peer dependencies to package.json
* fix remaining outstanding prettier warnings
* enable noUnusedLocals and noUnusedParameters and fix errors related to this
* make pre-commit complain about eslint warnings
* import from moment-timezone instead of moment
* fix react/display-name eslint warning
* add eslint-plugin-react-hooks to dev deps
this is a peer dependency from @grafana/eslint-config
* turn off react/prop-types
* temporarily turn off react-hooks/exhaustive-deps
add note that it will be turned back on and fixed in next PR
* fix unused import errors after rebase to dev
* fix more new prettier errors
* turn react/no-unescaped-entities eslint rule off
* address PR comment about useReducer
* remove includeTemplateGroup from src/components/AlertTemplates/AlertTemplatesForm.helper.tsx
* update arg typing for refreshPageError
* update handleSyncException typing
* fix strict equality in containers/IntegrationSettings/parts/Autoresolve.tsx
* enhance typing in components/AlertTemplates/AlertTemplatesForm.tsx
* revert small change per Maxim's comment
* remove email verification related code
* remove email verification related code
* remove sendgrid callback
* remove sendgrid related code
* remove sendgrid related code
* rename sendgrid app to email
* remove email from built-in channels
* remove email from built-in channels
* remove email from built-in channels
* add email backend: https://github.com/grafana/oncall/pull/50
* add email templater
* add email templater
* convert md to html
* add email settings to live settings
* use task to send email, handle some exceptions to create logs
* remove ERROR_NOTIFICATION_MAIL_DELIVERY_FAILED usage
* add email limit logic
* fix tests
* add docs
* remove old email templates
* remove old email templates
* add template_fields to messaging backend
* add messaging backends templates to public api
* add comment for deprecated fields
* fix test
* fix tests
* disable email by default
* don't retry on SMTPException and TimeoutError
* add tests
* bring email back to public api docs
* return ERROR_NOTIFICATION_MAIL_LIMIT_EXCEEDED
* make template_fields tuple
* build_subject_and_title -> build_subject_and_message
* add one more comment about template deprecation
* use 8 as backend id
* add comment about gaierror and BadHeaderError
* add comment on importing in notify_user_async
* edit oss docs
* Allow non-JSON custom webhook templates, provided they render as valid JSON
Previously, both the provided template _and_ the rendered template had
to be valid JSON in order for validation to pass. This was unnecessarily
restrictive: really, only the rendered template needs to be valid JSON.
It also disallowed using templates such as:
{
"labels": {{ alert_payload.labels | tojson }}
}
even though this would be valid JSON after rendering.
This commit relaxes the validation of custom webhook templates so that
they don't need to be valid JSON, provided that the rendered template
_is_ valid JSON. This is checked using a dummy dictionary of render
params, which use a constant string for the `alert_group_id` field
and a `defaultdict(dict)` for the `alert_payload` field. This should
permit templates like the one above, but still deny templates such as
{
"labels": {{ alert_payload.labels }}
}
which would otherwise fail later if `labels` is not valid JSON.
This should resolve#638.
* Use defaultdict(str) instead of defaultdict(lambda: "")
* Add missing comment to resolution note validation code
* Update validation of resolution notes in public API, too
* Add extra test cases for JSON webhook templates endpoint of public API
* tolerate ONCALL_API_URL without trailing slash
* tolerate ONCALL_API_URL without trailing slash
* show vendor name if integration type is not supported
* isort
* black