Skip to content

Commit

Permalink
Allow configuring team managed message (using text or HTML) (#408)
Browse files Browse the repository at this point in the history
* Allow configuring team managed message HTML.

* Allows configuring 'team_managed_message', creates a managed team in dummy data for testing. Updates README.md with docker compose instructions.

* Format README.md a bit better.

* Remove log.
  • Loading branch information
tbrockman committed Oct 2, 2023
1 parent 486e789 commit a5df8c4
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ build:
docker build --ulimit nofile=1024 -t $(APP_NAME) .

run: build
docker run -p 8080:8080 $(APP_NAME)
docker run -p 8080:8080 $(APP_NAME)

compose:
docker compose up --build
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ how to run and manage Oncall.

Development setup
-----------------

### Local machine

<details>
<summary>See instructions for setting up Oncall on your local machine</summary>

### Prerequisites

* Debian/Ubuntu - `sudo apt-get install libsasl2-dev python3-dev libldap2-dev libssl-dev python-pip python-setuptools mysql-server mysql-client`
Expand Down Expand Up @@ -48,6 +54,34 @@ One of the following commands:
```bash
make test
```
</details>

### Docker compose

<details>
<summary>See instructions for using <code>docker compose</code></summary>

### Running

```bash
make compose
```

or running `docker compose` directly:

```bash
docker compose up --build
```

### Limitations

* Doesn't currently provide a mechanism for running tests
* Requires rebuilding to apply code changes
* Doesn't tail Python logs to stdout

</details>

## Contributing

Check out https://github.com/linkedin/oncall/issues for a list of outstanding
issues, and tackle any one that catches your interest. Contributions are
Expand Down
1 change: 1 addition & 0 deletions configs/config.docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@ user_validator:

slack_instance: foobar
header_color: '#3a3a3a'
team_managed_message: 'Managed team - this team is managed via API'
1 change: 1 addition & 0 deletions configs/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ header_color: '#3a3a3a'
public_calendar_base_url: 'http://localhost:8080/api/v0/ical'
# Additional message you want to put here, could be a link to the FAQ
public_calendar_additional_message: 'Link to FAQ'
team_managed_message: 'Managed team - this team is managed via API'

# Integration with Iris, allowing for escalation from Oncall
iris_plan_integration:
Expand Down
1 change: 1 addition & 0 deletions db/dummy_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ UNLOCK TABLES;
LOCK TABLES `team` WRITE;
/*!40000 ALTER TABLE `team` DISABLE KEYS */;
INSERT INTO `team` VALUES (1,'Test Team','#team','#team-alerts','[email protected]','US/Pacific',1,NULL,0,NULL,0);
INSERT INTO `team` VALUES (2,'Managed Team','#managed-team','#managed-team-alerts','[email protected]','US/Pacific',1,NULL,0,NULL,1);
/*!40000 ALTER TABLE `team` ENABLE KEYS */;
UNLOCK TABLES;

Expand Down
1 change: 1 addition & 0 deletions ops/charts/oncall/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ header_color: '#3a3a3a'
public_calendar_base_url: 'http://localhost:{{ .Values.port.internal }}/api/v0/ical'
# Additional message you want to put here, could be a link to the FAQ
public_calendar_additional_message: 'Link to FAQ'
team_managed_message: 'Managed team - this team is managed via API'

# Integration with Iris, allowing for escalation from Oncall
iris_plan_integration:
Expand Down
2 changes: 1 addition & 1 deletion src/oncall/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.0.3"
__version__ = "2.0.4"
6 changes: 5 additions & 1 deletion src/oncall/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
IRIS_PLAN_SETTINGS = None
USERCONTACT_UI_READONLY = None
LOGIN_REQUIRED = None
TEAM_MANAGED_MESSAGE = None


def index(req, resp):
Expand All @@ -91,7 +92,8 @@ def index(req, resp):
public_calendar_base_url=PUBLIC_CALENDAR_BASE_URL,
public_calendar_additional_message=PUBLIC_CALENDAR_ADDITIONAL_MESSAGE,
footer=INDEX_CONTENT_SETTING['footer'],
timezones=SUPPORTED_TIMEZONES
timezones=SUPPORTED_TIMEZONES,
team_managed_message=TEAM_MANAGED_MESSAGE
)


Expand Down Expand Up @@ -139,13 +141,15 @@ def init(application, config):
global PUBLIC_CALENDAR_BASE_URL
global PUBLIC_CALENDAR_ADDITIONAL_MESSAGE
global LOGIN_REQUIRED
global TEAM_MANAGED_MESSAGE
SLACK_INSTANCE = config.get('slack_instance')
HEADER_COLOR = config.get('header_color', '#3a3a3a')
IRIS_PLAN_SETTINGS = config.get('iris_plan_integration')
USERCONTACT_UI_READONLY = config.get('usercontact_ui_readonly', True)
PUBLIC_CALENDAR_BASE_URL = config.get('public_calendar_base_url')
PUBLIC_CALENDAR_ADDITIONAL_MESSAGE = config.get('public_calendar_additional_message')
LOGIN_REQUIRED = config.get('require_auth')
TEAM_MANAGED_MESSAGE = config.get('team_managed_message')

application.add_sink(index, '/')
application.add_route('/static/bundles/{filename}',
Expand Down
2 changes: 1 addition & 1 deletion src/oncall/ui/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ <h4>
</h4>
<h4>
{{#if api_managed_roster}}
Managed team - this team is managed via API
{% endraw %} <div> {{team_managed_message|safe}} </div> {% raw %}
{{/if}}
</h4>
{% endraw %} {% endif %} {% raw %}
Expand Down

0 comments on commit a5df8c4

Please sign in to comment.