Skip to content

Commit a5df8c4

Browse files
authored
Allow configuring team managed message (using text or HTML) (#408)
* 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.
1 parent 486e789 commit a5df8c4

File tree

9 files changed

+49
-4
lines changed

9 files changed

+49
-4
lines changed

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ build:
3232
docker build --ulimit nofile=1024 -t $(APP_NAME) .
3333

3434
run: build
35-
docker run -p 8080:8080 $(APP_NAME)
35+
docker run -p 8080:8080 $(APP_NAME)
36+
37+
compose:
38+
docker compose up --build

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ how to run and manage Oncall.
88

99
Development setup
1010
-----------------
11+
12+
### Local machine
13+
14+
<details>
15+
<summary>See instructions for setting up Oncall on your local machine</summary>
16+
1117
### Prerequisites
1218

1319
* Debian/Ubuntu - `sudo apt-get install libsasl2-dev python3-dev libldap2-dev libssl-dev python-pip python-setuptools mysql-server mysql-client`
@@ -48,6 +54,34 @@ One of the following commands:
4854
```bash
4955
make test
5056
```
57+
</details>
58+
59+
### Docker compose
60+
61+
<details>
62+
<summary>See instructions for using <code>docker compose</code></summary>
63+
64+
### Running
65+
66+
```bash
67+
make compose
68+
```
69+
70+
or running `docker compose` directly:
71+
72+
```bash
73+
docker compose up --build
74+
```
75+
76+
### Limitations
77+
78+
* Doesn't currently provide a mechanism for running tests
79+
* Requires rebuilding to apply code changes
80+
* Doesn't tail Python logs to stdout
81+
82+
</details>
83+
84+
## Contributing
5185

5286
Check out https://github.com/linkedin/oncall/issues for a list of outstanding
5387
issues, and tackle any one that catches your interest. Contributions are

configs/config.docker.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,4 @@ user_validator:
7979

8080
slack_instance: foobar
8181
header_color: '#3a3a3a'
82+
team_managed_message: 'Managed team - this team is managed via API'

configs/config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ header_color: '#3a3a3a'
154154
public_calendar_base_url: 'http://localhost:8080/api/v0/ical'
155155
# Additional message you want to put here, could be a link to the FAQ
156156
public_calendar_additional_message: 'Link to FAQ'
157+
team_managed_message: 'Managed team - this team is managed via API'
157158

158159
# Integration with Iris, allowing for escalation from Oncall
159160
iris_plan_integration:

db/dummy_data.sql

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ UNLOCK TABLES;
1414
LOCK TABLES `team` WRITE;
1515
/*!40000 ALTER TABLE `team` DISABLE KEYS */;
1616
INSERT INTO `team` VALUES (1,'Test Team','#team','#team-alerts','[email protected]','US/Pacific',1,NULL,0,NULL,0);
17+
INSERT INTO `team` VALUES (2,'Managed Team','#managed-team','#managed-team-alerts','[email protected]','US/Pacific',1,NULL,0,NULL,1);
1718
/*!40000 ALTER TABLE `team` ENABLE KEYS */;
1819
UNLOCK TABLES;
1920

ops/charts/oncall/config/config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ header_color: '#3a3a3a'
141141
public_calendar_base_url: 'http://localhost:{{ .Values.port.internal }}/api/v0/ical'
142142
# Additional message you want to put here, could be a link to the FAQ
143143
public_calendar_additional_message: 'Link to FAQ'
144+
team_managed_message: 'Managed team - this team is managed via API'
144145

145146
# Integration with Iris, allowing for escalation from Oncall
146147
iris_plan_integration:

src/oncall/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.0.3"
1+
__version__ = "2.0.4"

src/oncall/ui/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
IRIS_PLAN_SETTINGS = None
7272
USERCONTACT_UI_READONLY = None
7373
LOGIN_REQUIRED = None
74+
TEAM_MANAGED_MESSAGE = None
7475

7576

7677
def index(req, resp):
@@ -91,7 +92,8 @@ def index(req, resp):
9192
public_calendar_base_url=PUBLIC_CALENDAR_BASE_URL,
9293
public_calendar_additional_message=PUBLIC_CALENDAR_ADDITIONAL_MESSAGE,
9394
footer=INDEX_CONTENT_SETTING['footer'],
94-
timezones=SUPPORTED_TIMEZONES
95+
timezones=SUPPORTED_TIMEZONES,
96+
team_managed_message=TEAM_MANAGED_MESSAGE
9597
)
9698

9799

@@ -139,13 +141,15 @@ def init(application, config):
139141
global PUBLIC_CALENDAR_BASE_URL
140142
global PUBLIC_CALENDAR_ADDITIONAL_MESSAGE
141143
global LOGIN_REQUIRED
144+
global TEAM_MANAGED_MESSAGE
142145
SLACK_INSTANCE = config.get('slack_instance')
143146
HEADER_COLOR = config.get('header_color', '#3a3a3a')
144147
IRIS_PLAN_SETTINGS = config.get('iris_plan_integration')
145148
USERCONTACT_UI_READONLY = config.get('usercontact_ui_readonly', True)
146149
PUBLIC_CALENDAR_BASE_URL = config.get('public_calendar_base_url')
147150
PUBLIC_CALENDAR_ADDITIONAL_MESSAGE = config.get('public_calendar_additional_message')
148151
LOGIN_REQUIRED = config.get('require_auth')
152+
TEAM_MANAGED_MESSAGE = config.get('team_managed_message')
149153

150154
application.add_sink(index, '/')
151155
application.add_route('/static/bundles/{filename}',

src/oncall/ui/templates/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ <h4>
335335
</h4>
336336
<h4>
337337
{{#if api_managed_roster}}
338-
Managed team - this team is managed via API
338+
{% endraw %} <div> {{team_managed_message|safe}} </div> {% raw %}
339339
{{/if}}
340340
</h4>
341341
{% endraw %} {% endif %} {% raw %}

0 commit comments

Comments
 (0)