remove SlackActionRecord model/table (#2201)
# What this PR does Closes #2169 ## Checklist - [x] Unit, integration, and e2e (if applicable) tests updated - [ ] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required)
This commit is contained in:
parent
d3ebc17c39
commit
90e0b21d3e
9 changed files with 28 additions and 71 deletions
|
|
@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- Add helm chart support for redis and mysql existing secrets [#2156](https://github.com/grafana/oncall/pull/2156)
|
||||
|
||||
### Changed
|
||||
|
||||
- Removed `SlackActionRecord` model and database table by @joeyorlando [#2201](https://github.com/grafana/oncall/pull/2201)
|
||||
|
||||
## v1.2.43 (2023-06-12)
|
||||
|
||||
### Changed
|
||||
|
|
@ -29,7 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Fix receive channel filter in alert groups API [#2140](https://github.com/grafana/oncall/pull/2140)
|
||||
- Helm chart: Fix usage of `env` settings as map;
|
||||
Fix usage of `mariadb.auth.database` and `mariadb.auth.username` for MYSQL env variables by @alexintech [#2146](https://github.com/grafana/oncall/pull/2146)
|
||||
|
||||
|
||||
### Added
|
||||
|
||||
- Helm chart: Add unittests for rabbitmq and redis [2165](https://github.com/grafana/oncall/pull/2165)
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ version: "3.9"
|
|||
x-labels: &oncall-labels
|
||||
- "com.grafana.oncall.env=dev"
|
||||
|
||||
x-user: &oncall-user
|
||||
"appuser"
|
||||
x-user: &oncall-user "appuser"
|
||||
|
||||
x-oncall-build: &oncall-build-args
|
||||
context: ./engine
|
||||
|
|
@ -59,7 +58,8 @@ services:
|
|||
- ./grafana-plugin:/etc/app
|
||||
- node_modules_dev:/etc/app/node_modules
|
||||
# https://stackoverflow.com/a/60456034
|
||||
- ${ENTERPRISE_FRONTEND:-/dev/null}:/etc/app/frontend_enterprise
|
||||
# see the explaination above that uses the $ENTERPRISE_ENGINE env var
|
||||
- ${ENTERPRISE_FRONTEND:-/dev/null}:${ENTERPRISE_FRONTEND_VOLUME_MOUNT_DEST_DIR:-/tmp/empty:ro}
|
||||
profiles:
|
||||
- oncall_ui
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from django.contrib import admin
|
|||
|
||||
from common.admin import CustomModelAdmin
|
||||
|
||||
from .models import SlackActionRecord, SlackMessage, SlackTeamIdentity, SlackUserIdentity
|
||||
from .models import SlackMessage, SlackTeamIdentity, SlackUserIdentity
|
||||
|
||||
|
||||
@admin.register(SlackTeamIdentity)
|
||||
|
|
@ -23,9 +23,3 @@ class SlackUserIdentityAdmin(CustomModelAdmin):
|
|||
class SlackMessageAdmin(CustomModelAdmin):
|
||||
list_display = ("id", "slack_id", "_slack_team_identity", "alert_group", "created_at")
|
||||
list_filter = ("created_at",)
|
||||
|
||||
|
||||
@admin.register(SlackActionRecord)
|
||||
class SlackActionRecordAdmin(CustomModelAdmin):
|
||||
list_display = ("id", "organization", "user", "step", "datetime")
|
||||
list_filter = ("datetime",)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.19 on 2023-06-13 08:59
|
||||
|
||||
from django.db import migrations
|
||||
import django_migration_linter as linter
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('slack', '0002_squashed_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
linter.IgnoreMigration(),
|
||||
migrations.DeleteModel(
|
||||
name='SlackActionRecord',
|
||||
),
|
||||
]
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
from .slack_action_record import SlackActionRecord # noqa: F401
|
||||
from .slack_channel import SlackChannel # noqa: F401
|
||||
from .slack_message import SlackMessage # noqa: F401
|
||||
from .slack_team_identity import SlackTeamIdentity # noqa: F401
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
from django.db import models
|
||||
|
||||
# from apps.slack.scenarios.scenario_step import ScenarioStep
|
||||
|
||||
|
||||
class SlackActionRecord(models.Model):
|
||||
"""
|
||||
Legacy model, should be removed.
|
||||
"""
|
||||
|
||||
ON_CALL_ROUTINE = [
|
||||
# ScenarioStep.get_step("distribute_alerts", "CustomButtonProcessStep").routing_uid(),
|
||||
# ScenarioStep.get_step("distribute_alerts", "StopInvitationProcess").routing_uid(),
|
||||
# ScenarioStep.get_step("distribute_alerts", "InviteOtherPersonToIncident").routing_uid(),
|
||||
# ScenarioStep.get_step("distribute_alerts", "AcknowledgeGroupStep").routing_uid(),
|
||||
# ScenarioStep.get_step("distribute_alerts", "UnAcknowledgeGroupStep").routing_uid(),
|
||||
# ScenarioStep.get_step("distribute_alerts", "ResolveGroupStep").routing_uid(),
|
||||
# ScenarioStep.get_step("distribute_alerts", "SilenceGroupStep").routing_uid(),
|
||||
]
|
||||
|
||||
organization = models.ForeignKey("user_management.Organization", on_delete=models.CASCADE, related_name="actions")
|
||||
|
||||
user = models.ForeignKey(
|
||||
"user_management.User", on_delete=models.SET_NULL, null=True, default=None, related_name="actions"
|
||||
)
|
||||
|
||||
step = models.CharField(max_length=100, null=True, default=None)
|
||||
payload = models.TextField(null=True, default=None)
|
||||
datetime = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
@staticmethod
|
||||
def filter_only_incident_routine(queryset):
|
||||
return queryset.filter(step__in=SlackActionRecord.ON_CALL_ROUTINE)
|
||||
|
|
@ -1,13 +1,6 @@
|
|||
import factory
|
||||
|
||||
from apps.slack.models import (
|
||||
SlackActionRecord,
|
||||
SlackChannel,
|
||||
SlackMessage,
|
||||
SlackTeamIdentity,
|
||||
SlackUserGroup,
|
||||
SlackUserIdentity,
|
||||
)
|
||||
from apps.slack.models import SlackChannel, SlackMessage, SlackTeamIdentity, SlackUserGroup, SlackUserIdentity
|
||||
from common.utils import UniqueFaker
|
||||
|
||||
|
||||
|
|
@ -52,8 +45,3 @@ class SlackMessageFactory(factory.DjangoModelFactory):
|
|||
|
||||
class Meta:
|
||||
model = SlackMessage
|
||||
|
||||
|
||||
class SlackActionRecordFactory(factory.DjangoModelFactory):
|
||||
class Meta:
|
||||
model = SlackActionRecord
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ def test_organization_hard_delete(
|
|||
make_slack_team_identity,
|
||||
make_slack_user_identity,
|
||||
make_slack_message,
|
||||
make_slack_action_record,
|
||||
make_schedule,
|
||||
make_custom_action,
|
||||
make_alert_receive_channel,
|
||||
|
|
@ -144,7 +143,6 @@ def test_organization_hard_delete(
|
|||
telegram_message = make_telegram_message(alert_group=alert_group, message_type=TelegramMessage.ALERT_GROUP_MESSAGE)
|
||||
|
||||
slack_message = make_slack_message(alert_group=alert_group)
|
||||
slack_action_record = make_slack_action_record(organization=organization, user=user_1)
|
||||
|
||||
plugin_token, _ = make_token_for_organization(organization)
|
||||
public_api_token, _ = make_public_api_token(user_1, organization)
|
||||
|
|
@ -186,7 +184,6 @@ def test_organization_hard_delete(
|
|||
telegram_verification_code,
|
||||
telegram_channel_verification_code,
|
||||
slack_message,
|
||||
slack_action_record,
|
||||
plugin_token,
|
||||
public_api_token,
|
||||
invitation,
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ from apps.schedules.tests.factories import (
|
|||
)
|
||||
from apps.slack.slack_client import SlackClientWithErrorHandling
|
||||
from apps.slack.tests.factories import (
|
||||
SlackActionRecordFactory,
|
||||
SlackChannelFactory,
|
||||
SlackMessageFactory,
|
||||
SlackTeamIdentityFactory,
|
||||
|
|
@ -107,7 +106,6 @@ register(SlackUserGroupFactory)
|
|||
register(SlackUserIdentityFactory)
|
||||
register(SlackTeamIdentityFactory)
|
||||
register(SlackMessageFactory)
|
||||
register(SlackActionRecordFactory)
|
||||
|
||||
register(TelegramToUserConnectorFactory)
|
||||
register(TelegramChannelFactory)
|
||||
|
|
@ -397,14 +395,6 @@ def make_slack_message():
|
|||
return _make_slack_message
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def make_slack_action_record():
|
||||
def _make_slack_action_record(organization, user, **kwargs):
|
||||
return SlackActionRecordFactory(organization=organization, user=user, **kwargs)
|
||||
|
||||
return _make_slack_action_record
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client_with_user():
|
||||
def _client_with_user(user):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue