-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into yoshioka/multi-byte-search-for-user-and-fa…
…vorite
- Loading branch information
Showing
49 changed files
with
692 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v14.16.1 | ||
v16.20.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { isDateTime } from "@/services/query-result"; | ||
|
||
describe("isDateTime", () => { | ||
it.each([ | ||
["2022-01-01T00:00:00", true], | ||
["2022-01-01T00:00:00+09:00", true], | ||
["2021-01-27T00:00:01.733983944+03:00 stderr F {", false], | ||
["2021-01-27Z00:00:00+09:00", false], | ||
["2021-01-27", false], | ||
["foo bar", false], | ||
[2022, false], | ||
[null, false], | ||
["", false], | ||
])("isDateTime('%s'). expected '%s'.", (value, expected) => { | ||
expect(isDateTime(value)).toBe(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
[pytest] | ||
norecursedirs = *.egg .eggs dist build docs .tox | ||
filterwarnings = | ||
once::DeprecationWarning | ||
once::PendingDeprecationWarning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import logging | ||
import textwrap | ||
|
||
import requests | ||
|
||
from redash.destinations import BaseDestination, register | ||
from redash.models import Alert | ||
|
||
|
||
class Asana(BaseDestination): | ||
@classmethod | ||
def configuration_schema(cls): | ||
return { | ||
"type": "object", | ||
"properties": { | ||
"pat": {"type": "string", "title": "Asana Personal Access Token"}, | ||
"project_id": {"type": "string", "title": "Asana Project ID"}, | ||
}, | ||
"secret": ["pat"], | ||
"required": ["pat", "project_id"], | ||
} | ||
|
||
@classmethod | ||
def icon(cls): | ||
return "fa-asana" | ||
|
||
@property | ||
def api_base_url(self): | ||
return "https://app.asana.com/api/1.0/tasks" | ||
|
||
def notify(self, alert, query, user, new_state, app, host, metadata, options): | ||
# Documentation: https://developers.asana.com/docs/tasks | ||
state = "TRIGGERED" if new_state == Alert.TRIGGERED_STATE else "RECOVERED" | ||
|
||
notes = textwrap.dedent( | ||
f""" | ||
{alert.name} has {state}. | ||
Query: {host}/queries/{query.id} | ||
Alert: {host}/alerts/{alert.id} | ||
""" | ||
).strip() | ||
|
||
data = { | ||
"name": f"[Redash Alert] {state}: {alert.name}", | ||
"notes": notes, | ||
"projects": [options["project_id"]], | ||
} | ||
|
||
try: | ||
resp = requests.post( | ||
self.api_base_url, | ||
data=data, | ||
timeout=5.0, | ||
headers={"Authorization": f"Bearer {options['pat']}"}, | ||
) | ||
logging.warning(resp.text) | ||
if resp.status_code != 201: | ||
logging.error("Asana send ERROR. status_code => {status}".format(status=resp.status_code)) | ||
except Exception as e: | ||
logging.exception("Asana send ERROR. {exception}".format(exception=e)) | ||
|
||
|
||
register(Asana) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.