Skip to content

Commit 7baa79d

Browse files
refactor(content-health-monitor): add instructions on how to setup the env var (#262)
* Add instructional text for setting up MONITORED_CONTENT_GUID * Actually remember to update the manifest * Reword Step 2 to match language in Step 1 * Update extensions/content-health-monitor/content_health_utils.py Co-authored-by: Toph Allen <[email protected]> * Make it explicit what happens when clicking Refresh Report * Ensure consistent punctuation in the setup instructions * Remove unused images and image src attributes * Add images to update-manifest command in Makefile * Update manifest * Update tests to match changed setup instructions --------- Co-authored-by: Toph Allen <[email protected]>
1 parent 7d2cd18 commit 7baa79d

File tree

6 files changed

+37
-9
lines changed

6 files changed

+37
-9
lines changed

extensions/content-health-monitor/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ clean:
4949
.PHONY: update-manifest
5050
update-manifest:
5151
cp manifest.json manifest.old.json
52-
uv run rsconnect write-manifest quarto content-health-monitor.qmd content_health_utils.py --overwrite
52+
uv run rsconnect write-manifest quarto content-health-monitor.qmd content_health_utils.py images/refresh-report.png images/settings-gear-icon.png --overwrite
5353
jq -n --slurpfile old manifest.old.json --slurpfile new manifest.json \
5454
'{"version": $$new[0].version, "locale": $$new[0].locale, "metadata": $$new[0].metadata, "extension": $$old[0].extension, "environment": $$old[0].environment} * ($$new[0] | del(.version, .locale, .metadata))' \
5555
> manifest.merged.json
@@ -67,4 +67,4 @@ help:
6767
@echo " clean - Clean up virtual environment and cache files"
6868
@echo " update-manifest - Update manifest.json preserving extension and environment blocks"
6969
@echo " help - Show this help message"
70-
@echo " all - Setup environment and run tests (default)"
70+
@echo " all - Setup environment and run tests (default)"

extensions/content-health-monitor/content_health_utils.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,32 @@ def get_env_var(var_name, state, description=""):
6666
instruction = f"Please set the <code>{var_name}</code> environment variable."
6767
# Detailed instructions for MONITORED_CONTENT_GUID
6868
else:
69+
one_tab = "&nbsp;&nbsp;&nbsp;&nbsp;" # For indentation in HTML
70+
two_tabs = f"{one_tab}{one_tab}" # For deeper indentation
6971
instruction = (
70-
f"Open the <b>Content Settings</b> panel, then navigate to the <b>Vars</b> pane. "
71-
f"Create a new environment variable named <code>{var_name}</code>, set its value to the GUID of the content you want to monitor, "
72-
f"and click <b>Add Variable</b>. When you're done, click <b>Refresh Report</b> in the upper right toolbar menu to continue."
72+
f"To monitor a piece of content you must configure the <code>{var_name}</code> environment variable.<br><br>"
73+
74+
f"<b>Step 1:</b> Locate the content you want to monitor in a new browser tab or window<br>"
75+
f"{one_tab}<b>Option A:</b> Copy the GUID from the Content Settings panel<br>"
76+
f"{two_tabs}• Click the <b>gear icon</b> in the top right toolbar to open <b>Content Settings</b><br>"
77+
f'{two_tabs}<img src="images/settings-gear-icon.png" alt="Settings gear icon location" '
78+
f'style="max-width: 80%; margin: 10px 0; border: 1px solid #ddd;"><br>'
79+
f"{two_tabs}• Select the <b>Info</b> tab<br>"
80+
f"{two_tabs}• Scroll to the bottom and click the <b>copy</b> button next to the GUID<br>"
81+
f"{one_tab}<b>Option B:</b> Copy the full URL from your browser<br>"
82+
f"{two_tabs}• If the address bar contains a GUID (ex: 1d97c1ff-e56c-4074-906f-cb3557685b75), "
83+
f"you can simply copy the entire URL<br><br>"
84+
85+
f"<b>Step 2:</b> Return to this report to set the environment variable<br>"
86+
f"{one_tab}• Click the <b>gear icon</b> to open <b>Content Settings</b><br>"
87+
f"{one_tab}• Select the <b>Vars</b> tab<br>"
88+
f"{one_tab}• Add a new variable named <code>{var_name}</code><br>"
89+
f"{one_tab}• Paste the GUID you copied into the value field<br>"
90+
f"{one_tab}• Click <b>Add Variable</b> and then <b>Save</b> to save it<br><br>"
91+
92+
f"<b>Step 3:</b> Click <b>Refresh Report</b> in the top right to to run a health check against the content specified in the new variable<br>"
93+
f'<img src="images/refresh-report.png" alt="Refresh report button" style="max-width: 80%; margin: 10px 0; border: 1px solid #ddd;"><br><br>'
94+
7395
)
7496

7597
if description:
9.12 KB
Loading
9.63 KB
Loading

extensions/content-health-monitor/manifest.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"version": "3.11.7",
3333
"package_manager": {
3434
"name": "pip",
35-
"version": "25.1.1",
35+
"version": "24.2",
3636
"package_file": "requirements.txt"
3737
}
3838
},
@@ -41,10 +41,16 @@
4141
"checksum": "5f89d52674b219c0b0ed85f1a5785641"
4242
},
4343
"content-health-monitor.qmd": {
44-
"checksum": "7a31430ef0d92505829e214ac85f8633"
44+
"checksum": "8dfce167badb4d889eeb93d1f4adbff8"
4545
},
4646
"content_health_utils.py": {
47-
"checksum": "73627372e41f90a2259ea5c0969d19a9"
47+
"checksum": "3d599ebe8d29aa12ae630acc847e290a"
48+
},
49+
"images/refresh-report.png": {
50+
"checksum": "e5680e6188eb8d659e4313cb89d0be3b"
51+
},
52+
"images/settings-gear-icon.png": {
53+
"checksum": "e2bc43263eb8a9179b6e0e5ab3e22450"
4854
}
4955
}
5056
}

extensions/content-health-monitor/test_content_health_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def test_get_env_var_missing_canary_guid(self, state):
163163
assert result == ""
164164
assert state.show_instructions
165165
assert len(state.instructions) == 1
166-
assert "Open the <b>Content Settings</b> panel" in state.instructions[0]
166+
assert "you must configure the <code>MONITORED_CONTENT_GUID</code> environment variable" in state.instructions[0]
167167
assert f"<code>{var_name}</code>" in state.instructions[0]
168168

169169
def test_get_env_var_with_description(self, state):

0 commit comments

Comments
 (0)