-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maigo Erit
committed
Oct 12, 2017
1 parent
f5b9040
commit bae66c5
Showing
7 changed files
with
253 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,71 @@ | ||
import { autoinject } from "aurelia-framework"; | ||
import * as moment from "moment"; | ||
import { SettingsService } from "./settings-service"; | ||
import { autoinject } from 'aurelia-framework'; | ||
import * as moment from 'moment'; | ||
import { SettingsService } from './settings-service'; | ||
|
||
const remote = (<any>window).nodeRequire('electron').remote; | ||
let ipcRenderer: any = (<any>window).nodeRequire('electron').ipcRenderer; | ||
|
||
@autoinject | ||
export class TrackItemService { | ||
private service: any; | ||
private service: any; | ||
|
||
constructor(private settingsService: SettingsService) { | ||
this.service = remote.getGlobal('TrackItemService'); | ||
} | ||
constructor(private settingsService: SettingsService) { | ||
this.service = remote.getGlobal('TrackItemService'); | ||
} | ||
|
||
/* findAllItems(from, to, taskName, searchStr, paging) { | ||
/* findAllItems(from, to, taskName, searchStr, paging) { | ||
return this.service.findAllFromDay(from, to, taskName, searchStr, paging); | ||
}*/ | ||
|
||
findAllDayItems(from, to, taskName): Promise<any> { | ||
return this.service.findAllDayItems(from, to, taskName); | ||
} | ||
|
||
findAllFromDay(from: Date, type: string): Promise<any> { | ||
return this.service.findAllFromDay(from, type); | ||
} | ||
|
||
findFirstLogItems(): Promise<any> { | ||
return this.service.findFirstLogItems(); | ||
} | ||
|
||
createItem(trackItem): Promise<any> { | ||
return this.service.createTrackItem(trackItem); | ||
} | ||
|
||
updateItem(trackItem): Promise<any> { | ||
return this.service.updateItem(trackItem); | ||
} | ||
|
||
deleteById(trackItemId) { | ||
return this.service.deleteById(trackItemId); | ||
} | ||
|
||
startNewLogItem(oldItem: any) { | ||
console.log("startNewLogItem"); | ||
|
||
let newItem: any = {}; | ||
newItem.app = oldItem.app || "WORK"; | ||
newItem.taskName = "LogTrackItem"; | ||
newItem.color = oldItem.color; | ||
newItem.title = oldItem.title; | ||
newItem.beginDate = moment().toDate(); | ||
newItem.endDate = moment().add(60, 'seconds').toDate(); | ||
|
||
ipcRenderer.send('start-new-log-item', newItem); | ||
|
||
} | ||
|
||
stopRunningLogItem(runningLogItemId) { | ||
console.log("stopRunningLogItem", runningLogItemId); | ||
ipcRenderer.send('end-running-log-item'); | ||
} | ||
|
||
updateColorForApp(appName, color) { | ||
return this.service.updateColorForApp(appName, color); | ||
} | ||
|
||
findAllDayItems(from, to, taskName): Promise<any> { | ||
return this.service.findAllDayItems(from, to, taskName); | ||
} | ||
|
||
findAllFromDay(from: Date, type: string): Promise<any> { | ||
return this.service.findAllFromDay(from, type); | ||
} | ||
|
||
findFirstLogItems(): Promise<any> { | ||
return this.service.findFirstLogItems(); | ||
} | ||
|
||
createItem(trackItem): Promise<any> { | ||
return this.service.createTrackItem(trackItem); | ||
} | ||
|
||
updateItem(trackItem): Promise<any> { | ||
return this.service.updateItem(trackItem); | ||
} | ||
|
||
deleteById(trackItemId) { | ||
return this.service.deleteById(trackItemId); | ||
} | ||
deleteByIds(trackItemId) { | ||
return this.service.deleteByIds(trackItemId); | ||
} | ||
|
||
startNewLogItem(oldItem: any) { | ||
console.log('startNewLogItem'); | ||
|
||
let newItem: any = {}; | ||
newItem.app = oldItem.app || 'WORK'; | ||
newItem.taskName = 'LogTrackItem'; | ||
newItem.color = oldItem.color; | ||
newItem.title = oldItem.title; | ||
newItem.beginDate = moment().toDate(); | ||
newItem.endDate = moment() | ||
.add(60, 'seconds') | ||
.toDate(); | ||
|
||
ipcRenderer.send('start-new-log-item', newItem); | ||
} | ||
|
||
stopRunningLogItem(runningLogItemId) { | ||
console.log('stopRunningLogItem', runningLogItemId); | ||
ipcRenderer.send('end-running-log-item'); | ||
} | ||
|
||
updateColorForApp(appName, color) { | ||
return this.service.updateColorForApp(appName, color); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.