Pēteris Caune
95b92a9b3b
Fix type warning
2023-09-27 17:47:25 +03:00
Pēteris Caune
2a0ae809a7
Add DowntimeRecord.no_data field
2023-09-27 17:43:18 +03:00
Pēteris Caune
58d7c8cc55
Simplify DowntimeSummary
2023-09-27 17:16:16 +03:00
Pēteris Caune
f7af738c76
Add monthly uptime percentage display in Check Details page
...
Fixes : #773
2023-09-27 13:44:35 +03:00
Pēteris Caune
db5d8adeb5
Switch from namedtuple to dataclass for mutability
2023-09-27 11:03:58 +03:00
Pēteris Caune
46dbaff2c3
Update Check.downtimes() to return records in descending datetime order
...
This way we can avoid one sort operation in Check.downtimes()
and one reverse operation in the "details_downtimes.html" template.
2023-09-27 10:42:05 +03:00
Pēteris Caune
f0085933c3
Update Check.downtimes() to return a list of namedtuples
...
This way it should be easier to add extra fields like uptime
to the returned data structure.
2023-09-27 10:18:52 +03:00
Pēteris Caune
e48d361331
Fix time interval formatting in check details - downtime summary
...
In hc.lib.date.format_approx_duration, we were calling
timedeltaobj.total_seconds() and basing all calculations off that.
This method returns float, so the final result was "2.0 hours" or
"3.0 days" and similar. We now convert it to int, to get "2 hours",
"3 days" etc.
2023-09-26 10:30:34 +03:00
Pēteris Caune
507fd840d8
Exclude "body" from the Ping admin form
...
"body" is an obsolete field and kept around for the sake
of very old pings. For all new pings body data goes either
into the "body_raw" binary field (for small bodies)
or in the object storage (for not so small bodies).
So it is not useful to show the body field in the Ping admin.
2023-09-22 09:36:27 +03:00
Git'Fellow
8dbbd5b9d6
Switch to apt-get ( #893 )
...
More suitable and less error prone to use in scripts
2023-09-20 10:02:34 +03:00
Pēteris Caune
aa541e760b
Add Channel.opsgenie property
...
It replaces:
* Channel.opsgenie_key
* Channel.opsgenie_region
Also, add data migration to normalize Opsgenie channel values
to always be JSON maps.
2023-09-11 16:44:38 +03:00
Pēteris Caune
dcf9f327f6
Add Channel.email property
...
It replaces:
* Channel.email_value
* Channel.email_notify_up
* Channel.email_notify_down
2023-09-11 11:45:25 +03:00
Pēteris Caune
ccc8faa953
Fix admin test
...
The test is checking if a Pushbullet channel shows up in the
channels list. It was looking for the string "Pushbullet".
The problem is this string shows up unconditionally on
the right side filters panel. The fix is to look for
"ic-pushbullet" (the pushbullet icon), which should only
appear inside the list view.
2023-09-11 11:41:52 +03:00
Pēteris Caune
cf4498eca2
Add Channel.phone property
...
It has typed fields: value, notify_up, notify_down.
It replaces:
* Channel.phone_number
* Channel.sms_notify_up
* Channel.sms_notify_down
* Channel.whatsapp_notify_up
* Channel.whatsapp_notify_down
* Channel.signal_notify_up
* Channel.signal_notify_down
2023-09-09 11:09:52 +03:00
Pēteris Caune
1881fa1da0
Fix tests
2023-09-08 16:54:13 +03:00
Pēteris Caune
ee40cd8dab
Fix type warnings
2023-09-08 16:47:27 +03:00
Pēteris Caune
f1d1ccd281
Add Channel.shell and Channel.pd properties
2023-09-08 16:33:12 +03:00
Pēteris Caune
e17f555fb1
Replace Channel.telegram_* properties with a Channel.telegram property
...
The Channel.telegram property has typed fields:
id, thread_id, type, name.
Usage sites change from `channel.telegram_id` to `channel.telegram.id`
2023-09-08 16:02:26 +03:00
Pēteris Caune
5746bbb015
Improve type hints in hc.api.models
2023-09-08 15:58:39 +03:00
Pēteris Caune
a6ab647a46
Improve type hints in hc.accounts.models
2023-09-08 15:54:47 +03:00
Pēteris Caune
92bf9773dc
Improve type hints in hc.lib
2023-09-08 13:05:19 +03:00
Pēteris Caune
9173475194
Improve type hints in hc.api.views
2023-09-07 14:38:55 +03:00
Pēteris Caune
a2fa62c7be
Improve function and variable names
2023-09-07 14:05:47 +03:00
Pēteris Caune
18aac7f46c
Update Spec model to handle int -> timedelta conversion
2023-09-07 13:19:21 +03:00
Pēteris Caune
53200a0559
Switch to using None as the sentinel object for absent fields
...
It means we need to have an extra checks for null values
in Spec.check_nulls() but it makes mypy more happy.
2023-09-07 12:56:35 +03:00
Pēteris Caune
370a75373b
Combine the "validate_json" and "authorize" decorators
2023-09-07 11:18:14 +03:00
Pēteris Caune
ee30448c0b
Update hc.api.views to use Pydantic for incoming data validation
2023-09-07 10:31:54 +03:00
Pēteris Caune
05d2d0065e
Remove usage of backports.zoneinfo
2023-09-06 12:54:27 +03:00
Pēteris Caune
77e1ea731c
Improve type hints in hc.accounts.views
2023-09-06 12:51:27 +03:00
Pēteris Caune
c9bf3132fe
Replace usage of typing.List, typing.Optional etc. with modern syntax
2023-09-06 11:27:43 +03:00
Pēteris Caune
d79069f669
Fix type warnings, improve type hints in hc.front.views
2023-09-06 11:18:47 +03:00
Pēteris Caune
e9ac841d01
Move reusable type aliases to hc.lib.typealias
2023-09-06 10:52:47 +03:00
Pēteris Caune
3c19d51836
Drop Python 3.8 and Python 3.9 support
2023-09-06 10:31:13 +03:00
Pēteris Caune
65b3acf964
Improve type hints in hc.accounts.views
2023-09-06 10:02:50 +03:00
Pēteris Caune
0c83ca4fd8
Improve type hints in hc.accounts.forms
2023-09-05 18:31:35 +03:00
Pēteris Caune
9153c1a552
Improve type hints
2023-09-05 13:31:59 +03:00
Pēteris Caune
1ccd96a045
Fix type warnings
2023-09-05 11:53:57 +03:00
Pēteris Caune
688191e6d5
Upgrade Django to 4.2.5
2023-09-05 10:45:26 +03:00
Pēteris Caune
8472bd5d1e
Update Channel.webhook_spec to return an object instead of a dict
...
This simplifies type annotations, as object's fields
can be type-annotated easily, and JSON->object parsing can be handled
by Pydantic.
2023-09-03 16:20:22 +03:00
Pēteris Caune
957cd59fc7
Fix type warnings
2023-09-03 15:46:31 +03:00
Pēteris Caune
8fa70dc59c
Fix type warnings
2023-09-03 09:29:44 +03:00
Pēteris Caune
ef3837e7e7
Clean up and improve code comments
2023-09-03 09:29:31 +03:00
Pēteris Caune
2901f03146
Fix type warnings
2023-09-03 09:04:38 +03:00
Pēteris Caune
4a819a8018
Convert Signal.send() to a classmethod
...
This fixes a couple mypy warnings, and also fixes a code smell:
we were doing `Signal(None).send(...)` in a few places,
and can now do `Signal.send(...)` instead.
2023-09-02 18:48:25 +03:00
Pēteris Caune
ec607afbde
Improve test coverage for the Signal transport class
2023-09-02 18:24:14 +03:00
Pēteris Caune
23eadc5e64
Fix type warnings
2023-09-02 17:19:31 +03:00
Pēteris Caune
aecdbfb017
Remove dead code in Channel.webhook_spec
...
The "method_down" and "method_up" fields are always set
in webhook configurations, no point checking them.
2023-09-02 16:54:16 +03:00
Pēteris Caune
9932855745
Fix type annotations
2023-09-02 16:52:46 +03:00
Pēteris Caune
1c0dc52099
Remove debug
2023-09-02 12:58:25 +03:00
Pēteris Caune
6b11e60d9c
Update Signal class to parse signal-cli JSON-RPC messages using pydantic
2023-09-02 12:47:42 +03:00