chore: update @unraid/shared-callbacks to version 3.0.0#1831
chore: update @unraid/shared-callbacks to version 3.0.0#1831
Conversation
WalkthroughRemove multiple frontend demo/debug/login pages and related GraphQL/query files, add a standalone redirect HTML and register it in the plugin manifest, bump Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1831 +/- ##
==========================================
+ Coverage 52.04% 52.89% +0.85%
==========================================
Files 876 868 -8
Lines 50509 50050 -459
Branches 5023 5079 +56
==========================================
+ Hits 26285 26472 +187
+ Misses 24149 23503 -646
Partials 75 75 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/src/pages/redirect.vue (1)
74-74: Avoid calling getRedirectUrl() in the template.The function is already called in
onMounted(line 61) to perform the redirect. Calling it again in the template at line 74 causes double execution, logging everything twice and potentially computing different values if timing matters.Cache the computed URL in a ref if you need it in both places:
<script setup lang="ts"> -import { onMounted } from 'vue'; +import { onMounted, ref } from 'vue'; + +const redirectUrl = ref(''); // ... existing functions ... onMounted(() => { console.log('[redirect.vue] mounted, starting redirect flow'); setTimeout(() => { const textElement = document.getElementById('text'); if (textElement) { textElement.style.display = 'block'; } }, 750); - const redirectUrl = getRedirectUrl(); + redirectUrl.value = getRedirectUrl(); console.log('[redirect.vue] final redirect URL:', redirectUrl); - window.location.href = redirectUrl; + window.location.href = redirectUrl.value; }); </script> <template> <div> <div id="text" style="text-align: center; margin-top: calc(100vh - 75%); display: none; font-family: sans-serif" > <h1>Redirecting...</h1> - <h2><a :href="getRedirectUrl()">Click here if you are not redirected automatically</a></h2> + <h2><a :href="redirectUrl">Click here if you are not redirected automatically</a></h2> </div> </div> </template>
🧹 Nitpick comments (2)
web/src/pages/redirect.vue (1)
4-11: Clarify parseRedirectTarget behavior or rename the function.The function name implies it parses and uses the
targetparameter, but it always returns'/'regardless of input. If this is intentional for security (not trusting arbitrary paths), consider renaming tosanitizeRedirectTargetorgetDefaultTargetto better reflect the behavior.plugin/source/dynamix.unraid.net/usr/local/emhttp/redirect.htm (1)
29-32: Unnecessary try-catch for window.location logging.Accessing
window.location.toString()is a standard operation that shouldn't throw errors in normal browser environments. The try-catch adds complexity without clear benefit.Consider removing the try-catch:
- try { - console.log('[redirect.htm] initial window.location:', window.location.toString()); - } catch (e) { - console.log('[redirect.htm] initial window.location error:', e); - } + console.log('[redirect.htm] initial window.location:', window.location.toString());
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
plugin/plugins/dynamix.unraid.net.plg(2 hunks)plugin/source/dynamix.unraid.net/usr/local/emhttp/redirect.htm(1 hunks)web/src/pages/redirect.vue(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*
📄 CodeRabbit inference engine (.cursor/rules/default.mdc)
Never add comments unless they are needed for clarity of function
Files:
plugin/plugins/dynamix.unraid.net.plgweb/src/pages/redirect.vueplugin/source/dynamix.unraid.net/usr/local/emhttp/redirect.htm
web/**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Always run
pnpm codegenfor GraphQL code generation in the web directory
Files:
web/src/pages/redirect.vue
🧠 Learnings (4)
📚 Learning: 2025-05-08T19:28:54.365Z
Learnt from: elibosley
Repo: unraid/api PR: 1381
File: plugin/source/dynamix.unraid.net/usr/local/share/dynamix.unraid.net/install/scripts/verify_install.sh:19-24
Timestamp: 2025-05-08T19:28:54.365Z
Learning: The directory `/usr/local/emhttp/plugins/dynamix.my.servers` is a valid directory that exists as part of the Unraid API plugin installation and should be included in verification checks.
Applied to files:
plugin/plugins/dynamix.unraid.net.plg
📚 Learning: 2025-09-04T18:42:53.531Z
Learnt from: pujitm
Repo: unraid/api PR: 1658
File: plugin/plugins/dynamix.unraid.net.plg:73-79
Timestamp: 2025-09-04T18:42:53.531Z
Learning: In the dynamix.unraid.net plugin, versions 6.12.1-6.12.14 and 6.12.15 prereleases are intentionally allowed to install with warnings (rather than immediate cleanup) to provide users with a grace period and notice before functionality is completely removed. This is a deliberate UX decision to avoid immediately breaking existing setups while encouraging upgrades.
Applied to files:
plugin/plugins/dynamix.unraid.net.plg
📚 Learning: 2025-09-04T15:26:34.416Z
Learnt from: elibosley
Repo: unraid/api PR: 1657
File: web/scripts/deploy-dev.sh:37-41
Timestamp: 2025-09-04T15:26:34.416Z
Learning: In web/scripts/deploy-dev.sh, the command `rm -rf /usr/local/emhttp/plugins/dynamix.my.servers/unraid-components/*` intentionally removes all contents of the unraid-components directory before deploying standalone components. This broader cleanup is desired behavior according to the maintainer elibosley.
Applied to files:
plugin/plugins/dynamix.unraid.net.plg
📚 Learning: 2025-05-08T19:31:52.417Z
Learnt from: elibosley
Repo: unraid/api PR: 1381
File: plugin/source/dynamix.unraid.net/usr/local/share/dynamix.unraid.net/install/scripts/verify_install.sh:11-16
Timestamp: 2025-05-08T19:31:52.417Z
Learning: The `dynamix.my.servers` namespace is still valid and should not be changed to `dynamix.unraid.net` in file paths, as both namespaces coexist in the codebase.
Applied to files:
plugin/plugins/dynamix.unraid.net.plg
🔇 Additional comments (3)
plugin/plugins/dynamix.unraid.net.plg (1)
209-209: LGTM! Backup/restore coverage for redirect.htm is correct.The new redirect file is properly added to both backup and restore lists, ensuring consistency across install/uninstall operations.
Also applies to: 353-353
web/src/pages/redirect.vue (1)
7-7: Verify if extensive logging is intended for production.Multiple console.log statements have been added throughout the redirect flow. If these are for debugging purposes, consider removing them or gating them behind a debug flag before release.
Based on coding guidelines: "Never add comments unless they are needed for clarity of function."
Also applies to: 14-21, 28-33, 38-39, 43-44, 47-48, 52-53, 62-62
plugin/source/dynamix.unraid.net/usr/local/emhttp/redirect.htm (1)
21-21: Verify if production logging is intentional.Like the Vue version, this static HTML page includes extensive console logging. Confirm whether these logs should remain in production or be removed before release.
Also applies to: 29-29, 39-41, 48-53, 58-59, 63-64, 67-68, 79-79, 84-84
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/src/pages/redirect.vue (1)
51-51: Optional: Cache redirect URL to avoid recomputation.The
getRedirectUrl()function is called twice: once inonMounted(line 38) and once in the template (line 51). While not a performance concern for this simple function, caching the result in a ref would follow Vue best practices.Apply this diff to cache the redirect URL:
<script setup lang="ts"> -import { onMounted } from 'vue'; +import { onMounted, ref } from 'vue'; + +const redirectUrl = ref(''); const parseRedirectTarget = (target: string | null) => { // ... }; const getRedirectUrl = () => { // ... }; onMounted(() => { setTimeout(() => { const textElement = document.getElementById('text'); if (textElement) { textElement.style.display = 'block'; } }, 750); - const redirectUrl = getRedirectUrl(); - console.log('[redirect.vue] redirecting to:', redirectUrl); - window.location.href = redirectUrl; + redirectUrl.value = getRedirectUrl(); + console.log('[redirect.vue] redirecting to:', redirectUrl.value); + window.location.href = redirectUrl.value; }); </script> <template> <div> <div id="text" style="text-align: center; margin-top: calc(100vh - 75%); display: none; font-family: sans-serif" > <h1>Redirecting...</h1> - <h2><a :href="getRedirectUrl()">Click here if you are not redirected automatically</a></h2> + <h2><a :href="redirectUrl">Click here if you are not redirected automatically</a></h2> </div> </div> </template>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
plugin/source/dynamix.unraid.net/usr/local/emhttp/redirect.htm(1 hunks)web/src/pages/redirect.vue(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- plugin/source/dynamix.unraid.net/usr/local/emhttp/redirect.htm
🧰 Additional context used
📓 Path-based instructions (2)
web/**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Always run
pnpm codegenfor GraphQL code generation in the web directory
Files:
web/src/pages/redirect.vue
**/*
📄 CodeRabbit inference engine (.cursor/rules/default.mdc)
Never add comments unless they are needed for clarity of function
Files:
web/src/pages/redirect.vue
🔇 Additional comments (3)
web/src/pages/redirect.vue (3)
14-17: Verify data parameter precedence: query over hash.The code uses
search.get('data') ?? hash.get('data')which prioritizes query parameters over hash parameters. This means if a URL has both?data=fooand#data=bar, the query valuefoois used.Is this precedence intentional? The comment mentions accepting "legacy ?data= input," which suggests hash-based data is the new primary method. Consider whether hash data should take priority when both are present:
- const dataParam = search.get('data') ?? hash.get('data'); + const dataParam = hash.get('data') ?? search.get('data');This would prefer the newer hash-based approach while maintaining backward compatibility.
19-28: Excellent: Hash-based redirect improves privacy.The refactored logic always uses hash fragments (
#data=) for callback data, which prevents the data from being sent in HTTP requests, referrer headers, or server logs. This is a significant privacy improvement while maintaining backward compatibility with legacy query parameters.Note: The past review comment about the fragile
search.size === 1 || search.size === 2check has been fully addressed—this size-based check no longer exists in the code.
30-41: LGTM: Clear redirect flow with debugging support.The onMounted logic computes the redirect URL, logs it for debugging, then performs the redirect. This is a clean separation of concerns that aids troubleshooting.
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
plugin/source/dynamix.unraid.net/usr/local/emhttp/redirect.htm(1 hunks)web/src/pages/redirect.vue(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- plugin/source/dynamix.unraid.net/usr/local/emhttp/redirect.htm
🧰 Additional context used
📓 Path-based instructions (2)
web/**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Always run
pnpm codegenfor GraphQL code generation in the web directory
Files:
web/src/pages/redirect.vue
**/*
📄 CodeRabbit inference engine (.cursor/rules/default.mdc)
Never add comments unless they are needed for clarity of function
Files:
web/src/pages/redirect.vue
🧠 Learnings (1)
📚 Learning: 2024-11-18T20:52:47.800Z
Learnt from: elibosley
Repo: unraid/api PR: 963
File: web/helpers/markdown.ts:1-13
Timestamp: 2024-11-18T20:52:47.800Z
Learning: All configurations and direct usage of `marked` should be centralized in the `safeParseMarkdown` function in `web/helpers/markdown.ts` to maintain security and consistency.
Applied to files:
web/src/pages/redirect.vue
🔇 Additional comments (1)
web/src/pages/redirect.vue (1)
17-39: Runpnpm codegenfor GraphQL code generation in the web directory (repo guideline forweb/**/*).This file doesn't contain GraphQL code, but the procedural guideline requires running codegen for any changes in the web directory to ensure consistency.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
web/__test__/composables/dateTime.test.ts (2)
32-34: Simplify the type handling.Since
outputDateTimeFormattedis a computed ref (as seen in line 222 of the composable), you can simplify this by directly accessing.value:- const output = (wrapper.vm as unknown as { outputDateTimeFormatted: string | { value: string } }) - .outputDateTimeFormatted; - return typeof output === 'string' ? output : output.value; + const { outputDateTimeFormatted } = wrapper.vm as unknown as { outputDateTimeFormatted: { value: string } }; + return outputDateTimeFormatted.value;
37-57: Consider adding tests for valid server formats.The current tests provide good coverage of fallback scenarios. Consider adding tests for the happy path where valid server formats are provided (e.g.,
{ date: '%c', time: '%I:%M %p' }) to ensure the composable correctly uses server-provided formats when available.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
web/__test__/composables/dateTime.test.ts(1 hunks)web/package.json(1 hunks)web/src/composables/dateTime.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx}: Always use TypeScript imports with.jsextensions for ESM compatibility
Never add comments unless they are needed for clarity of function
Never add comments for obvious things, and avoid commenting when starting and ending code blocks
Files:
web/__test__/composables/dateTime.test.tsweb/src/composables/dateTime.ts
**/*.test.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.test.{ts,tsx,js,jsx}: Use VITEST for test suite, not jest
Use.rejects.toThrow()without arguments to test that functions throw errors, not exact error message strings
Files:
web/__test__/composables/dateTime.test.ts
web/**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Always run
pnpm codegenfor GraphQL code generation in the web directory
Files:
web/__test__/composables/dateTime.test.tsweb/package.jsonweb/src/composables/dateTime.ts
web/__test__/**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
web/__test__/**/*.test.{ts,tsx}: Test component behavior and output, not implementation details
Usemountfrom Vue Test Utils for component testing
Stub complex child components that aren't the focus of the test
Find elements with semantic queries likefind('button')rather than data-test IDs
UsecreatePinia()andsetActivePiniawhen testing Store files, only usecreateTestingPiniaif you specifically need its testing features
Files:
web/__test__/composables/dateTime.test.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Never use theanytype. Always prefer proper typing
Avoid using casting whenever possible, prefer proper typing from the start
Files:
web/__test__/composables/dateTime.test.tsweb/src/composables/dateTime.ts
**/*
📄 CodeRabbit inference engine (.cursor/rules/default.mdc)
Never add comments unless they are needed for clarity of function
Files:
web/__test__/composables/dateTime.test.tsweb/package.jsonweb/src/composables/dateTime.ts
**/*.test.ts
📄 CodeRabbit inference engine (.cursor/rules/web-testing-rules.mdc)
**/*.test.ts: Use.rejects.toThrow()without arguments to test that functions throw errors. Don't test exact error message strings unless the message format is specifically what you're testing
Test what the code does, not implementation details like exact error message wording
Mock external services and API calls
Usevi.mock()for module-level mocks
Specify return values for component methods withvi.spyOn()
Reset mocks between tests withvi.clearAllMocks()
Always await async operations before making assertions
Files:
web/__test__/composables/dateTime.test.ts
web/src/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Ensure Vue reactivity imports are added to store files (computed, ref, watchEffect)
Files:
web/src/composables/dateTime.ts
🧠 Learnings (16)
📓 Common learnings
Learnt from: mdatelle
Repo: unraid/api PR: 1106
File: unraid-ui/src/components/index.ts:2-2
Timestamp: 2025-02-04T17:21:39.710Z
Learning: The unraid-ui package is undergoing a major refactoring process, and breaking changes are expected during this transition period.
📚 Learning: 2025-11-24T17:51:37.915Z
Learnt from: CR
Repo: unraid/api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T17:51:37.915Z
Learning: Applies to web/__test__/**/*.test.{ts,tsx} : Use `mount` from Vue Test Utils for component testing
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Use `mount` from Vue Test Utils for component testing
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:51:37.915Z
Learnt from: CR
Repo: unraid/api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T17:51:37.915Z
Learning: Applies to web/__test__/**/*.test.{ts,tsx} : Test component behavior and output, not implementation details
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Mock external dependencies and services in Vue component tests
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Test component behavior and output, not implementation details
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Check for expected prop handling and event emissions in Vue components
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Verify that the expected elements are rendered in Vue components
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Use `await nextTick()` for DOM updates in Vue component tests
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:51:37.915Z
Learnt from: CR
Repo: unraid/api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T17:51:37.915Z
Learning: Applies to web/__test__/**/*.test.{ts,tsx} : Stub complex child components that aren't the focus of the test
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Test component interactions such as clicks and inputs
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: This is a Nuxt.js app but tests are run with vitest outside of the Nuxt environment
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-02-04T17:21:39.710Z
Learnt from: mdatelle
Repo: unraid/api PR: 1106
File: unraid-ui/src/components/index.ts:2-2
Timestamp: 2025-02-04T17:21:39.710Z
Learning: The unraid-ui package is undergoing a major refactoring process, and breaking changes are expected during this transition period.
Applied to files:
web/package.json
📚 Learning: 2025-04-02T21:21:29.168Z
Learnt from: elibosley
Repo: unraid/api PR: 1308
File: unraid-ui/src/components/common/loading/Error.vue:2-2
Timestamp: 2025-04-02T21:21:29.168Z
Learning: Components in the unraid-ui folder require explicit imports and are not autoloaded, unlike other parts of the project that may use Nuxt.js autoloading features.
Applied to files:
web/package.json
📚 Learning: 2025-03-13T16:17:21.897Z
Learnt from: elibosley
Repo: unraid/api PR: 1211
File: unraid-ui/src/components/form/number/NumberFieldInput.vue:1-21
Timestamp: 2025-03-13T16:17:21.897Z
Learning: The unraid-ui is a UI library being published externally, where wrapping third-party components (like those from reka-ui) is an intentional design choice to maintain a consistent interface, standardize styling, and control the exposed API.
Applied to files:
web/package.json
📚 Learning: 2025-03-14T19:18:23.324Z
Learnt from: pujitm
Repo: unraid/api PR: 1211
File: unraid-ui/package.json:43-43
Timestamp: 2025-03-14T19:18:23.324Z
Learning: The internationalized/number package is a dependency of reka-ui, which is used for number formatting in the Unraid UI components.
Applied to files:
web/package.json
🧬 Code graph analysis (2)
web/__test__/composables/dateTime.test.ts (2)
web/types/server.ts (1)
ServerDateTimeFormat(53-56)web/__test__/utils/i18n.ts (1)
testTranslate(100-104)
web/src/composables/dateTime.ts (1)
web/types/server.ts (2)
DateFormatOption(43-46)TimeFormatOption(48-51)
🔇 Additional comments (3)
web/src/composables/dateTime.ts (2)
104-110: LGTM! Improved fallback handling.The addition of explicit constants and defensive trimming improves code clarity and resilience when server-provided formats are missing or invalid.
112-121: LGTM! Independent fallbacks for date and time.The refactored logic correctly handles missing or invalid date/time formats independently, with appropriate fallbacks for each. This makes the formatting more resilient to incomplete server configuration.
web/package.json (1)
112-112: Verify that @unraid/shared-callbacks v3.0.0 is compatible with current usages.This is a major internal version update (1.1.1 → 3.0.0) within the monorepo. The package is used extensively throughout the codebase with imports of
useCallback,ExternalSignIn,ExternalSignOut,ExternalKeyActions,ExternalUpdateOsAction, and several other types across store modules and components. Verify that all type definitions and theuseCallbackfunction API remain compatible with the v3.0.0 version, particularly since unraid-ui is undergoing significant refactoring during this update cycle.
…on and pnpm-lock.yaml
- Introduced a new HTML redirect page to handle user redirection. - Enhanced the existing Vue component to support similar redirect logic. - Implemented logging for debugging redirect behavior and parameters. - Ensured compatibility with query and hash parameters for dynamic redirection.
- Included the new redirect.htm file in the backup and restore process to ensure it is preserved during updates.
- Updated the redirect logic in both HTML and Vue components to preserve the data parameter without checking for specific search sizes. - Improved code clarity by removing unnecessary conditions related to search size.
- Removed unnecessary console logs in both HTML and Vue components to enhance code readability. - Updated logging messages to provide clearer context during the redirect process. - Simplified the handling of data parameters in the redirect logic.
- Streamlined the redirect logic in both HTML and Vue components to consistently use hash-based callback data for privacy. - Removed legacy query parameter handling, simplifying the code and enhancing clarity.
- Updated the redirect logic in both HTML and Vue components to ensure consistent parsing of target URLs, maintaining a focus on security by avoiding arbitrary redirects. - Improved handling of hash-based data payloads, preserving existing data while simplifying the fallback to legacy query parameters. - Enhanced code clarity and maintainability through streamlined logic and error handling.
- Changed the PURCHASE_CALLBACK URL to use the ACCOUNT base instead of UNRAID_NET, enhancing consistency in URL handling across the application. - This update aligns with recent improvements in redirect logic and data parameter handling.
- Introduced a new test suite for the useDateTimeHelper composable to validate date formatting behavior. - Added tests to ensure fallback to default date and time formats when server formats are empty or unknown. - Enhanced test coverage for date formatting logic using the dayjs library.
…on and pnpm-lock.yaml - Bumped the version of @unraid/shared-callbacks from 2.0.3 to 3.0.0 in both package.json and pnpm-lock.yaml to ensure compatibility with recent updates. - Updated the integrity hash in pnpm-lock.yaml to reflect the new version.
fa7e6ae to
3f1b682
Compare
pujitm
left a comment
There was a problem hiding this comment.
added 👀 to the coderabbit comment that i think is worth looking at.
|
lgtm otherwise! |
- Deleted several Vue component files including apikeys.vue, changelog.vue, flashbackup.vue, index.vue, login.vue, redirect.vue, welcome.vue, and test-update-modal.vue to improve code maintainability and reduce clutter. - This cleanup helps focus on active components and enhances overall project organization.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/__test__/composables/dateTime.test.ts (1)
52-57: Consider clarifying the test description.The test description mentions "default time format", but the expected output
'ddd, D MMMM YYYY hh:mma'includes both date components (ddd, D MMMM YYYY) and time components (hh:mma). Consider renaming to "default date-time format" or "default format with time" for clarity.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (16)
plugin/plugins/dynamix.unraid.net.plg(2 hunks)plugin/source/dynamix.unraid.net/usr/local/emhttp/redirect.htm(1 hunks)web/__test__/composables/dateTime.test.ts(1 hunks)web/package.json(1 hunks)web/src/composables/dateTime.ts(1 hunks)web/src/helpers/urls.ts(1 hunks)web/src/pages/apikeys.vue(0 hunks)web/src/pages/changelog.vue(0 hunks)web/src/pages/flashbackup.vue(0 hunks)web/src/pages/index.vue(0 hunks)web/src/pages/login.query.ts(0 hunks)web/src/pages/login.vue(0 hunks)web/src/pages/redirect.vue(0 hunks)web/src/pages/tools/apikeyauthorize.vue(0 hunks)web/src/pages/tools/test-update-modal.vue(0 hunks)web/src/pages/welcome.vue(0 hunks)
💤 Files with no reviewable changes (10)
- web/src/pages/redirect.vue
- web/src/pages/tools/test-update-modal.vue
- web/src/pages/welcome.vue
- web/src/pages/index.vue
- web/src/pages/login.vue
- web/src/pages/tools/apikeyauthorize.vue
- web/src/pages/flashbackup.vue
- web/src/pages/changelog.vue
- web/src/pages/login.query.ts
- web/src/pages/apikeys.vue
🚧 Files skipped from review as they are similar to previous changes (3)
- web/package.json
- web/src/composables/dateTime.ts
- plugin/plugins/dynamix.unraid.net.plg
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx}: Always use TypeScript imports with.jsextensions for ESM compatibility
Never add comments unless they are needed for clarity of function
Never add comments for obvious things, and avoid commenting when starting and ending code blocks
Files:
web/__test__/composables/dateTime.test.tsweb/src/helpers/urls.ts
**/*.test.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.test.{ts,tsx,js,jsx}: Use VITEST for test suite, not jest
Use.rejects.toThrow()without arguments to test that functions throw errors, not exact error message strings
Files:
web/__test__/composables/dateTime.test.ts
web/**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Always run
pnpm codegenfor GraphQL code generation in the web directory
Files:
web/__test__/composables/dateTime.test.tsweb/src/helpers/urls.ts
web/__test__/**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
web/__test__/**/*.test.{ts,tsx}: Test component behavior and output, not implementation details
Usemountfrom Vue Test Utils for component testing
Stub complex child components that aren't the focus of the test
Find elements with semantic queries likefind('button')rather than data-test IDs
UsecreatePinia()andsetActivePiniawhen testing Store files, only usecreateTestingPiniaif you specifically need its testing features
Files:
web/__test__/composables/dateTime.test.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Never use theanytype. Always prefer proper typing
Avoid using casting whenever possible, prefer proper typing from the start
Files:
web/__test__/composables/dateTime.test.tsweb/src/helpers/urls.ts
**/*
📄 CodeRabbit inference engine (.cursor/rules/default.mdc)
Never add comments unless they are needed for clarity of function
Files:
web/__test__/composables/dateTime.test.tsplugin/source/dynamix.unraid.net/usr/local/emhttp/redirect.htmweb/src/helpers/urls.ts
**/*.test.ts
📄 CodeRabbit inference engine (.cursor/rules/web-testing-rules.mdc)
**/*.test.ts: Use.rejects.toThrow()without arguments to test that functions throw errors. Don't test exact error message strings unless the message format is specifically what you're testing
Test what the code does, not implementation details like exact error message wording
Mock external services and API calls
Usevi.mock()for module-level mocks
Specify return values for component methods withvi.spyOn()
Reset mocks between tests withvi.clearAllMocks()
Always await async operations before making assertions
Files:
web/__test__/composables/dateTime.test.ts
web/src/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Ensure Vue reactivity imports are added to store files (computed, ref, watchEffect)
Files:
web/src/helpers/urls.ts
🧠 Learnings (11)
📚 Learning: 2025-11-24T17:51:37.915Z
Learnt from: CR
Repo: unraid/api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T17:51:37.915Z
Learning: Applies to web/__test__/**/*.test.{ts,tsx} : Use `mount` from Vue Test Utils for component testing
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Use `mount` from Vue Test Utils for component testing
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:51:37.915Z
Learnt from: CR
Repo: unraid/api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T17:51:37.915Z
Learning: Applies to web/__test__/**/*.test.{ts,tsx} : Test component behavior and output, not implementation details
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Test component behavior and output, not implementation details
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Mock external dependencies and services in Vue component tests
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Check for expected prop handling and event emissions in Vue components
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Verify that the expected elements are rendered in Vue components
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Use `await nextTick()` for DOM updates in Vue component tests
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:51:37.915Z
Learnt from: CR
Repo: unraid/api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T17:51:37.915Z
Learning: Applies to web/__test__/**/*.test.{ts,tsx} : Stub complex child components that aren't the focus of the test
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Test component interactions such as clicks and inputs
Applied to files:
web/__test__/composables/dateTime.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: This is a Nuxt.js app but tests are run with vitest outside of the Nuxt environment
Applied to files:
web/__test__/composables/dateTime.test.ts
🧬 Code graph analysis (1)
web/__test__/composables/dateTime.test.ts (2)
web/types/server.ts (1)
ServerDateTimeFormat(53-56)web/__test__/utils/i18n.ts (1)
testTranslate(100-104)
🔇 Additional comments (4)
web/__test__/composables/dateTime.test.ts (1)
1-35: Well-structured composable test helper.The approach of mounting a minimal component to test the composable is appropriate. The type casting on lines 32-34 is handled defensively with both a safe cast pattern (via
unknown) and runtime type checking, which properly addresses Vue's component instance typing limitations.web/src/helpers/urls.ts (1)
19-19: No issues found. The change appropriately updates the callback origin fromUNRAID_NETtoACCOUNTas part of the @unraid/shared-callbacks v3.0.0 upgrade, consistent with theACCOUNT_CALLBACKpattern already used at line 12. The defaultACCOUNTvalue is a bare domain without path components, so relative path behavior is not a concern.plugin/source/dynamix.unraid.net/usr/local/emhttp/redirect.htm (2)
18-31: Redirect target parsing and origin hardening look good.
parseRedirectTargetkeeps redirects on the same origin, strips query/hash viaURL, and falls back safely to/Mainon malformed or missing targets. No issues with correctness or redirect safety based on this file.
68-86: Redirect flow and DOM readiness handling look solid.The redirect flow (compute URL, update the fallback link, then navigate) plus the
DOMContentLoaded/readyStatecheck is straightforward and robust across different load timings.
- Updated the encoding method for query data in the redirect logic from encodeURI to encodeURIComponent to ensure proper handling of special characters. - This change enhances the reliability of data passed through URLs, maintaining consistency in the application's redirect behavior.
- Refactored server data payloads to streamline the structure and enhance type safety by integrating types from @unraid/shared-callbacks. - Removed deprecated fields and adjusted the serverPurchasePayload and serverAccountPayload to align with the new data model. - Updated tests to reflect changes in the server data structure, ensuring accurate validation of server state and actions.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
web/__test__/components/KeyActions.test.ts (1)
37-37: Consider using typed action names for better compile-time safety.The test data now uses plain string literals (
'purchase','redeem','upgrade') for thenamefield. SinceServerStateDataActionrequiresname: ServerActionTypes, consider using typed constants or at least type assertions to catch invalid action names at compile time.As per coding guidelines, proper typing is preferred over
anytype, and the same principle applies here—typed values are preferred over plain strings when types are available.Also applies to: 71-71, 90-90, 112-114, 136-138, 159-159, 179-179
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
web/__test__/components/KeyActions.test.ts(8 hunks)web/__test__/store/server.test.ts(2 hunks)web/src/store/server.ts(3 hunks)web/types/server.ts(3 hunks)web/types/userProfile.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (11)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx}: Always use TypeScript imports with.jsextensions for ESM compatibility
Never add comments unless they are needed for clarity of function
Never add comments for obvious things, and avoid commenting when starting and ending code blocks
Files:
web/__test__/store/server.test.tsweb/__test__/components/KeyActions.test.tsweb/types/server.tsweb/src/store/server.tsweb/types/userProfile.ts
**/*.test.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.test.{ts,tsx,js,jsx}: Use VITEST for test suite, not jest
Use.rejects.toThrow()without arguments to test that functions throw errors, not exact error message strings
Files:
web/__test__/store/server.test.tsweb/__test__/components/KeyActions.test.ts
web/**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Always run
pnpm codegenfor GraphQL code generation in the web directory
Files:
web/__test__/store/server.test.tsweb/__test__/components/KeyActions.test.tsweb/types/server.tsweb/src/store/server.tsweb/types/userProfile.ts
web/__test__/**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
web/__test__/**/*.test.{ts,tsx}: Test component behavior and output, not implementation details
Usemountfrom Vue Test Utils for component testing
Stub complex child components that aren't the focus of the test
Find elements with semantic queries likefind('button')rather than data-test IDs
UsecreatePinia()andsetActivePiniawhen testing Store files, only usecreateTestingPiniaif you specifically need its testing features
Files:
web/__test__/store/server.test.tsweb/__test__/components/KeyActions.test.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Never use theanytype. Always prefer proper typing
Avoid using casting whenever possible, prefer proper typing from the start
Files:
web/__test__/store/server.test.tsweb/__test__/components/KeyActions.test.tsweb/types/server.tsweb/src/store/server.tsweb/types/userProfile.ts
**/*
📄 CodeRabbit inference engine (.cursor/rules/default.mdc)
Never add comments unless they are needed for clarity of function
Files:
web/__test__/store/server.test.tsweb/__test__/components/KeyActions.test.tsweb/types/server.tsweb/src/store/server.tsweb/types/userProfile.ts
**/*.test.ts
📄 CodeRabbit inference engine (.cursor/rules/web-testing-rules.mdc)
**/*.test.ts: Use.rejects.toThrow()without arguments to test that functions throw errors. Don't test exact error message strings unless the message format is specifically what you're testing
Test what the code does, not implementation details like exact error message wording
Mock external services and API calls
Usevi.mock()for module-level mocks
Specify return values for component methods withvi.spyOn()
Reset mocks between tests withvi.clearAllMocks()
Always await async operations before making assertions
Files:
web/__test__/store/server.test.tsweb/__test__/components/KeyActions.test.ts
**/__test__/store/**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/web-testing-rules.mdc)
**/__test__/store/**/*.ts: UsecreatePiniaandsetActivePiniawhen testing Pinia store files
UsecreatePinia()instead ofcreateTestingPinia()for most Pinia store tests
Only usecreateTestingPiniaif you specifically need its testing features for Pinia stores
Let stores initialize with their natural default state instead of forcing initial state
Do not mock the store being tested in the test file when usingcreatePinia()
Place all mock declarations at the top level in Pinia store tests
Use factory functions for module mocks in Pinia store tests to avoid hoisting issues
Test Pinia action side effects and state changes
Verify Pinia actions are called with correct parameters
Mock external dependencies appropriately in Pinia store tests
Test computed properties in Pinia stores by accessing them directly
Verify state changes after Pinia store actions
Test Pinia store getter dependencies are properly mocked
Test Pinia store interactions with other stores
Verify proper error handling in Pinia store tests
Test async operations completely in Pinia store tests
Override specific Pinia action implementations when needed in tests
Set initial state for focused Pinia store testing
Files:
web/__test__/store/server.test.ts
**/store/**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/web-testing-rules.mdc)
Ensure Vue reactivity imports like
computed,ref, andwatchEffectare added to store files even with Nuxt auto-imports enabled
Files:
web/__test__/store/server.test.tsweb/src/store/server.ts
**/__test__/components/**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/web-testing-rules.mdc)
**/__test__/components/**/*.ts: Usemountfrom Vue Test Utils for component testing
Stub complex child components that aren't the focus of the test
Mock external dependencies and services in Vue component tests
Test component behavior and output, not implementation details
Verify that the expected elements are rendered in Vue components
Test component interactions such as clicks and inputs
Check for expected prop handling and event emissions in Vue components
UsecreateTestingPinia()for mocking stores in Vue components
Use semantic queries likefind('button')orfind('[data-test="id"]')but prefer not to use data test ID's when finding elements
Find Vue components withfindComponent(ComponentName)
UsefindAllto check for multiple elements in Vue components
Assert on rendered text content withwrapper.text()
Assert on element attributes withelement.attributes()
Verify element existence withexpect(element.exists()).toBe(true)
Check component state through rendered output
Trigger events withawait element.trigger('click')
Set input values withawait input.setValue('value')
Test emitted events withwrapper.emitted()
Useawait nextTick()for DOM updates in Vue component tests
UseflushPromises()for complex promise chains in Vue component tests
Files:
web/__test__/components/KeyActions.test.ts
web/src/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Ensure Vue reactivity imports are added to store files (computed, ref, watchEffect)
Files:
web/src/store/server.ts
🧠 Learnings (31)
📚 Learning: 2025-01-27T14:57:46.617Z
Learnt from: elibosley
Repo: unraid/api PR: 1063
File: web/_data/serverState.ts:137-147
Timestamp: 2025-01-27T14:57:46.617Z
Learning: The values in `web/_data/serverState.ts` are used for testing purposes and should remain as hardcoded mock data to facilitate testing different scenarios.
Applied to files:
web/__test__/store/server.test.tsweb/__test__/components/KeyActions.test.tsweb/types/server.tsweb/src/store/server.ts
📚 Learning: 2025-11-24T17:52:26.908Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.908Z
Learning: Applies to **/__test__/store/**/*.ts : Mock external dependencies appropriately in Pinia store tests
Applied to files:
web/__test__/store/server.test.ts
📚 Learning: 2025-11-24T17:52:26.908Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.908Z
Learning: Applies to **/__test__/store/**/*.ts : Test Pinia action side effects and state changes
Applied to files:
web/__test__/store/server.test.tsweb/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.908Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.908Z
Learning: Applies to **/__test__/store/**/*.ts : Test Pinia store interactions with other stores
Applied to files:
web/__test__/store/server.test.ts
📚 Learning: 2025-11-24T17:52:26.908Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.908Z
Learning: Applies to **/__test__/store/**/*.ts : Test Pinia store getter dependencies are properly mocked
Applied to files:
web/__test__/store/server.test.ts
📚 Learning: 2025-11-24T17:52:26.908Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.908Z
Learning: Applies to **/__test__/store/**/*.ts : Verify proper error handling in Pinia store tests
Applied to files:
web/__test__/store/server.test.ts
📚 Learning: 2025-11-24T17:52:26.908Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.908Z
Learning: Applies to **/__test__/store/**/*.ts : Verify state changes after Pinia store actions
Applied to files:
web/__test__/store/server.test.tsweb/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.908Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.908Z
Learning: Applies to **/__test__/store/**/*.ts : Test async operations completely in Pinia store tests
Applied to files:
web/__test__/store/server.test.ts
📚 Learning: 2025-11-24T17:52:26.908Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.908Z
Learning: Applies to **/__test__/store/**/*.ts : Use `createPinia()` instead of `createTestingPinia()` for most Pinia store tests
Applied to files:
web/__test__/store/server.test.tsweb/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:51:37.915Z
Learnt from: CR
Repo: unraid/api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T17:51:37.915Z
Learning: Applies to web/__test__/**/*.test.{ts,tsx} : Use `createPinia()` and `setActivePinia` when testing Store files, only use `createTestingPinia` if you specifically need its testing features
Applied to files:
web/__test__/store/server.test.tsweb/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:51:37.915Z
Learnt from: CR
Repo: unraid/api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T17:51:37.915Z
Learning: Applies to web/__test__/**/*.test.{ts,tsx} : Test component behavior and output, not implementation details
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Test component behavior and output, not implementation details
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.908Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.908Z
Learning: Applies to **/__test__/store/**/*.ts : Override specific Pinia action implementations when needed in tests
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Test component interactions such as clicks and inputs
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.908Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.908Z
Learning: Applies to **/__test__/store/**/*.ts : Verify Pinia actions are called with correct parameters
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Check component state through rendered output
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Use `createTestingPinia()` for mocking stores in Vue components
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.908Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.908Z
Learning: Applies to **/__test__/store/**/*.ts : Use `createPinia` and `setActivePinia` when testing Pinia store files
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.908Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.908Z
Learning: Applies to **/__test__/store/**/*.ts : Set initial state for focused Pinia store testing
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.908Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.908Z
Learning: Applies to **/__test__/store/**/*.ts : Only use `createTestingPinia` if you specifically need its testing features for Pinia stores
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Assert on rendered text content with `wrapper.text()`
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Verify that the expected elements are rendered in Vue components
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Check for expected prop handling and event emissions in Vue components
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Test emitted events with `wrapper.emitted()`
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Trigger events with `await element.trigger('click')`
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Verify element existence with `expect(element.exists()).toBe(true)`
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-11-24T17:52:26.907Z
Learnt from: CR
Repo: unraid/api PR: 0
File: .cursor/rules/web-testing-rules.mdc:0-0
Timestamp: 2025-11-24T17:52:26.907Z
Learning: Applies to **/__test__/components/**/*.ts : Assert on element attributes with `element.attributes()`
Applied to files:
web/__test__/components/KeyActions.test.ts
📚 Learning: 2025-02-24T14:51:21.328Z
Learnt from: elibosley
Repo: unraid/api PR: 1181
File: web/store/theme.ts:0-0
Timestamp: 2025-02-24T14:51:21.328Z
Learning: In the Unraid API project's theme system, exact TypeScript type definitions are preferred over index signatures for theme variables to ensure better type safety.
Applied to files:
web/types/server.ts
📚 Learning: 2025-09-02T19:35:14.427Z
Learnt from: elibosley
Repo: unraid/api PR: 1639
File: web/components/standalone-mount.ts:38-54
Timestamp: 2025-09-02T19:35:14.427Z
Learning: In the unraid/api project, exposing Apollo client and GraphQL utilities (apolloClient, gql, graphqlParse) on the global window object is intentional to allow developers to interact with GraphQL from the browser console without needing to be inside Vue components. Developer experience is prioritized over minimizing global exposure in this context.
Applied to files:
web/src/store/server.ts
📚 Learning: 2025-03-12T13:48:14.850Z
Learnt from: pujitm
Repo: unraid/api PR: 1211
File: web/composables/gql/gql.ts:17-18
Timestamp: 2025-03-12T13:48:14.850Z
Learning: In the Unraid API project, the duplicate GraphQL query and mutation strings in gql.ts files are intentionally generated by GraphQL CodeGen tool and are necessary for the type system to function properly.
Applied to files:
web/src/store/server.ts
📚 Learning: 2024-12-11T17:20:09.604Z
Learnt from: pujitm
Repo: unraid/api PR: 978
File: web/helpers/apollo-cache/index.ts:133-157
Timestamp: 2024-12-11T17:20:09.604Z
Learning: In `web/helpers/apollo-cache/index.ts`, when updating the cache in the `cache.updateQuery` function, it's sufficient to check if `data` is present, as type checking inside `data` is handled at the GraphQL layer.
Applied to files:
web/src/store/server.ts
🔇 Additional comments (6)
web/types/userProfile.ts (1)
11-11: LGTM! Excellent type safety improvement.The generic parameter allows consumers to constrain the
namefield to specific string literal union types, as demonstrated inServerStateDataActionwhich usesUserProfileLink<ServerActionTypes>.Also applies to: 19-19
web/__test__/store/server.test.ts (1)
162-183: LGTM! Test coverage properly reflects the consolidated ServerData payload.The tests now validate the new unified payload structure including registration fields (
regGen,regGuid,regExp,regUpdatesExpired) and the renamedwanFQDNfield. The removal of fields likeapiVersion,connectPluginVersion, andsitefrom the payloads is properly reflected.Also applies to: 184-206, 556-598, 600-645
web/types/server.ts (2)
1-1: LGTM! Excellent type consolidation using shared library.The import of
ServerActionTypesfrom@unraid/shared-callbacksand its use inServerStateDataActionvia the genericUserProfileLink<ServerActionTypes>centralizes action type management and improves type safety across the codebase.Also applies to: 129-131
33-33: Add an explicit case for the 'STALE' state or document its intentional fallthrough to default.The
STALEstate is added to theServerStateunion but lacks an explicit case in thestateDatacomputed property—it falls through to the default case, which displays a generic error state. Clarify whether this is intentional or ifSTALErequires specific handling with its own message and actions.web/src/store/server.ts (2)
224-246: LGTM! Payload consolidation aligns with the ServerData type.Both
serverPurchasePayloadandserverAccountPayloadnow return the unifiedServerDatatype from@unraid/shared-callbacks. The removal of fields likeapiVersion,inIframe,caseModel,connectPluginVersion, andsite, along with the addition of registration-related fields (regGen,regGuid,regExp,regUpdatesExpired) andwanFQDN, properly reflects the consolidated payload structure.Also applies to: 248-270
1275-1286: LGTM! Type-safe action filtering implementation.The
filteredKeyActionsfunction properly usesServerActionTypes[]for the filters parameter, and the.includes()comparison at line 1284 works correctly sinceaction.nameis constrained toServerActionTypes(defined inweb/types/server.tsline 130).
|
This plugin has been deployed to Cloudflare R2 and is available for testing. |
🤖 I have created a release *beep* *boop* --- ## [4.28.0](v4.27.2...v4.28.0) (2025-12-15) ### Features * when cancelling OS upgrade, delete any plugin files that were d… ([#1823](#1823)) ([74df938](74df938)) ### Bug Fixes * change keyfile watcher to poll instead of inotify on FAT32 ([#1820](#1820)) ([23a7120](23a7120)) * enhance dark mode support in theme handling ([#1808](#1808)) ([d6e2939](d6e2939)) * improve API startup reliability with timeout budget tracking ([#1824](#1824)) ([51f025b](51f025b)) * PHP Warnings in Management Settings ([#1805](#1805)) ([832e9d0](832e9d0)) * update @unraid/shared-callbacks to version 3.0.0 ([#1831](#1831)) ([73b2ce3](73b2ce3)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…on and pnpm-lock.yaml
Summary by CodeRabbit
New Features
Improvements
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.