Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

Conversation

Samyak2
Copy link
Contributor

@Samyak2 Samyak2 commented May 5, 2022

See GitHub release notes for details.

dependabot bot and others added 30 commits February 14, 2022 09:51
Bumps [psycopg2-binary](https://github.com/psycopg/psycopg2) from 2.8.6 to 2.9.3.
- [Release notes](https://github.com/psycopg/psycopg2/releases)
- [Changelog](https://github.com/psycopg/psycopg2/blob/master/NEWS)
- [Commits](https://github.com/psycopg/psycopg2/commits)

---
updated-dependencies:
- dependency-name: psycopg2-binary
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [python-dotenv](https://github.com/theskumar/python-dotenv) from 0.18.0 to 0.20.0.
- [Release notes](https://github.com/theskumar/python-dotenv/releases)
- [Changelog](https://github.com/theskumar/python-dotenv/blob/master/CHANGELOG.md)
- [Commits](theskumar/python-dotenv@v0.18.0...v0.20.0)

---
updated-dependencies:
- dependency-name: python-dotenv
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Mount local files into container, gunicorn autoreloads on file changes
add celerybeat-schedule.db to .gitignore
mound docker.sock to silence celery worker errors in log
…opg2-binary-2.9.3

chore(deps): bump psycopg2-binary from 2.8.6 to 2.9.3
…on-dotenv-0.20.0

chore(deps): bump python-dotenv from 0.18.0 to 0.20.0
…er compose files, fix version str in thirdparty dev compose
build: docker-compose update for development
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.4 to 7.1.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](pytest-dev/pytest@6.2.4...7.1.1)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
…st-7.1.1

chore(deps-dev): bump pytest from 6.2.4 to 7.1.1
…time-anomaly-setup

resolved popup issue while setting up analytics
- formatted `kpi_view.py` using black and isort
- fixed some type errors
    - check the return value of `request.get_json()` is None before
      using it
    - variable may be unbound - moved initialization to the top. see
      `ret = []`.
- fixed flake8 errors
    - ignored in cases where it cannot be prevented
- fixed flake8 warnings:
    - some variables were unused - removed their assignment in case of
      functions with side effects and removed the entire line in case of
      functions without side effects (`DataSource.get_by_id` for example)
- isort
    - many unused imports
    - imports position was wrong
    - flask imports require it to be imported from a specific submodule
- added docstrings
- replaced prints with logger
Uses Flask-SQLAlchemy's built-in pagination feature.

Added some helpers in `utils.pagination` to make it easier to return
pagination info as part of the response
Previously, `get_mapper_obj_by_dashboard_ids` would get the list of all
KPIs for the given dashboard_id, the query would use the entire list
(could be 500+ in some cases) embedded in the query itself. After this
query is done, pagination would be applied which doesn't provide much
benefits in terms of DB performance.

Refactored it to use DashboardKpiMapper in the query itself.
- the filter ensures that the entire list of KPIs is not retreived at
  any point
- pagination added in previous commit ensures performance

The `dashboards` field returned by the API endpoint was not used in the
frontend, so it was removed. This meant that a lot of unnecessary code
could be removed from the endpoint. Note: there is another end point to
get the list of dashboards, so this is not necessary.

The logic of associating dashboards with KPIs was refactored:
- Created function `kpi_dashboard_mapper_dict` in `dashboard_controller`
  that creates a dict that can be used to get the list of dashboards for
  given KPIs. This avoids calling multiple of `get_mapper_obj...`
  functions just for this purpose in the view.
- The function is type safe even when the return type depends on a
  parameter. Used `typing.overload` for this.

BREAKING CHANGE: removed `dashboards` fields from GET `/api/kpi`
endpoint.
according to frontend requirement
Optimized query when a dashboard_id is given (most of the time)
- Does not pull in the full list of KPIs anymore
- Uses a DB join instead

Added a helper for extracting pagination params from request.args.

Formatted file.
When the error is on the client, the status code should be 400
When the error is on the client, the status code should be 400
Also changed pagination_args to take the default value as parameters -
useful in debugging.
- formatted using black and isort
- fixed type errors
    - check the value returned by `get_json()` is None before using it
        - returns a message with 400 if it's not a JSON
- fixed flake8 errors
- fixed docstrings
- create a new logger for the alert view module instead of using the
  root logger (`current_app.logger`)
- reduced total errors and warnings from 60+ to 0
- formatted using black and isort
- fixed type errors
    - check the value returned by `get_json()` is None before using it
        - returns a message with 400 if it's not a JSON
- fixed flake8 errors
- fixed docstrings
- create a new logger for the alert view module instead of using the
  root logger (`current_app.logger`)
- reduced total errors and warnings from 60+ to 0
Refactored `get_alert_list` function:
- stabilized types. Used type overloading
  (https://docs.python.org/3/library/typing.html#typing.overload) to
  define the return type of the function based on argument values.
- For example, when `as_obj` is True, the return type is a list of Alert
  objects. When it's `False` it is a list of Dicts.
- It's a Pagination object when pagination is enabled
- Fixed docstring to be flake8 compatible and fixed other flake8 issues

Refactored `get_alert_info`:
- changed parameter name `id` to `alert_id` since `id` is a built-in
  function
- changed exception message to include the alert ID
- made docstring flake8 compatible and removed unnecessary arg
  description.

Added pagination support to `get_alert_list` function.
manassolanki and others added 25 commits May 3, 2022 15:49
Inconsistencies were introduced in 79328ca
and added TODO for refactor in the future
The new logic to handle multiple filters given as comma separated values
and as multiple params added in 79328ca
was not added to the get-dashboard-list endpoint.

This commit adds it there too.
refactor(kpi-view): fix flake8, isort, formatting, type errors
refactor(alert-view): fix flake8, isort, formatting, type errors
refactor(dashboard-view): fix type, flake8, isort errors
NOTE: this is only a release candidate (rc1), not the final release
Introduces some repetitive code that can be possibly abstracted.

Also added some missing types.
…dashboard-FE

added paginate params for KPI list and changed fornt size in paginati…
…dashboard-FE

increased paddingleft for page info container
…dashboard

Fix KPI list in dashboard view, new alert and new dashboard pages
…pi-FE

added paginate param for data sources dropdown in event alert and add…
Updated versions in docker compose files

Version in `settings.py` was changed in 1482b69
release: bumped version to v0.7.0
@gitpod-io
Copy link

gitpod-io bot commented May 5, 2022

@netlify
Copy link

netlify bot commented May 5, 2022

Deploy Preview for frontend-sb ready!

Name Link
🔨 Latest commit 33fdf1c
🔍 Latest deploy log https://app.netlify.com/sites/frontend-sb/deploys/6273a419d5786f0008bf1463
😎 Deploy Preview https://deploy-preview-956--frontend-sb.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@gitguardian
Copy link

gitguardian bot commented May 5, 2022

⚠️ GitGuardian has uncovered 3 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
2745890 Generic High Entropy Secret f0c2eec .env View secret
2745890 Generic High Entropy Secret 008c684 .env View secret
2745890 Generic High Entropy Secret 912beff .env View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@Samyak2 Samyak2 added this to the v0.7.0 milestone May 5, 2022
@Samyak2 Samyak2 merged commit ee1f68b into main May 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants