Skip to content

Conversation

@elibosley
Copy link
Member

@elibosley elibosley commented Mar 14, 2025

Summary by CodeRabbit

  • Chores
    • Updated the way style resources are referenced across the application to ensure consistent loading of visual assets.
  • Style
    • Enhanced configuration formatting for module declarations, improving clarity and maintainability.

These changes streamline how styles are resolved and improve internal organization without altering the overall functionality seen by end-users.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 14, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request updates the CSS import paths in various Vue components and pages from a relative path to an absolute path using the tilde alias (~/assets/main.css). Additionally, the nuxt.config.ts file is reformatted to improve readability by listing each module on a separate line. No changes to functionality, logic, or exported entities were made.

Changes

Files Change Summary
web/components/{Auth.ce.vue, CallbackHandler.ce.vue, ColorSwitcher.ce.vue, DevSettings.vue, DowngradeOs.ce.vue, DownloadApiLogs.ce.vue, DummyServerSwitcher.vue, Modals.ce.vue, Registration.ce.vue, SsoButton.ce.vue, UpdateOs.ce.vue, WanIpCheck.ce.vue, WelcomeModal.ce.vue, UserProfile.ce.vue} Updated CSS import path in <style> sections from relative paths to absolute using tilde alias ('~/assets/main.css').
web/components/UpdateOs/{Downgrade.vue, Update.vue, UpdateIneligible.vue} Changed CSS import from relative paths (e.g., ../../assets/main.css) to the absolute tilde path.
web/components/UserProfile/{CallbackFeedback.vue, DropdownLaunchpad.vue, Promo.vue} Modified CSS import statements from relative paths to absolute ('~/assets/main.css').
web/nuxt.config.ts Reformatted the modules array from a single-line declaration to a multi-line layout for better readability.
web/pages/index.vue Updated the CSS import path from a relative path ('../assets/main.css') to an absolute path ('~/assets/main.css').

Suggested reviewers

  • zackspear
  • mdatelle
  • pujitm

Poem

In our code a tilde now gleams bright,
Turning paths from murky to light.
No logic changed, just cleaner view,
🖥️ A refresh for styles—all crisp and new!
With each update, our code sings true.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 0f38482 and 8282455.

📒 Files selected for processing (1)
  • web/nuxt.config.ts (2 hunks)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (22)
web/components/DowngradeOs.ce.vue (1)

77-77: Absolute Import Path Update: Validate Alias Setup

The change from a relative path to an absolute path using ~/assets/main.css helps standardize CSS imports across components. Please confirm that the bundler's alias configuration (in your Nuxt/Vite setup) properly resolves the tilde (~) so that this change does not lead to path resolution issues during build time.

web/components/Registration.ce.vue (1)

327-327: CSS Import Path Update:
Changing the CSS import from a relative path to an absolute one ('~/assets/main.css') is a good move for consistency and potentially faster resolution during builds. Please confirm that the build configuration (e.g., Nuxt/Vite aliases) supports the ~ alias across all environments.

web/components/UpdateOs/Update.vue (1)

268-271: Switch to Absolute CSS Import Path

Changing from a relative CSS import to using the ~ alias improves maintainability and aligns with the overall effort to standardize resource paths. Please confirm that your bundler (e.g., Nuxt, Vite) is configured to resolve the ~ alias properly, so that the path ~/assets/main.css correctly maps to your assets folder.

web/components/WelcomeModal.ce.vue (1)

116-116: Absolute CSS Import Path Updated

Switching the CSS import from a relative path to an absolute path helps standardize style references across components, improving consistency and maintainability. Please verify that your build configuration (e.g., Vite or Nuxt alias settings) correctly interprets the ~ alias.

api/src/unraid-api/graph/resolvers/logs/logs.resolver.spec.ts (1)

26-29: Additional tests needed beyond basic definition check

The test file only includes a basic test to verify that the resolver is defined.

Consider adding specific tests for each resolver method to ensure comprehensive test coverage. For example:

it('should return log files', async () => {
  const mockLogFiles = [{ name: 'test.log', path: '/var/log/test.log', size: 1024 }];
  jest.spyOn(service, 'getLogFiles').mockResolvedValue(mockLogFiles);
  
  const result = await resolver.logFiles();
  expect(result).toEqual(mockLogFiles);
});

it('should return log content', async () => {
  const mockContent = 'test log content';
  jest.spyOn(service, 'getLogContent').mockResolvedValue(mockContent);
  
  const result = await resolver.logContent('test.log', 100);
  expect(result).toEqual(mockContent);
});
web/components/Logs/LogViewer.ce.vue (4)

37-42: Consider adding error handling and loading states for the GraphQL query

While the component does display error messages in the UI, it might benefit from more robust error handling.

Consider adding error handling with retry logic for the GraphQL query:

-const { result: logFilesResult, loading: loadingLogFiles, error: logFilesError } = useQuery(GET_LOG_FILES);
+const { result: logFilesResult, loading: loadingLogFiles, error: logFilesError, refetch } = useQuery(GET_LOG_FILES, {
+  notifyOnNetworkStatusChange: true,
+});
+
+// Add retry function
+const retryFetch = () => {
+  return refetch();
+};

Then add a retry button in the error state UI section:

<div v-else-if="logFilesError" class="flex items-center justify-center h-full p-4 text-center text-destructive">
-  Error loading log files: {{ logFilesError.message }}
+  <div class="flex flex-col items-center">
+    <p>Error loading log files: {{ logFilesError.message }}</p>
+    <button @click="retryFetch" class="mt-2 px-4 py-2 bg-primary text-primary-foreground rounded">Retry</button>
+  </div>
</div>

45-53: File size formatter has limited range

The formatFileSize function only supports up to GB, which may not be sufficient for very large log files.

Consider extending the file size formatter to support TB:

-const sizes = ['Bytes', 'KB', 'MB', 'GB'];
+const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];

55-80: Good language detection implementation, but consider making it more maintainable

The autoDetectLanguage function has a lot of hardcoded file extensions and patterns. This could become harder to maintain as new log types are added.

Consider refactoring to use a more maintainable mapping object:

const fileExtensionToLanguage = {
  '.sh': 'bash',
  '.bash': 'bash',
  '.conf': 'ini',
  '.ini': 'ini',
  '.cfg': 'ini',
  '.xml': 'xml',
  '.html': 'xml',
  '.json': 'json',
  '.yml': 'yaml',
  '.yaml': 'yaml',
  '.js': 'javascript',
  '.php': 'php'
};

const filePatternToLanguage = [
  { pattern: 'syslog', language: 'bash' },
  { pattern: 'nginx', language: 'nginx' },
  { pattern: 'apache', language: 'apache' },
  { pattern: 'httpd', language: 'apache' }
];

const autoDetectLanguage = (filePath: string): string => {
  const fileName = filePath.split('/').pop() || '';
  
  // Check extensions
  const extension = fileName.substring(fileName.lastIndexOf('.'));
  if (extension in fileExtensionToLanguage) {
    return fileExtensionToLanguage[extension];
  }
  
  // Check patterns
  for (const { pattern, language } of filePatternToLanguage) {
    if (fileName.includes(pattern)) {
      return language;
    }
  }
  
  return 'plaintext';
};

113-119: Add validation for lineCount input

While there are min/max attributes on the input, there's no validation to ensure the value stays within these bounds when changed programmatically.

Consider adding a watcher to enforce the min/max constraints:

// Add this after the existing watch
watch(lineCount, (newValue) => {
  if (newValue < 10) lineCount.value = 10;
  if (newValue > 1000) lineCount.value = 1000;
});
web/components/Logs/SingleLogViewer.vue (4)

99-110: Consider optimizing MutationObserver usage.

Observing child list changes can be expensive for large or frequently changing content. If possible, consider using application-level events or selective watchers to mitigate performance overhead.


188-254: Optimize highlightLog for large data.

Highlighting each line is CPU-intensive for large logs. You might consider chunk-based rendering or throttling the process if log sizes become too large, to prevent UI blocking.


294-340: Use a more robust error handling strategy instead of alert().

Relying on alert dialogs may disrupt the user experience. Consider a notification or toast component for better control and styling, or integrate with a global error reporting service.


398-411: Improve infinite scrolling user feedback.

Showing multiple indicators for initial loading and ongoing scroll-based fetching can create confusion. Consider consolidating the loader or clarifying the difference between an initial load and loading more chunks.

web/composables/gql/graphql.ts (3)

1107-1107: Add clarity to the logFiles query.
Returning an array of LogFile is appropriate. Document if this list is filtered or if it includes all files in the log directory.


1799-1803: Promote type-safety with strongly typed variables.
LogFilesQueryVariables is defined but empty. If future expansions occur, consider specifying the variables to avoid silent usage complexities.


1804-1808: Leverage default values in the query schema.
The LogFileContentQueryVariables could incorporate default values for lines in the schema, ensuring consistent usage across clients.

api/src/unraid-api/graph/resolvers/logs/logs.service.ts (6)

38-40: Validate the path retrieval fallback.
If getters.paths()['unraid-log-base'] is undefined or empty, the service might read from an invalid path. Consider defaulting to a known safe directory.


42-69: Perform service-based error handling.
listLogFiles returns [] if an error occurs. This is acceptable, though consider distinguishing between an empty directory vs. an actual error scenario to inform callers.


137-219: Centralize file-truncation logic.
startWatchingLogFile uses a distinct approach to handle truncation. Optional: factor out the truncation reset logic into a helper method to ensure consistent handling if you watch multiple files.


245-270: Ensure large file performance testing.
countFileLines can be costly for massive logs. Investigate partial reads or indexing if dealing with very large files.


272-306: Be mindful of line-based concurrency.
readLastLines does line-by-line iteration. If logs are extremely large, consider chunk-based approaches or established libraries to read from the bottom of a file more efficiently.


308-354: Efficient range-based partial reading.
readLinesFromPosition is well-structured but can also become slow for large jumps. Similar chunk-based reading strategies may help if many lines must be skipped.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 1f00212 and 1fc62ca.

