Commit 79c8d07
UN-1722 [FEAT] Add export reminder for Prompt Studio projects in use (#1547)
* UN-1722 [FEAT] Add export reminder for Prompt Studio projects in use
- Add backend API endpoint to check if project is used in deployments
- Implement frontend change tracking for prompt modifications
- Create yellow notification bar component with export action
- Track changes when editing, adding, or deleting prompts
- Clear notification after successful export
- Check usage in API Deployments, ETL/Task Pipelines, and Manual Review
This ensures users are reminded to export their Prompt Studio changes when
the project is actively being used in deployments, preventing confusion
about why changes don't take effect immediately.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix: Remove trailing commas to fix Prettier/ESLint build errors
Removed 10 trailing commas from 4 files that were causing the Docker
build to fail with Prettier violations:
- DocumentParser.jsx: 3 locations (lines 86, 124, 179)
- Header.jsx: 3 locations (lines 73, 176, 277)
- ToolIde.jsx: 2 locations (lines 97, 223)
- custom-tool-store.js: 2 locations (lines 83, 106)
These changes ensure the code passes ESLint/Prettier checks during
the build process without modifying any functionality.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* refactor: Fix CodeRabbit major issues - state carryover and useCallback pattern
Fixed two major issues identified by CodeRabbit review:
1. Fixed state carryover bug in custom-tool-store.js
- When switching tools, deploymentUsageInfo and lastExportedAt now
properly reset to null instead of carrying over from previous tool
- Prevents incorrect export reminders showing for wrong projects
2. Fixed useCallback pattern issue in ToolIde.jsx
- Replaced isCheckingUsage state in useCallback deps with useRef
- Prevents unnecessary callback recreations and potential race conditions
- Simplified useEffect dependencies to only depend on the callback
- Removed unused isCheckingUsage state variable
These changes improve code quality and prevent potential bugs without
affecting functionality.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* fix: Address all PR #1547 review comments from chandrasekharan-zipstack
This commit addresses all actionable review comments from the code reviewer:
## Backend Changes (views.py, constants.py, exceptions.py)
1. **Import Location Fix** ✅
- Moved APIDeployment, Pipeline, and WorkflowEndpoint imports to top of file
- Removed lazy imports from check_deployment_usage method
- Follows Python best practices for import organization
2. **Deployment Type Enum** ✅
- Created DeploymentType class in constants.py with deployment type constants
- Updated check_deployment_usage to use DeploymentType constants
- Replaced hardcoded strings: "API Deployment", "ETL Pipeline", etc.
- Improves maintainability and prevents typos
3. **Error Handling** ✅
- Created DeploymentUsageCheckError exception class
- Changed check_deployment_usage to raise exception instead of returning error response
- Provides better error handling and follows DRF exception patterns
4. **Function Naming** ✅
- Renamed _check_tool_usage to _check_tool_usage_in_workflows
- More explicit function name clarifies it checks workflow usage specifically
- Updated all calls in destroy() and check_deployment_usage() methods
## Frontend Changes (ToolIde.jsx, CustomToolsHelper.js)
5. **Store State Race Condition Fix** ✅
- Added explicit reset of hasUnsavedChanges, deploymentUsageInfo, lastExportedAt
- Ensures fields don't carry over when switching between tools
- Prevents incorrect export reminders showing for wrong projects
6. **Stale State Race Condition Fix** ✅
- Added check for current hasUnsavedChanges state after API response
- Prevents showing export reminder if user exported during in-flight check
- Uses customToolStore.getState() to get real-time state value
## Not Addressed (Requires Discussion)
- Active filtering question: Needs product/architecture discussion
- UX enhancement for clickable links: May be future enhancement
All code quality and bug fix comments have been fully addressed.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* fix: PR review comments
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix: PR review comments
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* coderabbit fixes commit
* Fixes for export conditions
---------
Co-authored-by: Claude <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent 09f62be commit 79c8d07
File tree
11 files changed
+426
-22
lines changed- backend/prompt_studio/prompt_studio_core_v2
- frontend/src
- components
- custom-tools
- document-parser
- export-reminder-bar
- header
- tool-ide
- helpers/custom-tools
- store
11 files changed
+426
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
183 | 192 | | |
184 | 193 | | |
185 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| |||
134 | 138 | | |
135 | 139 | | |
136 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
137 | 146 | | |
138 | 147 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| 44 | + | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
| |||
119 | 124 | | |
120 | 125 | | |
121 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
122 | 211 | | |
123 | 212 | | |
124 | 213 | | |
125 | 214 | | |
126 | 215 | | |
127 | | - | |
128 | | - | |
129 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
130 | 225 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | 226 | | |
144 | 227 | | |
145 | 228 | | |
| |||
569 | 652 | | |
570 | 653 | | |
571 | 654 | | |
572 | | - | |
| 655 | + | |
573 | 656 | | |
574 | | - | |
| 657 | + | |
575 | 658 | | |
576 | 659 | | |
577 | 660 | | |
| |||
672 | 755 | | |
673 | 756 | | |
674 | 757 | | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
| |||
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| 96 | + | |
| 97 | + | |
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
| |||
117 | 120 | | |
118 | 121 | | |
119 | 122 | | |
120 | | - | |
| 123 | + | |
121 | 124 | | |
122 | 125 | | |
123 | 126 | | |
| |||
0 commit comments