diff --git a/app/tray.js b/app/tray.js
index 46702eae..b1121703 100755
--- a/app/tray.js
+++ b/app/tray.js
@@ -6,18 +6,19 @@ var config = require('./config')
* Docs:
* https://github.com/maxogden/menubar
*/
- var mb = menubar({
- dir: path.join(config.pluginsPath, 'tray'),
- icon: path.join(config.root, 'shared/img/icon/timetracker_icon.png'),
- preloadWindow: true,
- width: 300,
- height: 400,
- showDock: true
+var mb = menubar({
+ dir: path.join(config.pluginsPath, 'tray'),
+ icon: path.join(config.root, 'shared/img/icon/timetracker_icon.png'),
+ preloadWindow: true,
+ width: 300,
+ height: 400,
+ showDock: true
})
mb.on('after-create-window', function () {
- //mb.window.openDevTools();
+ //mb.window.openDevTools();
});
-mb.on('ready', function () {})
+mb.on('ready', function () {
+})
module.exports = mb
diff --git a/plugins/tray/app/trackItem/trackItem.list.controller.js b/plugins/tray/app/trackItem/trackItem.list.controller.js
index c045a2f3..15f01978 100755
--- a/plugins/tray/app/trackItem/trackItem.list.controller.js
+++ b/plugins/tray/app/trackItem/trackItem.list.controller.js
@@ -2,6 +2,68 @@
angular.module('trayApp')
- .controller('TrackItemListController', function (TrackItemService, $rootScope) {
+ .controller('TrackItemListController', function (TrackItemService, $rootScope, $scope) {
var ctrl = this;
+ ctrl.trackItems = [];
+
+ var today = moment().startOf('day');
+
+ ctrl.loading = false;
+ ctrl.list = function () {
+ console.log("Refresh data");
+
+ ctrl.loading = true;
+ TrackItemService.findAll({
+ limit: 10,
+ orderBy: [
+ ['beginDate', 'DESC']
+ ], where: {
+ taskName: {
+ '==': 'LogTrackItem'
+ }
+ }
+ }).then(function (items) {
+ ctrl.trackItems = items;
+ ctrl.loading = false;
+ items.forEach(function (item) {
+ item.timeDiffInMs = moment(item.endDate).diff(item.beginDate);
+ item.duration = moment.duration(item.endDate - item.beginDate);
+ });
+ $rootScope.$apply();
+ });
+ };
+
+
+ ctrl.startNewLogItem = function (oldItem) {
+ console.log("startNewLogItem");
+
+ var newItem = {};
+ newItem.app = "Default";
+ newItem.taskName = "LogTrackItem";
+ newItem.color = oldItem.color;
+ newItem.title = oldItem.title;
+ newItem.beginDate = moment().toDate();
+ newItem.endDate = moment().add(60, 'seconds').toDate();
+
+ TrackItemService.create(newItem).then(function (item) {
+ console.log("Created newItem to DB:", item);
+
+ //$scope.$broadcast('addItemToTimeline', item);
+ ctrl.runningLogItem = item;
+ $scope.$apply();
+ });
+ };
+
+ ctrl.stopRunningLogItem = function () {
+ console.log("startNewLogItem");
+
+ TrackItemService.update(ctrl.runningLogItem.id, {endDate: new Date()}).then(function (item) {
+ console.log("Updated trackitem to DB:", item);
+
+ ctrl.runningLogItem = null;
+ $scope.$apply();
+ });
+ };
+
+ ctrl.list();
});
diff --git a/plugins/tray/app/trackItem/trackItem.list.html b/plugins/tray/app/trackItem/trackItem.list.html
index e69de29b..a7226ed4 100755
--- a/plugins/tray/app/trackItem/trackItem.list.html
+++ b/plugins/tray/app/trackItem/trackItem.list.html
@@ -0,0 +1,37 @@
+
+
+
+
+
{{trackItemCtrl.runningLogItem.title}}
+
+
{{trackItemCtrl.runningLogItem.beginDate | date: 'yyyy.MM.dd HH:mm'}} -
+ {{trackItemCtrl.runningLogItem.endDate | date: 'yyyy.MM.dd HH:mm'}}
+
+
+
+ Stop task
+
+ stop
+
+
+
+
+
No running tasks
+
+
+ Last tasks
+
+
+
{{item.title}}
+
+
{{item.beginDate | date: 'yyyy.MM.dd HH:mm'}} - {{item.endDate | date: 'yyyy.MM.dd HH:mm'}}
+
+
+
+ Start task
+
+ play_circle_filled
+
+
+
+
\ No newline at end of file
diff --git a/plugins/tray/app/trackItem/trackItem.routes.js b/plugins/tray/app/trackItem/trackItem.routes.js
index ef2c8cf8..28fbc6a1 100755
--- a/plugins/tray/app/trackItem/trackItem.routes.js
+++ b/plugins/tray/app/trackItem/trackItem.routes.js
@@ -6,7 +6,7 @@ angular.module('trayApp.trackItem')
.state('app.trackItem', {
url: '/trackItem',
abstract: true,
- template: ''
+ template: ''
})
.state('app.trackItem.list', {
url: '/list?search',
diff --git a/plugins/tray/app/trackItem/trackItem.service.js b/plugins/tray/app/trackItem/trackItem.service.js
index 6b19bb15..7f4033e2 100755
--- a/plugins/tray/app/trackItem/trackItem.service.js
+++ b/plugins/tray/app/trackItem/trackItem.service.js
@@ -1,6 +1,6 @@
'use strict';
angular.module('trayApp')
.service('TrackItemService', function () {
-
- return require('remote').getGlobal('trackItemServiceInst');
+ var service = require('remote').getGlobal('BackgroundService').getTrackItemService();
+ return service;
});
diff --git a/plugins/tray/assets/style.css b/plugins/tray/assets/style.css
index 70c186b2..7f5665d3 100755
--- a/plugins/tray/assets/style.css
+++ b/plugins/tray/assets/style.css
@@ -1,51 +1,56 @@
html, body {
- font-family: "Roboto", Arial, sans-serif;
- background: #fff;
- font-size: 14px;
- font-weight: 300;
- overflow-x: hidden;
+ font-family: "Roboto", Arial, sans-serif;
+ background: #fff;
+ font-size: 14px;
+ font-weight: 300;
+ overflow-x: hidden;
}
/**
* App-wide Styles
*/
* {
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box; }
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
a {
- text-decoration: none;
- cursor: pointer;
- color: #337ab7;
- text-decoration: none; }
+ text-decoration: none;
+ cursor: pointer;
+ color: #337ab7;
+ text-decoration: none;
+}
p {
- margin: 0 0 10px; }
+ margin: 0 0 10px;
+}
fieldset {
- min-width: 0;
- padding: 0;
- margin: 0;
- border: 0; }
+ min-width: 0;
+ padding: 0;
+ margin: 0;
+ border: 0;
+}
.text-center {
- text-align: center; }
-
+ text-align: center;
+}
a.md-button {
- border-bottom: none; }
+ border-bottom: none;
+}
-.main-div{
- overflow-x: hidden;
+.main-div {
+ overflow-x: hidden;
}
/**
* md-dialog override
*/
md-dialog md-dialog-content.without-padding {
- padding: 0;
+ padding: 0;
}
/**
@@ -56,264 +61,38 @@ md-dialog md-dialog-content.without-padding {
box-shadow: none; }
*/
-
/**
* Util
*/
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
- display: none !important; }
+ display: none !important;
+}
.no-transition {
- -webkit-transition: none !important;
- -moz-transition: none !important;
- -ms-transition: none !important;
- -o-transition: none !important;
- transition: none !important; }
-
-/**
-* autocomplete custom template
-*/
-.autocomplete-custom-template li {
- border-bottom: 1px solid #ccc;
- height: auto;
- padding-top: 8px;
- padding-bottom: 8px;
- white-space: normal;
- line-height: 17px; }
-
-.autocomplete-custom-template li:last-child {
- border-bottom-width: 0; }
-
-.autocomplete-custom-template .item-title,
-.autocomplete-custom-template .item-metadata {
- display: block;
- line-height: 2; }
-
-.autocomplete-custom-template .item-title md-icon {
- height: 18px;
- width: 18px; }
-
-.autocomplete-custom-template .not-active {
- text-decoration: line-through; }
-
-
-/**
-* ng-table bootstrap overrides
-*/
-.embedded-content .list-search-table {
- background-color: #e3f2fd; }
-
-.table-responsive {
- min-height: .01%;
- overflow-x: auto; }
-
-.table {
- width: 100%;
- max-width: 100%; }
-
-.table > tbody > tr > td, .table > tfoot > tr > td {
- padding: 8px 15px;
- border-top: 1px solid #eaeff0;
- max-width: 200px;
- overflow: hidden;
- white-space: nowrap; }
-
-.table > thead > tr > th {
- padding: 8px 15px;
- border-bottom: 1px solid #eaeff0; }
-
-.table .action-buttons a {
- border-bottom: none; }
-
-.pagination {
- display: inline-block;
- padding-left: 0;
- margin: 20px 0;
- border-radius: 4px;
- margin-top: 0;
- margin-bottom: 10px; }
-
-.pagination > li {
- display: inline; }
-
-.pagination > li:first-child > a, .pagination > li:first-child > span {
- margin-left: 0;
- border-top-left-radius: 4px;
- border-bottom-left-radius: 4px; }
-
-.pagination > .disabled > a, .pagination > .disabled > a:focus, .pagination > .disabled > a:hover, .pagination > .disabled > span, .pagination > .disabled > span:focus, .pagination > .disabled > span:hover {
- color: #777;
- cursor: not-allowed;
- background-color: #fff;
- border-color: #ddd; }
-
-.pagination > li > a, .pagination > li > span {
- position: relative;
- float: left;
- padding: 6px 12px;
- margin-left: -1px;
- line-height: 1.42857143;
- color: #337ab7;
- text-decoration: none;
- background-color: #fff;
- border: 1px solid #ddd; }
-
-.pull-right {
- float: right !important; }
-
-.btn-group, .btn-group-vertical {
- position: relative;
- display: inline-block;
- vertical-align: middle; }
-
-.btn-group > .btn:last-child:not(:first-child), .btn-group > .dropdown-toggle:not(:first-child) {
- border-top-left-radius: 0;
- border-bottom-left-radius: 0; }
-
-.btn-group .btn + .btn, .btn-group .btn + .btn-group, .btn-group .btn-group + .btn, .btn-group .btn-group + .btn-group {
- margin-left: -1px; }
-
-.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {
- border-top-right-radius: 0;
- border-bottom-right-radius: 0; }
-
-.btn-group > .btn:first-child {
- margin-left: 0; }
-
-.btn-group-vertical > .btn.active, .btn-group-vertical > .btn:active, .btn-group-vertical > .btn:focus, .btn-group-vertical > .btn:hover, .btn-group > .btn.active, .btn-group > .btn:active, .btn-group > .btn:focus, .btn-group > .btn:hover {
- z-index: 2; }
-
-.btn-group-vertical > .btn, .btn-group > .btn {
- position: relative;
- float: left; }
-
-.btn-default.active, .btn-default:active, .open > .dropdown-toggle.btn-default {
- background-image: none; }
-
-.btn-default.active, .btn-default.focus, .btn-default:active, .btn-default:focus, .btn-default:hover, .open > .dropdown-toggle.btn-default {
- color: #333;
- background-color: #e6e6e6;
- border-color: #adadad; }
-
-.btn.active, .btn:active {
- background-image: none;
- outline: 0;
- -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
- box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); }
-
-.btn-default {
- color: #333;
- background-color: #fff;
- border: 1px solid #ccc; }
-
-.btn {
- display: inline-block;
- padding: 6px 12px;
- margin: 0;
- overflow: visible;
- margin-bottom: 0;
- font-size: 14px;
- font-weight: 400;
- line-height: 1.42857143;
- text-align: center;
- white-space: nowrap;
- vertical-align: middle;
- -ms-touch-action: manipulation;
- touch-action: manipulation;
- cursor: pointer;
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- background-image: none;
- border-radius: 4px; }
-
-.dropdown-menu {
- position: absolute;
- top: 100%;
- left: 0;
- z-index: 1000;
- display: none;
- float: left;
- min-width: 160px;
- padding: 5px 0;
- margin: 2px 0 0;
- list-style: none;
- font-size: 14px;
- background-color: #fff;
- border: 1px solid #ccc;
- border: 1px solid rgba(0, 0, 0, 0.15);
- border-radius: 4px;
- -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
- box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
- background-clip: padding-box; }
-
-.pull-left {
- float: left !important; }
-
-.btn-sm, .btn-group-sm > .btn {
- padding: 5px 10px;
- font-size: 12px;
- line-height: 1.5;
- border-radius: 3px; }
-
-.btn-default {
- color: #333;
- background-color: #fff;
- border-color: #ccc; }
-
-.btn {
- display: inline-block;
- margin-bottom: 0;
- font-weight: 400;
- text-align: center;
- vertical-align: middle;
- cursor: pointer;
- background-image: none;
- border: 1px solid transparent;
- white-space: nowrap;
- padding: 6px 12px;
- font-size: 14px;
- line-height: 1.42857143;
- border-radius: 4px;
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none; }
-
-.btn-info:hover, .btn-info:focus, .btn-info:active, .btn-info.active, .btn-info.btn-today, .open .dropdown-toggle.btn-info {
- color: #fff;
- background-color: #39b3d7; }
-
-.btn-primary {
- color: #fff;
- background-color: #337ab7; }
-
-.btn-primary:hover, .btn-primary:focus, .btn-primary.focus, .btn-primary:active, .btn-primary.active, .open > .dropdown-toggle.btn-primary {
- color: #fff;
- background-color: #286090; }
-
-.btn-primary:active, .btn-primary.active, .open > .dropdown-toggle.btn-primary {
- background-image: none; }
-
-.btn-primary.disabled, .btn-primary[disabled], fieldset[disabled] .btn-primary, .btn-primary.disabled:hover, .btn-primary[disabled]:hover, fieldset[disabled] .btn-primary:hover, .btn-primary.disabled:focus, .btn-primary[disabled]:focus, fieldset[disabled] .btn-primary:focus, .btn-primary.disabled.focus, .btn-primary[disabled].focus, fieldset[disabled] .btn-primary.focus, .btn-primary.disabled:active, .btn-primary[disabled]:active, fieldset[disabled] .btn-primary:active, .btn-primary.disabled.active, .btn-primary[disabled].active, fieldset[disabled] .btn-primary.active {
- background-color: #337ab7; }
-
-.btn-info {
- color: #fff;
- background-color: #5bc0de; }
+ -webkit-transition: none !important;
+ -moz-transition: none !important;
+ -ms-transition: none !important;
+ -o-transition: none !important;
+ transition: none !important;
+}
+.tray-item{
+ min-height: 30px;
+}
-.input-error-msg {
- color: #d50000;
- white-space: nowrap;
- overflow: visible;
- font-size: 12px;
- line-height: 14px;
- position: relative;
- -webkit-order: 4;
- -ms-flex-order: 4;
- order: 4;
- clear: left; }
+.tray-item .md-list-item-text h3 {
+ font-size: 12px;
+ font-weight: 400;
+ letter-spacing: .010em;
+ margin: 0;
+ line-height: 1.15;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
-.error-input-wrapper {
- padding-left: 10px; }
+.tray-item .md-list-item-text p {
+ font-size: 10px;
+ line-height: 1.05;
+ margin: 0;
+ color: rgba(0,0,0,0.54);
+}