⛔ Files ignored due to path filters (3)
  • api/src/graphql/generated/api/operations.ts is excluded by !**/generated/**
  • api/src/graphql/generated/api/types.ts is excluded by !**/generated/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (42)
  • api/package.json (4 hunks)
  • api/src/__test__/store/modules/paths.test.ts (1 hunks)
  • api/src/core/pubsub.ts (1 hunks)
  • api/src/graphql/schema/types/logs/logs.graphql (1 hunks)
  • api/src/store/modules/paths.ts (1 hunks)
  • api/src/unraid-api/auth/user.decorator.ts (1 hunks)
  • api/src/unraid-api/graph/resolvers/logs/logs.module.ts (1 hunks)
  • api/src/unraid-api/graph/resolvers/logs/logs.resolver.spec.ts (1 hunks)
  • api/src/unraid-api/graph/resolvers/logs/logs.resolver.ts (1 hunks)
  • api/src/unraid-api/graph/resolvers/logs/logs.service.ts (1 hunks)
  • api/src/unraid-api/graph/resolvers/resolvers.module.ts (2 hunks)
  • api/src/unraid-api/main.ts (1 hunks)
  • plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/LogViewer.page (1 hunks)
  • web/components/Auth.ce.vue (1 hunks)
  • web/components/CallbackHandler.ce.vue (1 hunks)
  • web/components/ColorSwitcher.ce.vue (1 hunks)
  • web/components/DevSettings.vue (1 hunks)
  • web/components/DowngradeOs.ce.vue (1 hunks)
  • web/components/DownloadApiLogs.ce.vue (1 hunks)
  • web/components/DummyServerSwitcher.vue (1 hunks)
  • web/components/Logs/LogViewer.ce.vue (1 hunks)
  • web/components/Logs/SingleLogViewer.vue (1 hunks)
  • web/components/Logs/log.query.ts (1 hunks)
  • web/components/Logs/log.subscription.ts (1 hunks)
  • web/components/Modals.ce.vue (1 hunks)
  • web/components/Registration.ce.vue (1 hunks)
  • web/components/SsoButton.ce.vue (1 hunks)
  • web/components/UpdateOs.ce.vue (1 hunks)
  • web/components/UpdateOs/Downgrade.vue (1 hunks)
  • web/components/UpdateOs/Update.vue (1 hunks)
  • web/components/UpdateOs/UpdateIneligible.vue (1 hunks)
  • web/components/UserProfile.ce.vue (1 hunks)
  • web/components/UserProfile/CallbackFeedback.vue (1 hunks)
  • web/components/UserProfile/DropdownLaunchpad.vue (1 hunks)
  • web/components/UserProfile/Promo.vue (1 hunks)
  • web/components/WanIpCheck.ce.vue (1 hunks)
  • web/components/WelcomeModal.ce.vue (1 hunks)
  • web/composables/gql/gql.ts (3 hunks)
  • web/composables/gql/graphql.ts (9 hunks)
  • web/nuxt.config.ts (3 hunks)
  • web/package.json (2 hunks)
  • web/pages/index.vue (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Build Web App
  • GitHub Check: Test API
  • GitHub Check: Build API
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (61)
web/components/DummyServerSwitcher.vue (1)

35-35: Good Update to Absolute CSS Import Path

The update to @import '~/assets/main.css'; standardizes the import path, which helps ensure consistent resolution across environments and may contribute to faster build times. Verify that the build configuration (e.g., Nuxt/Vite) correctly resolves the ~ alias.

web/components/Modals.ce.vue (1)

34-34: Absolute CSS Import Improvement

The update from a relative path to an absolute path for the CSS import enhances consistency across the project and should help avoid potential path resolution issues in complex build environments. Please verify that the tilde (~) syntax is properly configured in your bundler (e.g., Nuxt/Vite) to resolve assets correctly.

web/components/DevSettings.vue (1)

28-28: Absolute CSS Import Path Update Looks Good.
Changing the CSS import from a relative path to an absolute path (@import '~/assets/main.css';) standardizes style resolution across components. Please ensure that your build configuration (e.g., Vite/Nuxt settings) supports the tilde alias for resolving paths.

web/components/UserProfile/DropdownLaunchpad.vue (1)

60-63: Absolute CSS Import Path Updated

The CSS import on line 62 now uses an absolute path via the tilde (@import '~/assets/main.css';), which aligns with the project's standardization efforts. This change promotes consistency across components and can aid in resolving assets more reliably during the build process. Ensure that your build configuration (e.g., Nuxt/Vite) is properly set up to interpret the tilde notation.

web/components/SsoButton.ce.vue (1)

155-155: Adopt Absolute CSS Import for Consistency

Changing the CSS import path to an absolute reference with ~ enhances clarity and maintainability by ensuring that the build system consistently resolves asset locations. Please verify your build configuration (e.g., Nuxt/Vite) correctly handles the ~ alias so that styles are applied as expected across different environments.

web/components/UserProfile/Promo.vue (1)

157-159: Switching to Absolute CSS Import Paths

The change from a relative to an absolute import (@import '~/assets/main.css';) is clear and consistent with the broader project effort to standardize asset paths. Just ensure that the build configuration (e.g., Nuxt/Vite alias settings) properly resolves the ~ alias.

web/components/UpdateOs.ce.vue (1)

75-75: Absolute CSS Import Path Update

The update to use an absolute CSS import path (@import '~/assets/main.css';) instead of a relative one improves consistency and aligns with the project’s overall update for clearer asset resolution. Ensure that the build configuration (e.g., Nuxt/Vite) properly supports the tilde alias.

web/components/UpdateOs/UpdateIneligible.vue (1)

127-127: Alias CSS Import Update.
The CSS import now uses the alias syntax (@import '~/assets/main.css';), aligning with the project's recent changes to standardize asset resolution. Please ensure that your bundler configuration (e.g., Vite or Nuxt) resolves the alias ~ correctly to avoid any import issues during the build.

web/components/CallbackHandler.ce.vue (1)

15-19: Standardize CSS Import Path:
The CSS import in the <style> section has been updated from a relative path to an absolute path (~/assets/main.css), which improves consistency in style resolution across components.

web/components/WanIpCheck.ce.vue (1)

80-84: Consistent CSS Import Update:
Changing the CSS import to an absolute path (~/assets/main.css) standardizes resource resolution, aligning with recent updates in other components.

web/components/UpdateOs/Downgrade.vue (1)

134-138: Absolute CSS Import for Uniform Styling:
The update of the CSS import path to ~/assets/main.css streamlines style management and reinforces the project-wide convention.

web/components/ColorSwitcher.ce.vue (1)

78-82: Adopt Absolute CSS Import:
The modification to use an absolute path for the CSS import enhances maintainability and ensures consistent styling across the application.

web/package.json (2)

15-17: Enhanced Build Script for Faster Builds:
The build script now includes NODE_OPTIONS='--max-old-space-size=4096' and VITE_ALLOW_CONSOLE_LOGS=false, which should help the build process by increasing available memory and reducing excessive logging. This aligns well with the PR objective of faster web builds.


95-95: New Dependency Added – Highlight.js:
The addition of "highlight.js": "^11.11.1" provides syntax highlighting functionality. Please verify that this version meets the project’s compatibility and security standards.

api/src/store/modules/paths.ts (1)

63-63: LGTM: New log path added correctly

This addition follows the existing pattern and adds a path entry for Unraid log files.

api/src/__test__/store/modules/paths.test.ts (1)

28-28: LGTM: Test updated to match implementation

The test snapshot has been correctly updated to include the new "unraid-log-base" path.

api/src/core/pubsub.ts (1)

21-21: LGTM: New pub/sub channel added for log files

This new pub/sub channel is appropriately named and will facilitate real-time log file updates.

web/components/Logs/log.subscription.ts (1)

1-11: LGTM: New GraphQL subscription for log files

This subscription is well-structured with the necessary fields (path, content, totalLines) for tracking log file changes.

web/components/UserProfile/CallbackFeedback.vue (1)

427-431: CSS Import Path Update
The CSS import has been updated to use the alias ~/assets/main.css instead of a relative path. This change improves consistency and maintainability across the project.

web/components/Auth.ce.vue (1)

32-36: Standardize CSS Import Using Alias
The style block now imports the global CSS via ~/assets/main.css rather than a relative path. This update aligns with project-wide conventions and ensures easier resolution in the build pipeline.

web/components/DownloadApiLogs.ce.vue (1)

73-77: Consistent Absolute CSS Import
The CSS import in the style section has been modified to ~/assets/main.css to match the new alias-based standard. This minor change increases clarity without affecting functionality.

web/components/UserProfile.ce.vue (1)

169-173: Adopt Absolute CSS Import for Uniformity
The change in the style block updates the import of the main CSS from a relative path to ~/assets/main.css. This ensures consistency with other components and simplifies asset resolution.

api/src/unraid-api/main.ts (1)

3-3: FastifyAdapter Import Update
The FastifyAdapter import has been modified to use @nestjs/platform-fastify/index.js, in line with the upgrade to version ^11.0.11 of the package. This change should align with the new module structure. Please verify that the new import path works correctly in all deployment environments.

api/src/unraid-api/graph/resolvers/logs/logs.module.ts (1)

1-10: Implementation follows NestJS module pattern correctly

The module declaration properly defines the providers and exports for the logs functionality. The code follows standard NestJS module organization.

api/src/unraid-api/auth/user.decorator.ts (1)

7-7: Type safety improvement

Replacing any with UserAccount as the return type parameter improves type safety and provides better documentation of the expected return value.

plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/LogViewer.page (2)

1-4: Appropriate menu configuration

The menu configuration properly places the Log Viewer in the ManagementAccess section with appropriate title and icon.


17-19: Component implementation looks good

Using the i18n host wrapper ensures proper internationalization support for the log viewer component.

web/components/Logs/log.query.ts (2)

3-12: Well-structured log files query

The query correctly retrieves essential metadata fields for log files.


14-23: Well-designed log content query with pagination support

The query properly implements parameters for pagination control (lines and startLine) which will be important for efficient loading of large log files.

api/src/unraid-api/graph/resolvers/resolvers.module.ts (2)

13-14: Clean addition of new logs feature imports

The LogsResolver and LogsService imports are properly added to the existing imports section, maintaining alphabetical ordering.


46-47: Provider registration looks good

The LogsResolver and LogsService are properly registered as providers in the module.

web/pages/index.vue (3)

11-11: Clean import for new LogViewerCe component

The import statement for the new component is properly added.


187-191: Log Viewer component integration looks good

The LogViewerCe component is properly integrated into the page structure, following the existing pattern of component sections with headers.


201-201:

✅ Verification successful

CSS import path changed from relative to absolute

The import path was changed from a relative path (../assets/main.css) to an absolute path (~/assets/main.css).

Verify this change is consistent with other CSS imports in the project:


🏁 Script executed:

#!/bin/bash
# Check for relative vs. absolute CSS import patterns in the project
echo "Looking for CSS import patterns in Vue files..."
grep -r "@import '.*assets/main.css" --include="*.vue" web/

Length of output: 1588


CSS Import Path is Consistent Across the Project

The change from a relative path (../assets/main.css) to an absolute path (~/assets/main.css) in web/pages/index.vue is consistent with the import statements found throughout the project (see output from files like web/components/Auth.ce.vue, web/components/CallbackHandler.ce.vue, etc.). There are no discrepancies, and the absolute path usage appears to be a uniform convention.

web/components/Logs/LogViewer.ce.vue (3)

1-16: Well-structured component setup with proper imports

The component correctly imports necessary dependencies and uses the Composition API with TypeScript.


17-22: Component state management is appropriately defined

The reactive state variables are properly defined with appropriate types.


175-179: CSS import pattern matches the change in index.vue

The CSS import paths use the absolute path pattern (~/assets/main.css), consistent with the change in index.vue.

web/components/Logs/SingleLogViewer.vue (1)

125-132: Watch out for the potential performance overhead with continuous string concatenation.

Repeated string concatenation in a loop can be expensive and may degrade performance if logs get very large. Consider appending new content as separate chunks or using a more memory-efficient approach.

api/src/unraid-api/graph/resolvers/logs/logs.resolver.ts (1)

37-65: Resource cleanup ensures no memory leaks.

Overriding the async iterator’s return method and stopping file watching is a solid approach. This helps prevent orphaned watchers and subscription leaks.

web/nuxt.config.ts (3)

62-107: Thoroughly test your new build configuration.

Increasing the chunk size limit, using terser-based minification, and disabling console logs can significantly impact debugging and bundle composition. Validate these changes to ensure you don’t introduce unexpected regressions or hinder maintainability.


127-161: Double-check manual chunking for custom elements.

Applying a similar chunking approach to custom elements is great. Be sure to confirm that all shared dependencies are chunked correctly to avoid duplication across element bundles.


227-234: Validate experimental build caching features.

Features like treeshakeClientOnly and asyncEntry can introduce subtle quirks. Confirm that your application’s behavior and performance remain stable across multiple builds and environments.

web/composables/gql/graphql.ts (6)

600-611: Define a clear naming convention for log-related types.
The new LogFile type is straightforward and well-scoped. Ensure future log-related types maintain consistent naming (e.g., prefixing with Log or similar) to avoid confusion with other file-management types in the schema.


613-624: Consider clarifying optional vs. required fields.
startLine within LogFileContent is marked optional, while content and path are required. This is logical, but ensure all client queries gracefully handle cases where startLine is null.


1099-1105: Confirm user permission checks for log file accesses.
The logFile field can expose sensitive server data. Verify that role/permission checks are in place server-side before returning the content.

Would you like a shell script to search for any existing permission checks around the logFile resolver?


1159-1162: Validate query arguments for out-of-bound requests.
Ensure negative or excessively large lines and startLine are adequately validated on the server side to prevent spurious reads or performance issues.


1813-1819: Enforce active subscription checks.
LogFileSubscriptionSubscription is powerful for real-time logs. Ensure unsubscribing or client disconnect events are effectively handled.


1946-1948: Validate the correctness of generate documents.
The newly generated documents (LogFilesDocument, LogFileContentDocument, LogFileSubscriptionDocument) appear accurate. Confirm that older references to logs won't clash with these new operations.

api/package.json (1)

54-54: Check for breaking changes in upgraded major dependencies.
Updated packages (@fastify/cookie, NestJS core libraries, fastify, nest-authz, @nestjs/testing, and newly added @jsonforms/core) may introduce API or behavioral differences. Confirm that existing routes, middleware, and testing flows continue functioning properly.

Also applies to: 61-65, 67-67, 93-93, 113-113, 149-149

api/src/unraid-api/graph/resolvers/logs/logs.service.ts (5)

1-11: Adopt consistent import groupings.
Imports from the Node standard library, third-party modules, and local modules are handled well. There are no immediate issues, but consistent grouping can aid readability.


12-24: Confirm naming coherence for interfaces.
LogFile and LogFileContent are cohesive. Ensure these mirror the GraphQL schema accurately and avoid type mismatches.


26-35: Class-level structure looks good.
Service-level dependencies are minimal, which keeps it flexible. Good job setting up a private logger for debugging.


113-135: Increment subscription count carefully.
getLogFileSubscriptionChannel increments an existing subscription. Ensure that concurrent accesses are synchronized if multiple subscriptions come in parallel.


221-243: Favor typed unsubscribing patterns.
stopWatchingLogFile is straightforward. Just confirm upstream resolvers remove the subscription calls at the correct time to avoid watchers persisting.

api/src/graphql/schema/types/logs/logs.graphql (4)

1-14: Well-designed query definitions for log file operations

The Query type is well-structured with clear documentation for each operation. The logFiles query provides a way to list available log files, while the logFile query allows retrieving specific log content with pagination support through the optional lines and startLine parameters.


16-22: Good implementation of subscription for real-time log monitoring

The Subscription type correctly defines a way to subscribe to changes in a specific log file, which is essential for real-time log monitoring functionality. This is a good pattern for keeping the UI updated with the latest log data.


24-47: Well-structured LogFile type with comprehensive metadata

The LogFile type includes all necessary metadata fields (name, path, size, modifiedAt) with appropriate types and thorough documentation. This provides a complete view of log file properties for the frontend.


49-72: Properly defined LogFileContent type with pagination support

The LogFileContent type correctly captures all necessary information about log file content, including the total number of lines and optional starting line for pagination. The inclusion of these fields will help with implementing a robust log viewer UI.

web/composables/gql/gql.ts (3)

17-19: Properly added log-related GraphQL operations to Documents type

The three new operations for log files are correctly added to the Documents type, following the existing pattern in the file. These operations match the GraphQL schema definitions and provide all necessary fields.


41-43: Correctly implemented log-related operations in documents constant

The log-related GraphQL operations are properly added to the documents constant, referencing the correct types from the generated GraphQL types.


79-90: Well-implemented graphql function overloads for log operations

The three new overloads of the graphql function provide proper type safety for the log-related operations. These follow the same pattern as other operations in the file and will ensure correct typing when used in the application.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
web/nuxt.config.ts (1)

213-219: Beneficial experimental features enabled

The enabled experimental features will improve build performance and caching. Just be aware that these are experimental Nuxt features which may change in future releases. Consider documenting these choices for future maintainers.

Consider adding a brief comment explaining why these specific experimental features were selected to help future maintainers understand the reasoning behind these choices.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 1fc62ca and ee4ad64.

⛔ Files ignored due to path filters (3)
  • api/src/graphql/generated/api/operations.ts is excluded by !**/generated/**
  • api/src/graphql/generated/api/types.ts is excluded by !**/generated/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • api/src/unraid-api/graph/resolvers/resolvers.module.ts (2 hunks)
  • web/composables/gql/gql.ts (3 hunks)
  • web/composables/gql/graphql.ts (10 hunks)
  • web/nuxt.config.ts (3 hunks)
  • web/package.json (2 hunks)
  • web/pages/index.vue (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • web/package.json
  • web/pages/index.vue
  • api/src/unraid-api/graph/resolvers/resolvers.module.ts
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build Web App
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (16)
web/nuxt.config.ts (4)

52-87: Excellent build optimization configuration

This is a well-structured Vite build configuration that implements several performance optimizations:

  • The increased chunk size warning limit reduces noise in build output
  • Parallel builds with Terser will significantly improve build times
  • The conditional console log removal is a good practice for production builds
  • The manual chunking strategy is simple but effective for improved loading times

Your approach to variable name reservation with the terserReservations function is particularly thoughtful to avoid conflicts.


89-97: Good dependency optimization strategy

Explicitly including core dependencies and disabling dependency discovery in production will improve build performance. The selected dependencies (Vue, Pinia, VueUse) are excellent candidates for optimization as they're unlikely to change frequently during development.


113-146: Well-aligned custom elements build configuration

The custom elements build configuration properly mirrors the main build settings, ensuring consistent optimization. Disabling HMR for production builds is a good performance decision.


203-206: New LogViewer component looks good

The new UnraidLogViewer component is properly integrated with the existing custom elements pattern, making the new log viewing functionality available as a web component.

web/composables/gql/gql.ts (5)

19-21: Looks good: new queries for retrieving log files.
These newly added operations appear consistent with your existing patterns for GraphQL document mapping. No immediate concerns.


45-47: Consistent addition to the document map.
The mirrored entries in the documents object ensure queries and subscriptions are properly exposed.


91-94: Good explicit overload for LogFiles query.
Exporting a specific overload for the LogFiles query helps ensure type-safety.


95-98: Proper overload for LogFileContent query.
The docstring clarifies how the function can be used. Code is clean.


99-102: New subscription overload looks fine.
Including the typed subscription for log file updates aligns well with your usage pattern in this file.

web/composables/gql/graphql.ts (7)

103-106: Useful docstring for port.
The clarifying comments on how port behaves with different forwardType settings will help others avoid misconfigurations.


339-347: Clear docstrings for these Remote Access fields.
Descriptive comments on accessType, extraOrigins, forwardType, and port improve maintainability.


651-662: Well-structured LogFile type.
Defining each property for name, path, and metadata is concise and logical.


664-675: Clear separation of concerns with LogFileContent.
Distinct typing for file metadata vs. file content is a good approach, especially for large logs.


1160-1168: Well-documented logFile and logFiles queries.
This ensures thorough clarity on usage (e.g., line count, default reading behavior). The docstring is excellent.


1199-1203: Explicit argument doc for QuerylogFileArgs.
Makes the usage of optional vs. required arguments more evident to other developers.


1452-1453: Subscription argument doc is consistent.
Standardizing the docstring pattern helps keep these schema definitions cohesive.

@elibosley elibosley force-pushed the feat/fast-web-build branch from f1834b3 to 0f38482 Compare March 17, 2025 15:49
@elibosley elibosley changed the title feat: faster web builds feat: swap to absolute paths for css Mar 17, 2025
@elibosley elibosley merged commit 6f9fa10 into main Mar 17, 2025
5 of 6 checks passed
@elibosley elibosley deleted the feat/fast-web-build branch March 17, 2025 20:28
@github-actions
Copy link
Contributor

This plugin has been deployed to Cloudflare R2 and is available for testing.
Download it at this URL:

https://preview.dl.unraid.net/unraid-api/tag/PR1224/dynamix.unraid.net.plg

pujitm pushed a commit that referenced this pull request Mar 18, 2025
🤖 I have created a release *beep* *boop*
---


## [4.2.0](v4.1.3...v4.2.0)
(2025-03-18)


### Features

* add resolver for logging
([#1222](#1222))
([2d90408](2d90408))
* connect settings web component
([#1211](#1211))
([653de00](653de00))
* improve local dev with install path
([#1221](#1221))
([32c5b0a](32c5b0a))
* split plugin builds
([4d10966](4d10966))
* swap to absolute paths for css
([#1224](#1224))
([6f9fa10](6f9fa10))
* update theme application logic and color picker
([#1181](#1181))
([c352f49](c352f49))
* use patch version if needed on update check
([#1227](#1227))
([6ed46b3](6ed46b3))


### Bug Fixes

* add INELIGIBLE state to ConfigErrorState enum
([#1220](#1220))
([1f00212](1f00212))
* **api:** dynamix notifications dir during development
([#1216](#1216))
([0a382ca](0a382ca))
* **api:** type imports from generated graphql types
([#1215](#1215))
([fd02297](fd02297))
* **deps:** update dependency @nestjs/schedule to v5
([#1197](#1197))
([b1ff6e5](b1ff6e5))
* **deps:** update dependency @vueuse/core to v12
([#1199](#1199))
([d8b8339](d8b8339))
* fix changelog thing again
([2426345](2426345))
* fix invalid path to node with sh execution
([#1213](#1213))
([d12448d](d12448d))
* load tag correctly
([acd692b](acd692b))
* log errors
([629feda](629feda))
* one-command dev & web env files
([#1214](#1214))
([8218fab](8218fab))
* re-release fixed
([bb526b5](bb526b5))
* recreate watcher on path change
([#1203](#1203))
([5a9154e](5a9154e))
* update brand loading variants for consistent sizing
([#1223](#1223))
([d7a4b98](d7a4b98))

---
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant