Skip to content
This repository was archived by the owner on Jan 14, 2023. It is now read-only.

Commit 463c383

Browse files
authored
[rnoz] Follow up (#17)
* Audit fixes * Pre-commit lint hook, docker image, minor fixes * Validated features working on mac. Sorted the information given in readme * Add docker section to readme, updated snapshots * Apply automatic lint fixes. Add .eslintignore * Include linting into ci * Simplifty tray setup. Fix icons for macOS * Replace desktopIdle with default electron powerMonitor * Minor refactoring for idle timeout logic * Fix issue with startup on windows when userDir does not yet exists * Fix hide/show in tray * Slightly improve the way subtasks are displayed * Fix the way custom fields are displayed * Remove unused files * Fix linting issues * Update snapshot and add powerMonitor to the electron mock * Bump dependencies * stack.yml -> docker-compose.yml * Unsub from ipc events. Fix bug with timer animation when resumed from tray * Fix eslint setup. Auto lint fixes * Update @testing-library. Update snapshots. Fix links on about page * Fix tests for Copyrights.jsx * Fix tests for DragArea * Fix tests for textArea * Fix tests for DatePicker * Fix tests for infinitescroll * Fixed tests for comments section * Fix tests for AboutPage * Fix tests for Navbar * Fix tests for progressbar * Fix tests for IssuesTable, OptionsBlock * Fix tests for issues actions * Fix styles for ColumnHeadersSelect * Fix tests for Button * Fix tests for TimeEntries * Fix tests for SummaryPage * Fix tests for markdowneditor * Fix tests for AppView * Fix tests for LoginView * Fix tests fro the IssueDetailsPage * Fix tests for timer * Small fix for the markdown editor test * Partially fixed linting errors * Fix linting issues * Fix tests * Fix layout for the custom fields when there are no subtasks * Fix login view mode checkbox * Fix timer * Fix settings event subscription
1 parent f351995 commit 463c383

File tree

156 files changed

+14205
-19083
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+14205
-19083
lines changed

.circleci/config.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
11
version: 2
22
jobs:
3-
build:
3+
lint:
44
working_directory: ~/redshape
55
docker:
66
- image: circleci/node:10.15.3
77
steps:
88
- checkout
99
- restore_cache:
1010
key: dependency-cache-{{ .Branch }}-{{ checksum "package.json" }}
11+
- run: 'sudo apt install libxss-dev pkg-config'
12+
- run:
13+
name: Install Dependencies
14+
command: 'npm install'
15+
- save_cache:
16+
key: dependency-cache-{{ .Branch }}-{{ checksum "package.json" }}
17+
paths:
18+
- ./node_modules
19+
- run:
20+
name: 'Linting'
21+
command: 'npm run lint'
22+
23+
test:
24+
working_directory: ~/redshape
25+
docker:
26+
- image: circleci/node:10.15.3
27+
steps:
28+
- checkout
29+
- restore_cache:
30+
key: dependency-cache-{{ .Branch }}-{{ checksum "package.json" }}
31+
- run: 'sudo apt install libxss-dev libxext-dev libxtst6 libnss3 libgtk-3-0 libgtkextra-dev libasound2'
1132
- run:
1233
name: Install Dependencies
1334
command: 'npm install'
@@ -18,4 +39,10 @@ jobs:
1839
- run:
1940
name: Coverage
2041
command: 'npm test'
21-
42+
43+
workflows:
44+
version: 2
45+
test:
46+
jobs:
47+
- lint
48+
- test

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.eslintrc.json

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"parser": "babel-eslint",
23
"env": {
34
"browser": true,
45
"es6": true,
@@ -27,9 +28,48 @@
2728
"no-underscore-dangle": [ "error", {
2829
"allow": ["__initialize", "__reset"]
2930
}],
31+
"max-len": ["error", { "code": 120, "ignoreComments": true }],
32+
"no-restricted-syntax": "off",
3033
"camelcase": [ "error", {
31-
"allow": ["api_key"]
34+
"allow": [
35+
"api_key",
36+
"time_entry",
37+
"spent_on",
38+
"issue_id",
39+
"activity_id",
40+
"user_id",
41+
"spent_hours",
42+
"total_spent_hours",
43+
"time_entries",
44+
"project_id",
45+
"tracker_id",
46+
"status_id",
47+
"assigned_to_id",
48+
"author_id",
49+
"due_date",
50+
"created_on",
51+
"priority_id",
52+
"private_notes",
53+
"total_count",
54+
"estimated_duration",
55+
"estimated_hours",
56+
"done_ratio",
57+
"assigned_to",
58+
"start_date",
59+
"custom_fields",
60+
"closed_on",
61+
"progress_info"
62+
]
3263
}],
64+
"jsx-a11y/label-has-associated-control": "off",
65+
"jsx-a11y/anchor-is-valid": "off",
66+
"react/no-array-index-key": "off",
67+
"no-mixed-operators": "off",
68+
"react/forbid-prop-types": "off",
69+
"react/require-default-props": "off",
70+
"react/jsx-props-no-spreading": "off",
71+
"max-classes-per-file": "off",
72+
"no-use-before-define": "off",
3373
"jsx-a11y/label-has-for": [ 2, {
3474
"required": {
3575
"every": [ "nesting", "id" ]

README.md

Lines changed: 22 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,11 @@
55

66
A time tracker for [Redmine](https://www.redmine.org) built on [Electron](https://github.com/electron/electron).
77

8-
> This repo is a fork of the original project. Have a look to the section `rNoz changes` to see the new features.
9-
>
10-
> I would like to integrate these changes in the original one, but until then, I use my own repo.
11-
>
12-
> Acknowledgements: Daniyil Vasylenko and Group4Layers (see the section `Acknowledgements`)
13-
148
Re-designs the way tasks, task info, tracked time and communication is done on redmine.
159

1610
The project was originally developed for a MVP portfolio showcase, but there is some roadmap planned with new features that might be added once I find enough of free time.
1711

18-
Thanks for using, or considering to use this project. I would love to hear some feedback as well as your suggestions and thoughts about what could be improved. If you have something to say, don't hesitate to [send me an email](mailto:redshape.app@gmail.com).
12+
Thanks for using, or considering to use this project.
1913

2014
![Redshape Screenshot](https://user-images.githubusercontent.com/4171202/58926139-bbd6df00-8752-11e9-92bb-ddfdb5bce33d.png)
2115

@@ -41,14 +35,17 @@ Download the latest [Redshape release](https://github.com/Spring3/redshape/relea
4135

4236
The application will automatically update when a new release is available.
4337

44-
## License
45-
[GPL-3.0](https://github.com/Spring3/redshape/blob/master/LICENSE.md)
38+
## Development
4639

47-
Created by [Daniyil Vasylenko](https://github.com/Spring3)
40+
If you don't have access to a deployed instance of redmine, you can now run it in docker
4841

49-
## Contributors
42+
Unfortuantely, you will have to configure it then yourself
5043

51-
rNoz <rnoz.commits@gmail.com> (Group4Layers member).
44+
```
45+
docker-compose -f docker-compose.yml up
46+
```
47+
48+
Then after you run the project with `npm run dev`, use `http://localhost` as redmine endpoint on the login form and provide the credentials or the API token
5249

5350
## FAQ
5451

@@ -61,155 +58,29 @@ Please ask your Redmine admin user to check if it's enabled in `Administration -
6158
#### - My antivirus / Defender / Mac OS warns that it's not safe to run this app
6259
Mac OS build was signed by a **self-signed certificate**, while Windows and Linux builds **were not signed at all**. In such case, you will see this warnings upon download or running the application / installation, saying that this app is not safe to run or that it was provided by an unknown developer and is not safe to run.
6360

64-
## rNoz changes
65-
66-
### Auth
67-
68-
- Login accepts both API or Username+Password as login method:
69-
70-
![](docs/changes/login_mode_api.png)
71-
72-
### Durations
73-
74-
- Duration: you can use hours, and it is rounded as it will be used in Redmine
75-
76-
![](docs/changes/accept_hours.png)
77-
78-
- Duration: hours are not positive enough (15s rounded => 0)
79-
80-
![](docs/changes/error_nonpositive_enough.png)
81-
82-
- Duration: empty
83-
84-
![](docs/changes/error_empty.png)
85-
86-
- Duration: negative
87-
88-
![](docs/changes/error_negative.png)
89-
90-
- Duration: duration formats (2 examples)
91-
92-
![](docs/changes/accept_duration_1.png)
93-
94-
![](docs/changes/accept_duration_2.png)
95-
96-
- Time Entries are casted to duration formats when editing. For example, this:
97-
98-
![](docs/changes/timeentries.png)
99-
100-
When it is clicked, it is automatically converted to the most comfortable duration format:
101-
102-
![](docs/changes/timeentries_modal_duration.png)
103-
104-
- When tracking an issue:
105-
106-
![](docs/changes/timer.png)
107-
108-
When it is stopped, it is properly filled:
109-
110-
![](docs/changes/timer_stop_modal_duration.png)
111-
112-
- Added info tooltip for the duration field:
113-
114-
![](docs/changes/tooltip.png)
115-
116-
### TimeEntryModal
117-
118-
- When closing the modal of a modified entry or non saved entry (stopped), we need to confirm:
119-
120-
![](docs/changes/timeentreymodal_confirm_modified.png)
121-
122-
- Validations in TimeEntryModal are performed per field (onBlur), to avoid annoying errors in fields we didn't modify yet.
123-
124-
### Tray
125-
126-
- Added tray, allowing to hide in tray/show window, because most of the time the Redshape window is not needed.
61+
#### - How to use timer controls
12762

128-
- Tray with pause/resume button of current timer (long/short issue subject):
63+
Timer controls allow to manually modify the time for the timer by (1 or 5 minutes back and forth) as well as write temporary comments. Using these, we can directly modify the time after the pause in the task. To enable it, toggle the "Use advanced timer controls" item in the Settings menu
12964

130-
![](docs/changes/tray_pause_long.png)
131-
![](docs/changes/tray_resume_short.png)
65+
#### - Idle behavior
13266

133-
- Tick optimizations when using Redshape in tray. This are debug messages not present in the app. They are just printed here to show
134-
the optimization. We reduce the CPU usage.
67+
Redshape can pause the timer if it detects the system is idle for a range of times (5, 10 o 15 minutes). It will warn with notifications (15s. warning time before pausing).
13568

136-
![](docs/changes/tracker_optimization.png)
69+
Optionally, it can automatically discard the idle time from the current timer when it is paused.
13770

138-
- New icons are provided for the tray, showing when it is tracking an issue (play, pause) or not.
71+
#### - More accurate progressbar
13972

140-
### Advanced Timer Controls
73+
Issue progress slider can be changed with 1% step if configured (by default is 10%).
74+
Enable this if you have support in the server side (ruby, redmine) to use every percentage (33%, 81%, etc).
14175

142-
- The view can be advanced or simple. When using advanced view, we can use new buttons to modify the current time (1 or 5 minutes) and write temporary comments. Using these, we can directly modify the time in case we were interrupted in the task (avoid remembering those changes until the end). Also, the comments help us in workflows where our time entry can be hours long.
143-
144-
![](docs/changes/advanced_timer_controls_long.png)
145-
146-
![](docs/changes/advanced_timer_controls_short.png)
147-
148-
When we finish, we have updated our TimeEntryModal:
149-
150-
![](docs/changes/advanced_timer_controls_to_time_entry.png)
151-
152-
### Idle behavior
153-
154-
- Redshape can pause the timer if it detects the system is idle for a range of times (5, 10 o 15 minutes). It will warn with notifications (15s. warning time before pausing).
155-
156-
- Optionally, it can automatically discard the idle time from the current timer when it is paused.
157-
158-
### Settings
159-
160-
- New settings menu to be used per user/redmine host.
161-
162-
![](docs/changes/settings_menu.png)
163-
164-
### Minor bugfixes
165-
166-
- There are other minor bugfixes and features not listed but can be read in the git log. Those are usually related with UX, propagating correctly the state, etc.
167-
168-
### Issue progress bars
169-
170-
- Progress (done ratio) shows a gradient of 5 colors between red-yellow-green (0, 20, 40, 60, 80, 100%).
171-
172-
Time cap shows a green bar between 0-80% and yellow-green in the last 20%. When it is overtime (eg. 150%), a red bar is shown with the overtime proportion (eg. 50/150).
173-
174-
Tooltips added showing the specific percentage value.
175-
176-
![](docs/changes/progressbars.png)
177-
178-
### Custom fields
179-
180-
- Custom fields are shown in the issue details page (if available).
181-
182-
![](docs/changes/custom_fields.png)
183-
184-
### Edit issue
185-
186-
- Progress (done ratio) can be edited in a new modal. It supports an input range to slide the percetage of progress (0 to 100).
187-
188-
![](docs/changes/edit_issue_progress.png)
189-
190-
- Estimation (hours) and Due date can also be edited.
191-
192-
![](docs/changes/edit_issue_estimation_due_date.png)
193-
194-
- If editing a parent task, some non-editable fields are omitted.
195-
196-
![](docs/changes/edit_issue_parent.png)
197-
198-
### Issue fields
199-
200-
- If is a parent task, it shows links to each of its subtasks.
201-
202-
If is a parent task, it shows the totals (estimated and spent time).
203-
204-
![](docs/changes/issue_subtasks.png)
205-
206-
### More settings
76+
## License
77+
[GPL-3.0](https://github.com/Spring3/redshape/blob/master/LICENSE.md)
20778

208-
- Issue progress slider can be changed with 1% step if configured (by default is 10%).
209-
Enable this if you have support in the server side (ruby, redmine) to use every percentage (33%, 81%, etc).
79+
Created by [Daniyil Vasylenko](https://github.com/Spring3)
21080

211-
![](docs/changes/settings_progress.png)
81+
## Contributors
21282

83+
[rNoz](https://github.com/rnoz) from [Group4Layers](https://www.group4layers.com)
21384

21485
### AUR package
21586

@@ -234,12 +105,5 @@ The second target (`pkgbuild`) will update the version and md5sums of the PKGBUI
234105

235106
### Known issues
236107

237-
- Tray new icons should be ported for Mac (png to icns; png2icns gives black background).
238-
- Changes not tested in Mac or Windows.
239108
- One test is omitted from the original repo (TimeEntryModal, it should match the snapshot) because it never finishes (throws JS heap out of memory).
240109
- As soon as Electron v8 is stable, it should be used (package.json). Redshape is prepared for future features (timeoutType), keeping the notification when the timer is paused due to system idle.
241-
242-
## Acknowledgements
243-
244-
- [Daniyil Vasylenko](redshape.app@gmail.com): original author of this interesting and useful project.
245-
- [Group4Layers](https://www.group4layers.com): it is possible to contribute to this repository and achieve the new features provided here thanks to this company and its efforts to promote and work with open source. The two weeks of dedication have been given in hours assigned by the company.

__mocks__/electron-store.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,24 @@ class Store {
1414
}
1515

1616
get = (key) => {
17+
// eslint-disable-next-line
1718
console.log('[electron-store] Using mocked get function');
1819
return values[key];
1920
}
2021

2122
has = (key) => {
23+
// eslint-disable-next-line
2224
console.log('[electron-store] Using mocked has function');
2325
return Object.hasOwnProperty.call(values, key);
2426
}
2527

2628
set = (key, value) => {
29+
// eslint-disable-next-line
2730
console.log('[electron-store] Using mocked set function');
2831
values[key] = value;
2932
}
3033

31-
delete = (key) => delete values[key];
34+
delete = (key) => delete values[key];
3235

3336
clear = () => Store.__reset();
3437
}

__mocks__/electron.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ const shell = {
44
openExternal: () => {}
55
};
66

7+
const powerMonitor = {
8+
getSystemIdleTime: jest.fn()
9+
};
10+
711
const remote = {
812
shell,
913
process: {
@@ -17,16 +21,20 @@ const remote = {
1721
if (path.includes('/common/request')) {
1822
return require('../common/request'); // eslint-disable-line
1923
}
24+
if (path.includes('electron')) {
25+
return { powerMonitor };
26+
}
2027
return undefined;
2128
}
2229
};
2330

2431
const ipcRenderer = {
2532
on: jest.fn(),
2633
send: jest.fn(),
34+
removeListener: jest.fn()
2735
};
2836

2937
module.exports = {
3038
remote,
31-
ipcRenderer,
39+
ipcRenderer
3240
};

__mocks__/image-mock.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1+
import React from 'react';
2+
3+
// eslint-disable-next-line react/jsx-filename-extension
14
export default () => (<div className="image" />);
533 Bytes
Loading

assets/icon-pause.ico

-136 KB
Binary file not shown.

assets/icon-pause.png

-22.9 KB
Loading

0 commit comments

Comments
 (0)