Django-SupportTools 3.6.4__tar.gz → 4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. {django_supporttools-3.6.4 → django_supporttools-4.0}/Django_SupportTools.egg-info/PKG-INFO +2 -2
  2. {django_supporttools-3.6.4 → django_supporttools-4.0}/Django_SupportTools.egg-info/SOURCES.txt +9 -0
  3. {django_supporttools-3.6.4 → django_supporttools-4.0}/PKG-INFO +2 -2
  4. django_supporttools-4.0/README.md +411 -0
  5. {django_supporttools-3.6.4 → django_supporttools-4.0}/setup.py +1 -1
  6. django_supporttools-4.0/supporttools/VERSION +1 -0
  7. django_supporttools-4.0/supporttools/context_processors.py +228 -0
  8. django_supporttools-4.0/supporttools/static/supporttools/css/bootstrap-icons.woff +0 -0
  9. django_supporttools-4.0/supporttools/static/supporttools/css/bootstrap-icons.woff2 +0 -0
  10. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/supporttools/css/desktop.less +37 -23
  11. django_supporttools-4.0/supporttools/static/supporttools/css/main.css +1 -0
  12. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/supporttools/css/mobile.less +5 -0
  13. django_supporttools-4.0/supporttools/static/supporttools/js/main.js +1 -0
  14. django_supporttools-3.6.4/supporttools/static/supporttools/js/main.js → django_supporttools-4.0/supporttools/static/supporttools/js/restclients.js +29 -62
  15. django_supporttools-4.0/supporttools/templates/restclients/proxy_wrapper.html +7 -0
  16. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/templates/supporttools/base.html +59 -8
  17. django_supporttools-4.0/supporttools/templates/supporttools/spa_tool.html +17 -0
  18. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/templatetags/sidebar_links.py +3 -3
  19. django_supporttools-4.0/supporttools/templatetags/vite.py +99 -0
  20. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/tests/__init__.py +4 -3
  21. django_supporttools-4.0/supporttools/tests/test_context_processors.py +217 -0
  22. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/tests/test_sidebar_links.py +2 -2
  23. django_supporttools-4.0/supporttools/tests/test_templatetags_vite.py +165 -0
  24. django_supporttools-4.0/supporttools/tests/test_urls.py +66 -0
  25. django_supporttools-4.0/supporttools/tests/test_views.py +114 -0
  26. django_supporttools-4.0/supporttools/urls.py +66 -0
  27. django_supporttools-4.0/supporttools/views.py +37 -0
  28. django_supporttools-3.6.4/README.md +0 -50
  29. django_supporttools-3.6.4/supporttools/VERSION +0 -1
  30. django_supporttools-3.6.4/supporttools/context_processors.py +0 -39
  31. django_supporttools-3.6.4/supporttools/templates/restclients/proxy_wrapper.html +0 -2
  32. django_supporttools-3.6.4/supporttools/tests/test_context_processors.py +0 -89
  33. django_supporttools-3.6.4/supporttools/urls.py +0 -10
  34. django_supporttools-3.6.4/supporttools/views.py +0 -9
  35. {django_supporttools-3.6.4 → django_supporttools-4.0}/Django_SupportTools.egg-info/dependency_links.txt +0 -0
  36. {django_supporttools-3.6.4 → django_supporttools-4.0}/Django_SupportTools.egg-info/requires.txt +0 -0
  37. {django_supporttools-3.6.4 → django_supporttools-4.0}/Django_SupportTools.egg-info/top_level.txt +0 -0
  38. {django_supporttools-3.6.4 → django_supporttools-4.0}/LICENSE +0 -0
  39. {django_supporttools-3.6.4 → django_supporttools-4.0}/MANIFEST.in +0 -0
  40. {django_supporttools-3.6.4 → django_supporttools-4.0}/setup.cfg +0 -0
  41. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/__init__.py +0 -0
  42. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/supporttools/css/.DS_Store +0 -0
  43. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/android-196x196.png +0 -0
  44. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/apple-touch-icon-114x114-precomposed.png +0 -0
  45. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/apple-touch-icon-120x120-precomposed.png +0 -0
  46. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/apple-touch-icon-144x144-precomposed.png +0 -0
  47. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/apple-touch-icon-152x152-precomposed.png +0 -0
  48. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/apple-touch-icon-180x180-precomposed.png +0 -0
  49. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/apple-touch-icon-192x192-precomposed.png +0 -0
  50. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/apple-touch-icon-57x57-precomposed.png +0 -0
  51. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/apple-touch-icon-60x60-precomposed.png +0 -0
  52. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/apple-touch-icon-72x72-precomposed.png +0 -0
  53. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/apple-touch-icon-76x76-precomposed.png +0 -0
  54. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/apple-touch-icon-precomposed.png +0 -0
  55. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/favicon.ico +0 -0
  56. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/win8-144x144.png +0 -0
  57. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/win8-150x150.png +0 -0
  58. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/win8-310x150.png +0 -0
  59. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/win8-310x310.png +0 -0
  60. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/uw/ico/win8-70x70.png +0 -0
  61. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/vendor/fonts/FontAwesome.otf +0 -0
  62. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/vendor/fonts/fontawesome-webfont.eot +0 -0
  63. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/vendor/fonts/fontawesome-webfont.svg +0 -0
  64. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/vendor/fonts/fontawesome-webfont.ttf +0 -0
  65. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/vendor/fonts/fontawesome-webfont.woff +0 -0
  66. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/vendor/fonts/glyphicons-halflings-regular.eot +0 -0
  67. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/vendor/fonts/glyphicons-halflings-regular.svg +0 -0
  68. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/vendor/fonts/glyphicons-halflings-regular.ttf +0 -0
  69. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/vendor/fonts/glyphicons-halflings-regular.woff +0 -0
  70. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/vendor/js/chart.min.js +0 -0
  71. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/vendor/js/jquery-1.10.2.min.js +0 -0
  72. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/static/vendor/js/less-1.7.0.min.js +0 -0
  73. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/templates/persistent_message/manage_wrapper.html +0 -0
  74. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/templates/status_app/status_wrapper.html +0 -0
  75. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/templates/supporttools/default_sidelinks.html +0 -0
  76. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/templates/supporttools/home.html +0 -0
  77. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/templates/userservice/user_override_wrapper.html +0 -0
  78. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/templatetags/__init__.py +0 -0
  79. {django_supporttools-3.6.4 → django_supporttools-4.0}/supporttools/tests/test_templates/supporttools/custom_sidebar_links.html +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Django-SupportTools
