Skip to content

feat: added workreport view#742

Open
ErikBjare wants to merge 2 commits intomasterfrom
dev/feat-workreport
Open

feat: added workreport view#742
ErikBjare wants to merge 2 commits intomasterfrom
dev/feat-workreport

Conversation

@ErikBjare
Copy link
Member

@ErikBjare ErikBjare commented Jan 24, 2026

Important

Adds a new work report view with export options and integrates it into the navigation and routing.

  • New Feature:
    • Adds WorkReport.vue for generating work time reports with options for hosts, categories, break time, and date range.
    • Supports CSV and JSON export of report data.
  • Navigation:
    • Adds "Work Report" option to dropdown in Header.vue.
    • Imports briefcase icon in Header.vue.
  • Routing:
    • Adds route for /work-report in route.js.

This description was created by Ellipsis for ec8e85c. You can customize this summary. It will automatically update as commits are pushed.

@ErikBjare ErikBjare changed the title feat: added workreport feature (wip) feat: added workreport view Jan 24, 2026
b-dropdown-item(to="/search")
icon(name="search")
| Search
b-dropdown-item(to="/work-report")
Copy link
Member Author

@ErikBjare ErikBjare Jan 24, 2026

Choose a reason for hiding this comment

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

Maybe just rename to /report?

Edit: oh, that already exists...

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 24, 2026

Greptile Overview

Greptile Summary

Added a new Work Report view that allows users to generate work time reports filtered by hosts, categories, and date ranges with CSV/JSON export capabilities.

Key Changes:

  • Added new /work-report route and navigation menu item in Tools dropdown
  • Implemented multi-device query support with custom break time flooding
  • Provided daily breakdown table showing work time, sessions, and average session length

Critical Issues:

  • The startOfDay offset parsing bug on line 252 will cause runtime errors when calculating timeperiods
  • Only 2 of 5 date range options are implemented (last7d, last30d work; thisWeek, thisMonth, custom are not implemented)

Confidence Score: 2/5

  • This PR has a critical runtime bug that will break timeperiod calculation
  • Score reflects a critical syntax error in offset parsing that will cause the feature to fail, plus incomplete implementation of advertised date range options
  • Pay close attention to src/views/WorkReport.vue - the getTimeperiods() method has critical bugs

Important Files Changed

Filename Overview
src/components/Header.vue Added Work Report menu item and briefcase icon - clean integration with existing navigation
src/route.js Added route for WorkReport view with lazy loading - follows existing pattern correctly
src/views/WorkReport.vue New work report view with critical startOfDay offset parsing bug and missing date range implementations

Sequence Diagram

sequenceDiagram
    participant U as User
    participant WR as WorkReport.vue
    participant CS as CategoryStore
    participant BS as BucketsStore
    participant SS as SettingsStore
    participant C as AWClient
    participant S as AW Server

    U->>WR: Navigate to /work-report
    activate WR
    WR->>CS: load categories
    WR->>BS: ensureLoaded()
    BS-->>WR: return buckets
    WR->>WR: Auto-select all hosts
    WR-->>U: Display form (hosts, categories, break time, date range)
    deactivate WR

    U->>WR: Click "Calculate Work Time"
    activate WR
    WR->>SS: Get startOfDay offset
    SS-->>WR: "04:00"
    WR->>WR: getTimeperiods() - Build date ranges
    WR->>CS: Get classes_for_query
    CS-->>WR: Category rules
    WR->>WR: Build multi-device query with flood + categorize + filter_keyvals
    
    loop For each timeperiod
        WR->>C: query(timeperiod, query_string)
        C->>S: POST /api/0/query
        S-->>C: Query results (events, duration)
        C-->>WR: Query results
    end
    
    WR->>WR: Process results into dailyData
    WR-->>U: Display daily breakdown table
    deactivate WR

    U->>WR: Click "Export CSV" or "Export JSON"
    activate WR
    WR->>WR: Format data as CSV/JSON
    WR->>U: Download file
    deactivate WR
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines 252 to 260
const offset = this.settingsStore.startOfDay;

const timeperiods = [];

if (this.dateRange === 'last7d') {
for (let i = 6; i >= 0; i--) {
const start = moment().subtract(i, 'days').startOf('day').add(offset);
const end = start.clone().add(1, 'day');
timeperiods.push(start.format() + '/' + end.format());
Copy link
Contributor

Choose a reason for hiding this comment

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

offset is a string (format "04:00") but is being passed directly to moment().add() which expects a number.

Parse the offset properly:

Suggested change
const offset = this.settingsStore.startOfDay;
const timeperiods = [];
if (this.dateRange === 'last7d') {
for (let i = 6; i >= 0; i--) {
const start = moment().subtract(i, 'days').startOf('day').add(offset);
const end = start.clone().add(1, 'day');
timeperiods.push(start.format() + '/' + end.format());
const offset = this.settingsStore.startOfDay;
const [hours, minutes] = offset.split(':');
const offsetDuration = { hours: parseInt(hours), minutes: parseInt(minutes) };
const timeperiods = [];
if (this.dateRange === 'last7d') {
for (let i = 6; i >= 0; i--) {
const start = moment().subtract(i, 'days').startOf('day').add(offsetDuration);
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/views/WorkReport.vue
Line: 252:260

Comment:
`offset` is a string (format "04:00") but is being passed directly to `moment().add()` which expects a number.

Parse the offset properly:
```suggestion
      const offset = this.settingsStore.startOfDay;
      const [hours, minutes] = offset.split(':');
      const offsetDuration = { hours: parseInt(hours), minutes: parseInt(minutes) };
      
      const timeperiods = [];
      
      if (this.dateRange === 'last7d') {
        for (let i = 6; i >= 0; i--) {
          const start = moment().subtract(i, 'days').startOf('day').add(offsetDuration);
```

How can I resolve this? If you propose a fix, please make it concise.

timeperiods.push(start.format() + '/' + end.format());
}
}
// TODO: Add other date ranges
Copy link
Contributor

Choose a reason for hiding this comment

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

only 'last7d' and 'last30d' are implemented, but 'thisWeek', 'thisMonth', and 'custom' date range options are presented to users without corresponding logic

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/views/WorkReport.vue
Line: 269:269

Comment:
only 'last7d' and 'last30d' are implemented, but 'thisWeek', 'thisMonth', and 'custom' date range options are presented to users without corresponding logic

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to 8274a00 in 2 minutes and 30 seconds. Click for details.
  • Reviewed 387 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/components/Header.vue:62
  • Draft comment:
    Consider adding active state styling for the new ‘Work Report’ dropdown item to match the behavior of other navigation items.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. src/route.js:70
  • Draft comment:
    The WorkReport route is correctly lazy‐loaded and added. Ensure its placement/order remains consistent with similar routes.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. src/views/WorkReport.vue:190
  • Draft comment:
    The regex replacement on the JSON string for categories (replace(/\\/g, '')) may be brittle; verify it correctly handles all expected input cases.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment suggests verifying the regex replacement, which is not allowed as it asks the author to ensure the behavior is intended. It doesn't provide a specific suggestion or ask for a test to be written. Therefore, it should be removed.
4. src/views/WorkReport.vue:174
  • Draft comment:
    Using alert() for notifying the user when no hosts are selected is less user-friendly; consider using a UI notification component.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
5. src/views/WorkReport.vue:302
  • Draft comment:
    In exportJSON the selectedCategories are exported as JSON strings; consider converting them back to their original structure for clarity in the exported data.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
6. src/views/WorkReport.vue:192
  • Draft comment:
    Consider refactoring the query-building logic inside loadData into a separate helper function to improve maintainability and readability.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_o7I3kXQusYv60oWO

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

}
},

getTimeperiods() {
Copy link
Contributor

Choose a reason for hiding this comment

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

The UI offers several date range options (e.g. 'thisWeek', 'thisMonth', and 'custom'), but getTimeperiods only handles 'last7d' and 'last30d'. Consider implementing support for the remaining options or disabling them in the UI.

@codecov
Copy link

codecov bot commented Jan 24, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 26.07%. Comparing base (60706f1) to head (ec8e85c).

Files with missing lines Patch % Lines
src/route.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #742      +/-   ##
==========================================
- Coverage   26.08%   26.07%   -0.02%     
==========================================
  Files          29       29              
  Lines        1698     1699       +1     
  Branches      307      307              
==========================================
  Hits          443      443              
- Misses       1192     1234      +42     
+ Partials       63       22      -41     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed ec8e85c in 1 minute and 29 seconds. Click for details.
  • Reviewed 227 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/views/WorkReport.vue:100
  • Draft comment:
    Unnecessary whitespace changes here; consider using a consistent auto-formatter (e.g., Prettier) to avoid noise in diffs.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. src/views/WorkReport.vue:200
  • Draft comment:
    The JSON.stringify() interpolation was split into multiple lines, which can hurt readability. Consider keeping it inline.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
3. src/views/WorkReport.vue:196
  • Draft comment:
    For consistency and security, use the sanitized variable (safeHost) in the find_bucket call instead of the unsanitized hostname.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_0BNsIrewdWlmLj20

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

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