3
- Version: 3.6.4
3
+ Version: 4.0
4
4
  Summary: A Django application used for theming and wrapping support tools.
5
5
  Home-page: https://github.com/uw-it-aca/django-supporttools
6
- Author: UW-IT Student & Educational Technology Services
6
+ Author: UWIT Student & Educational Technology Services
7
7
  Author-email: aca-it@uw.edu
8
8
  License: Apache License, Version 2.0
9
9
  Classifier: Intended Audience :: Developers
@@ -13,9 +13,13 @@ supporttools/context_processors.py
13
13
  supporttools/urls.py
14
14
  supporttools/views.py
15
15
  supporttools/static/supporttools/css/.DS_Store
16
+ supporttools/static/supporttools/css/bootstrap-icons.woff
17
+ supporttools/static/supporttools/css/bootstrap-icons.woff2
16
18
  supporttools/static/supporttools/css/desktop.less
19
+ supporttools/static/supporttools/css/main.css
17
20
  supporttools/static/supporttools/css/mobile.less
18
21
  supporttools/static/supporttools/js/main.js
22
+ supporttools/static/supporttools/js/restclients.js
19
23
  supporttools/static/uw/ico/android-196x196.png
20
24
  supporttools/static/uw/ico/apple-touch-icon-114x114-precomposed.png
21
25
  supporttools/static/uw/ico/apple-touch-icon-120x120-precomposed.png
@@ -52,10 +56,15 @@ supporttools/templates/status_app/status_wrapper.html
52
56
  supporttools/templates/supporttools/base.html
53
57
  supporttools/templates/supporttools/default_sidelinks.html
54
58
  supporttools/templates/supporttools/home.html
59
+ supporttools/templates/supporttools/spa_tool.html
55
60
  supporttools/templates/userservice/user_override_wrapper.html
56
61
  supporttools/templatetags/__init__.py
57
62
  supporttools/templatetags/sidebar_links.py
63
+ supporttools/templatetags/vite.py
58
64
  supporttools/tests/__init__.py
59
65
  supporttools/tests/test_context_processors.py
60
66
  supporttools/tests/test_sidebar_links.py
67
+ supporttools/tests/test_templatetags_vite.py
68
+ supporttools/tests/test_urls.py
69
+ supporttools/tests/test_views.py
61
70
  supporttools/tests/test_templates/supporttools/custom_sidebar_links.html
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Django-SupportTools
3
- Version: 3.6.4
3
+ Version: 4.0
4
4
  Summary: A Django application used for theming and wrapping support tools.
5
5
  Home-page: https://github.com/uw-it-aca/django-supporttools
6
- Author: UW-IT Student & Educational Technology Services
6
+ Author: UWIT Student & Educational Technology Services
7
7
  Author-email: aca-it@uw.edu
8
8
  License: Apache License, Version 2.0
9
9
  Classifier: Intended Audience :: Developers
@@ -0,0 +1,411 @@
1
+ # Django Support Tools
2
+
3
+ [![Build Status](https://github.com/uw-it-aca/django-supporttools/workflows/tests/badge.svg)](https://github.com/uw-it-aca/django-supporttools/actions)
4
+ [![Coverage Status](https://coveralls.io/repos/github/uw-it-aca/django-supporttools/badge.svg?branch=main)](https://coveralls.io/github/uw-it-aca/django-supporttools?branch=main)
5
+ [![PyPi Version](https://img.shields.io/pypi/v/django-supporttools.svg)](https://pypi.python.org/pypi/django-supporttools)
6
+ ![Python versions](https://img.shields.io/badge/python-3.10%20%7C%203.12-blue.svg)
7
+ ![Django versions](https://img.shields.io/badge/django-4.2%20%7C%205.2-green.svg)
8
+
9
+
10
+ A Django application used for theming and wrapping support tools.
11
+
12
+ Supported Python versions are 3.10 and 3.12. CI tests each against Django 4.2
13
+ and 5.2.
14
+
15
+ ### Installation
16
+
17
+ This should be installed as a dependency in your project. You should not install this manually.
18
+
19
+ ### Configuration
20
+
21
+ Add these values to your project's settings.py:
22
+
23
+ ```
24
+ MIDDLEWARE = [
25
+ ...
26
+ 'userservice.user.UserServiceMiddleware',
27
+ 'django_user_agents.middleware.UserAgentMiddleware',
28
+ ]
29
+
30
+ INSTALLED_APPS = [
31
+ ...
32
+ 'supporttools',
33
+ 'userservice',
34
+ 'compressor',
35
+ 'django_user_agents',
36
+ ]
37
+
38
+ TEMPLATES = [
39
+ {
40
+ 'OPTIONS': {
41
+ 'context_processors': [
42
+ ...
43
+ 'django.template.context_processors.request',
44
+ 'supporttools.context_processors.supportools_globals',
45
+ 'supporttools.context_processors.has_less_compiled',
46
+ ],
47
+ },
48
+ },
49
+ ]
50
+
51
+ # Where the back link should go, and how it's labeled.
52
+ SUPPORTTOOLS_PARENT_APP = "TestApp"
53
+ SUPPORTTOOLS_PARENT_APP_URL = "/"
54
+
55
+ # Optional: enable Vue-powered supporttools navigation shell.
56
+ # Keep False during migration to preserve legacy behavior.
57
+ SUPPORTTOOLS_VUE_ENABLED = False
58
+
59
+ # Required when this app defines SPA tools with a `vite_entry`.
60
+ # This is a filesystem path to the manifest generated by the app's Vite build,
61
+ # not a static URL. Update it for the collected-static location in production.
62
+ VITE_MANIFEST_PATH = BASE_DIR / 'myapp/static/.vite/manifest.json'
63
+
64
+ # Optional: new structured link registry (preferred over EXTRA_VIEWS
65
+ # when configured).
66
+ # Example A — simple server-rendered tool:
67
+ SUPPORTTOOLS_VIEW_REGISTRY = [
68
+ {
69
+ "id": "app-tool-1",
70
+ "section": "application",
71
+ "order": 10,
72
+ "label": "Example Tool",
73
+ "url_name": "example_tool",
74
+ "url_args": [],
75
+ "url_kwargs": {},
76
+ }
77
+ ]
78
+
79
+ # Example B — SPA tool (use one definition, not both):
80
+ # Optional: mixed navigation support for incremental migration.
81
+ # Legacy tools can stay server-rendered; converted Vue tools are SPA-only.
82
+ # mode defaults to "server" only for legacy entries.
83
+ # Entries with SPA marker fields (route/component_key/vite_entry)
84
+ # are treated as "spa" even if mode is omitted.
85
+ #
86
+ # SPA-mode fields:
87
+ # route – URL path the component is served at (must match a Django URL pattern)
88
+ # component_key – key used to look up the component in window.supporttoolsSpaComponents
89
+ # vite_entry – Vite asset path; passed to {% vite_scripts %} in the generic SPA template
90
+ # view – dotted import path to the Django view class (required unless SUPPORTTOOLS_DEFAULT_SPA_VIEW is set)
91
+ SUPPORTTOOLS_VIEW_REGISTRY = [
92
+ {
93
+ "id": "retention-admin",
94
+ "section": "application",
95
+ "order": 20,
96
+ "label": "Retention Admin",
97
+ "url_name": "retention_admin",
98
+ "mode": "spa",
99
+ "route": "/support/retention_admin/",
100
+ "component_key": "retention_admin",
101
+ "vite_entry": "myapp_vue/support/retention-admin.js",
102
+ "view": "myapp.views.support.retention.RetentionAdminView", # omit to use the default SPA view
103
+ }
104
+ ]
105
+
106
+ # Optional: default view class for auto-registered SPA tools.
107
+ # Used when a registry entry omits the "view" key.
108
+ # Typically a project-specific subclass of SpaToolView that adds authentication.
109
+ SUPPORTTOOLS_DEFAULT_SPA_VIEW = "myapp.views.support.base.MySpaToolView"
110
+ ```
111
+
112
+ ### Migrating to Vue
113
+
114
+ Apps can migrate incrementally across four phases. Each phase is independently
115
+ testable and reversible before moving to the next.
116
+
117
+ | Phase | What changes | Minimum required |
118
+ |---|---|---|
119
+ | 0 | Nothing — existing server-rendered nav keeps working | No changes required |
120
+ | 1 | Enable the Vue nav shell | One settings flag: `SUPPORTTOOLS_VUE_ENABLED = True` |
121
+ | 2 | Register tools explicitly | Add entries to `SUPPORTTOOLS_VIEW_REGISTRY` (or keep using `SUPPORTTOOLS_EXTRA_VIEWS`) |
122
+ | 3 | Set up shared SPA infrastructure | One base view class, one settings entry, one `urls.py` line, one Vite config snippet |
123
+ | 4 | Convert individual pages to Vue | One registry entry + one JS entry point + one Vue component per tool |
124
+
125
+ Phases 0–2 require no Node.js and no frontend changes. Phase 3 is a
126
+ one-time project setup. Phase 4 is per-tool and fully incremental — legacy
127
+ tools can remain server-rendered indefinitely.
128
+
129
+ ---
130
+
131
+ #### Phase 1 — Enable the Vue nav shell (zero-config)
132
+
133
+ Set the feature flag in your settings file:
134
+
135
+ ```python
136
+ SUPPORTTOOLS_VUE_ENABLED = True
137
+ ```
138
+
139
+ That is the only required change. When the flag is on, the Vue nav shell
140
+ mounts on `#supporttools-vue-nav` and automatically harvests links from the
141
+ server-rendered `{% sidebar_links %}` output already present in the DOM — so
142
+ your existing `custom_sidebar_links.html` override (if any) keeps its section
143
+ headings, link labels, ordering, and visibility rules with no changes.
144
+ Enabling the shell does not convert any tool page; tools remain server-rendered
145
+ until they are configured as SPA entries in Phase 4.
146
+
147
+ **Verify**: the sidebar renders the same links as before, the hamburger toggle
148
+ works on mobile viewports, and there are no JS errors in the browser console.
149
+
150
+ ---
151
+
152
+ #### Phase 2 — Register your tools explicitly (optional but recommended)
153
+
154
+ The rendered sidebar remains the presentation source of truth while an app is
155
+ migrating. Registering tools in settings adds navigation behavior such as SPA
156
+ routing; explicit registry entries that are not in the rendered sidebar are
157
+ also appended, so tools can be converted incrementally.
158
+
159
+ **Option A — simple dict (lowest friction first step):**
160
+
161
+ ```python
162
+ # settings.py
163
+ SUPPORTTOOLS_EXTRA_VIEWS = {
164
+ "My Tool": "my_tool_url_name",
165
+ "Another Tool": "another_tool_url_name",
166
+ }
167
+ ```
168
+
169
+ **Option B — structured registry (preferred for new work):**
170
+
171
+ ```python
172
+ # settings.py
173
+ SUPPORTTOOLS_VIEW_REGISTRY = [
174
+ {
175
+ "id": "my-tool",
176
+ "section": "application",
177
+ "order": 10,
178
+ "label": "My Tool",
179
+ "url_name": "my_tool_url_name",
180
+ },
181
+ {
182
+ "id": "another-tool",
183
+ "section": "application",
184
+ "order": 20,
185
+ "label": "Another Tool",
186
+ "url_name": "another_tool_url_name",
187
+ },
188
+ ]
189
+ ```
190
+
191
+ When `SUPPORTTOOLS_VIEW_REGISTRY` is set it takes precedence; entries from
192
+ `SUPPORTTOOLS_EXTRA_VIEWS` are merged in as a supplement. Once your tools are
193
+ registered here, a simple `custom_sidebar_links.html` override can be removed.
194
+ Keep an override that supplies custom sections, conditional links, or required
195
+ ordering until the rendered Vue navigation has been verified to preserve those
196
+ requirements.
197
+
198
+ ---
199
+
200
+ #### Phase 3 — Set up shared SPA infrastructure (once per project)
201
+
202
+ Complete this once before converting any individual tool in Phase 4.
203
+
204
+ **1. Create a project-level SPA view base** that adds your auth decorator:
205
+
206
+ ```python
207
+ # myapp/views/support/base.py
208
+ from django.conf import settings
209
+ from django.utils.decorators import method_decorator
210
+ from uw_saml.decorators import group_required
211
+ from supporttools.views import SpaToolView
212
+
213
+ @method_decorator(group_required(settings.MY_SUPPORT_GROUP), name='dispatch')
214
+ class MySpaToolView(SpaToolView):
215
+ pass
216
+ ```
217
+
218
+ **2. Add the default view and register SPA URLs**:
219
+
220
+ ```python
221
+ # settings.py
222
+ SUPPORTTOOLS_DEFAULT_SPA_VIEW = "myapp.views.support.base.MySpaToolView"
223
+ ```
224
+
225
+ If your project does not already include `supporttools.urls`, append generated
226
+ SPA routes after your application routes:
227
+
228
+ ```python
229
+ # project/urls.py
230
+ from supporttools.urls import get_registry_urlpatterns
231
+
232
+ urlpatterns += get_registry_urlpatterns()
233
+ ```
234
+
235
+ Do not add a root-level `include("supporttools.urls")` solely to enable SPA
236
+ routes: its legacy home route is a catch-all. Alternatively, keep an existing
237
+ project URL and change that URL's view to your authenticated SPA view. In either
238
+ case, each registry `route` must resolve to the URL served by that view.
239
+
240
+ **3. Auto-discover Vite entry points** by editing your existing `vite.config.js`
241
+ so new tools are picked up automatically:
242
+
243
+ Add/merge the snippet below into your current Vite config. Do not replace the
244
+ entire file.
245
+
246
+ ```javascript
247
+ // vite.config.js
248
+ import { readdirSync } from "fs";
249
+
250
+ const supportEntries = readdirSync("./myapp_vue/support")
251
+ .filter((f) => f.endsWith(".js"))
252
+ .map((f) => `./myapp_vue/support/${f}`);
253
+
254
+ export default defineConfig({
255
+ build: {
256
+ manifest: true,
257
+ rollupOptions: {
258
+ input: ["./myapp_vue/main.js", ...supportEntries],
259
+ },
260
+ },
261
+ });
262
+ ```
263
+
264
+ Each `vite_entry` must be an input in this app-owned Vite build. Build the
265
+ assets with `npm run build` before `collectstatic`, and configure
266
+ `VITE_MANIFEST_PATH` to the generated manifest's filesystem path. The generic
267
+ SPA template loads both the entry's JavaScript and its manifest-listed CSS.
268
+
269
+ **Still on webpack, not Vite?** `{% vite_scripts %}`/`{% vite_styles %}` only
270
+ read a JSON manifest matching Vite's manifest shape
271
+ (`{"entry": {"file", "css", "imports"}}`) at `VITE_MANIFEST_PATH` — nothing
272
+ requires the file to be produced by the Vite CLI. You do not need to migrate
273
+ your existing webpack build to adopt SPA tool pages. Two options:
274
+
275
+ - **Option A — run Vite alongside webpack (recommended):** Add a second,
276
+ minimal `vite.config.js` that only builds new SPA tool entry points (as
277
+ shown above) into their own output directory, and point
278
+ `VITE_MANIFEST_PATH` at its generated `manifest.json`. Leave your existing
279
+ webpack config, `webpack-stats.json`, and `WEBPACK_LOADER` setup untouched
280
+ for all current bundles — the two bundlers coexist, one per generation of
281
+ tool pages.
282
+
283
+ - **Option B — emit a Vite-shaped manifest from webpack:** Add a small
284
+ webpack plugin or post-build script that writes a `manifest.json` in the
285
+ same shape from your existing webpack output, so `vite_scripts`/
286
+ `vite_styles` work without introducing Vite tooling at all. This avoids a
287
+ second build pipeline but requires maintaining the conversion shim as your
288
+ webpack config evolves.
289
+
290
+ ---
291
+
292
+ #### Phase 4 — Convert individual pages to Vue
293
+
294
+ Each page can be converted independently without affecting other tools.
295
+ Legacy tools can remain server-rendered while converted tools use SPA nav.
296
+
297
+ - `mode: "server"` (default for legacy entries): normal full-page navigation.
298
+ - `mode: "spa"`: client-side navigation — no full-page reload when the sidebar
299
+ link is clicked.
300
+ - Converted Vue tools are SPA-only. If `route`, `component_key`, or
301
+ `vite_entry` is present, the entry is normalized to `mode: "spa"`.
302
+
303
+ Data access is owned by the tool component. A tool can pre-load data from
304
+ the server on direct URL navigation, and fetch from API endpoints when
305
+ mounted via SPA navigation. This direct-URL bootstrap uses the SPA view
306
+ template; it is not a fallback to server-navigation mode.
307
+
308
+ ---
309
+
310
+ ##### Adding a new SPA tool
311
+
312
+ **1. Register the tool in `SUPPORTTOOLS_VIEW_REGISTRY`**
313
+
314
+ ```python
315
+ {
316
+ "id": "my-tool",
317
+ "section": "application",
318
+ "order": 10,
319
+ "label": "My Tool",
320
+ "url_name": "my_tool",
321
+ "mode": "spa",
322
+ "route": "/support/my_tool/",
323
+ "component_key": "my_tool",
324
+ "vite_entry": "myapp_vue/support/my-tool.js",
325
+ # "view": "myapp.views.support.my_tool.MyToolView" # only needed for custom server data
326
+ }
327
+ ```
328
+
329
+ The URL is registered by the Phase 3 URL handoff. No additional `urls.py` edit
330
+ is needed for this tool.
331
+
332
+ **2. Create the Vue entry point** (the entire file):
333
+
334
+ ```javascript
335
+ // myapp_vue/support/my-tool.js
336
+ window.supporttoolsRegisterSpaTool("my_tool", () => import("./MyTool.vue"));
337
+ ```
338
+
339
+ `window.supporttoolsRegisterSpaTool` is provided by the supporttools bundle
340
+ already loaded in `base.html`. It handles both SPA-nav mounting (via the
341
+ sidebar) and direct-URL mounting (via server-rendered JSON). No imports needed.
342
+
343
+ **3. Create the Vue component**
344
+
345
+ The component receives a `pageData` prop on direct-URL load (populated from
346
+ server-rendered JSON), and a `tool` prop when mounted via SPA navigation:
347
+
348
+ ```vue
349
+ <template>
350
+ <div>
351
+ <h1>My Tool</h1>
352
+ <!-- your UI -->
353
+ </div>
354
+ </template>
355
+
356
+ <script>
357
+ export default {
358
+ name: "MyTool",
359
+ props: {
360
+ pageData: { type: Object, default: () => ({}) },
361
+ tool: { type: Object, default: null },
362
+ },
363
+ async mounted() {
364
+ // When mounted via SPA nav, pageData is empty — fetch fresh data from API.
365
+ if (this.tool && this.tool.mode === "spa") {
366
+ await this.loadData();
367
+ }
368
+ },
369
+ methods: {
370
+ async loadData() { /* fetch from your API endpoint */ },
371
+ },
372
+ };
373
+ </script>
374
+ ```
375
+
376
+ **That's all that's needed for a tool with no server-side bootstrap data.**
377
+
378
+ ---
379
+
380
+ ##### Adding server-side bootstrap data (optional)
381
+
382
+ If the tool needs data pre-loaded on direct URL navigation, create a
383
+ Django view that inherits from your project's SPA view base and overrides
384
+ `get_page_data()`. The data is serialised to JSON and passed as the
385
+ `pageData` prop automatically by the generic `spa_tool.html` template.
386
+
387
+ ```python
388
+ # myapp/views/support/my_tool.py
389
+ from myapp.views.support.base import MySpaToolView
390
+
391
+ class MyToolView(MySpaToolView):
392
+ def get_page_data(self):
393
+ return {
394
+ 'items': [
395
+ {'id': obj.id, 'name': obj.name}
396
+ for obj in MyModel.objects.all()
397
+ ]
398
+ }
399
+ ```
400
+
401
+ Then add `"view": "myapp.views.support.my_tool.MyToolView"` to the registry
402
+ entry. No template file needed — `spa_tool.html` is used automatically.
403
+
404
+ ---
405
+
406
+ #### CI/CD note
407
+
408
+ The compiled bundle at `supporttools/static/supporttools/js/main.js` is built
409
+ at publish time by CI and distributed inside the PyPI wheel. Consuming apps do
410
+ not need Node.js. See `.github/workflows/cicd.yml` for the build step in the
411
+ `publish` job.
@@ -18,7 +18,7 @@ setup(
18
18
  name='Django-SupportTools',
19
19
  version=VERSION,
20
20
  packages=['supporttools'],
21
- author="UW-IT Student & Educational Technology Services",
21
+ author="UWIT Student & Educational Technology Services",
22
22
  author_email="aca-it@uw.edu",
23
23
  include_package_data=True,
24
24
  install_requires=[
@@ -0,0 +1 @@
1
+ 4.0