From 99bc5a4fb3d12f6e88821737e2d2dd99dd415421 Mon Sep 17 00:00:00 2001 From: Rafal Korszun Date: Thu, 1 Feb 2018 07:14:18 +0100 Subject: [PATCH 1/5] change clickable area --- src/app/components/tracking/dashboard/dashboard.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/tracking/dashboard/dashboard.component.html b/src/app/components/tracking/dashboard/dashboard.component.html index 1ab6a4b..6c29f51 100644 --- a/src/app/components/tracking/dashboard/dashboard.component.html +++ b/src/app/components/tracking/dashboard/dashboard.component.html @@ -2,7 +2,7 @@
-

{{ agile.name }}

+

{{ agile.name }}

From 2e81f6501cb44138ebf18e0c49496ed55de41793 Mon Sep 17 00:00:00 2001 From: Kamil Dobrzynski Date: Thu, 1 Feb 2018 10:47:55 +0100 Subject: [PATCH 2/5] remove unused spinner module --- package.json | 23 +++++++++++------------ src/app/app.module.ts | 9 --------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index a148909..24882f1 100644 --- a/package.json +++ b/package.json @@ -44,41 +44,38 @@ }, "devDependencies": { "@angular/animations": "^4.4.3", + "@angular/cli": "1.4.3", "@angular/common": "4.4.3", + "@angular/compiler": "4.4.3", + "@angular/compiler-cli": "4.4.3", "@angular/core": "4.4.3", "@angular/forms": "4.4.3", "@angular/http": "4.4.3", "@angular/platform-browser": "^4.4.3", "@angular/platform-browser-dynamic": "^4.4.3", "@angular/router": "4.4.3", - "core-js": "2.4.1", - "font-awesome": "^4.7.0", - "ionicons": "^3.0.0", - "ngx-loading": "^1.0.8", - "rxjs": "5.4.3", - "zone.js": "0.8.17", - "@angular/compiler": "4.4.3", - "electron-builder": "^19.37.2", - "electron-squirrel-startup": "^1.0.0", - "@angular/cli": "1.4.3", - "@angular/compiler-cli": "4.4.3", "@types/core-js": "0.9.36", "@types/jasmine": "2.5.54", "@types/node": "7.0.7", "autoprefixer": "7.1.4", "codelyzer": "3.2.0", "copyfiles": "1.2.0", + "core-js": "2.4.1", "cross-env": "5.0.5", "css-loader": "0.28.7", "cssnano": "3.10.0", "electron": "1.7.11", + "electron-builder": "^19.37.2", "electron-packager": "9.1.0", "electron-rebuild": "^1.6.0", "electron-reload": "1.2.1", + "electron-squirrel-startup": "^1.0.0", "electron-winstaller": "^2.6.3", "exports-loader": "0.6.4", "file-loader": "0.11.2", + "font-awesome": "^4.7.0", "html-loader": "0.5.1", + "ionicons": "^3.0.0", "istanbul-instrumenter-loader": "3.0.0", "jasmine-core": "2.8.0", "jasmine-spec-reporter": "4.2.1", @@ -98,6 +95,7 @@ "postcss-url": "7.1.2", "protractor": "5.1.2", "raw-loader": "0.5.1", + "rxjs": "5.4.3", "sass-loader": "6.0.6", "script-loader": "0.7.1", "source-map-loader": "0.2.1", @@ -109,7 +107,8 @@ "url-loader": "0.5.9", "webdriver-manager": "12.0.6", "webpack": "3.6.0", - "webpack-dev-server": "2.8.2" + "webpack-dev-server": "2.8.2", + "zone.js": "0.8.17" }, "license": "Apache-2.0" } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index cffa1ce..e91f851 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -25,7 +25,6 @@ import { DatabaseService } from './services/database.service' import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { LoadingModule, ANIMATION_TYPES } from 'ngx-loading'; import { HttpService } from './services/http.service'; import { SecondsToTimePipe } from './pipes/seconds-to-time.pipe'; @@ -65,14 +64,6 @@ import { LoadingSpinnerComponent } from './components/loading-spinner/loading-sp FormsModule, HttpModule, AppRoutingModule, - LoadingModule.forRoot({ - animationType: ANIMATION_TYPES.threeBounce, - backdropBackgroundColour: 'rgba(0,0,0,0.1)', - backdropBorderRadius: '4px', - primaryColour: '#ffffff', - secondaryColour: '#ffffff', - tertiaryColour: '#ffffff' - }) ], providers: [ ElectronService, From 38d0a3bf6db05ddf2e40895223dc79113e059e89 Mon Sep 17 00:00:00 2001 From: Rafal Korszun Date: Thu, 1 Feb 2018 12:09:45 +0100 Subject: [PATCH 3/5] add api version info --- src/app/services/api.service.ts | 38 +++++++++++++++++++------------- src/app/services/http.service.ts | 4 ++++ 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/app/services/api.service.ts b/src/app/services/api.service.ts index 28da51f..89d2e1f 100644 --- a/src/app/services/api.service.ts +++ b/src/app/services/api.service.ts @@ -4,9 +4,7 @@ import 'rxjs/add/operator/map'; import { HttpService } from '../services/http.service' import { AccountService } from './account.service' import { RemoteAccount, UserData, IssueDetails, WorkItemData } from 'app/models/RemoteAccount'; -import { error } from 'util'; -import { reject } from 'q'; -import { resolve } from 'dns'; + @Injectable() export class ApiService { @@ -27,7 +25,7 @@ export class ApiService { return; } - getAllProjects = () => { + public getAllProjects = () => { return new Promise(resolve => { this.UseAccount().then(() => { this.http.get('/rest/admin/project') @@ -41,6 +39,16 @@ export class ApiService { }); } + public getVersionInfo(){ + return new Promise((resolve, reject) => { + this.http.getRawUrl("https://api.github.com/repos/kleder/timetracker/releases/latest") + .map(res => res.json()) + .subscribe(data => { + resolve(data); + }, err => reject(err)) + }) + } + private encodeQueryData(data) { let ret = []; for (let d in data) @@ -48,7 +56,7 @@ export class ApiService { return ret.join('&'); } - executeCommand(id: string, command: any) { + public executeCommand(id: string, command: any) { return new Promise((resolve, reject) => { let options = new RequestOptions(); options.headers = new Headers(); @@ -59,7 +67,7 @@ export class ApiService { }); } - createIssueOnBoard(data, BoardName, state) { + public createIssueOnBoard(data, BoardName, state) { let id = ""; return new Promise((resolve, reject) => { this.UseAccount().then(() => { @@ -76,7 +84,7 @@ export class ApiService { .then(() => {this.executeCommand(id, {'command': 'State ' + state})} ) } - getAllAgiles = () => { + public getAllAgiles = () => { return new Promise(resolve => { this.UseAccount().then(() => { this.http.get('/rest/admin/agile') @@ -90,7 +98,7 @@ export class ApiService { }); } - getIssuesByProject = (id) => { + public getIssuesByProject = (id) => { return new Promise(resolve => { this.UseAccount().then(() => { this.http.get('/rest/issue/byproject/' + id + '?filter=for%3A+me') @@ -102,7 +110,7 @@ export class ApiService { }) } - getIssuesByAgile = (agileName) => { + public getIssuesByAgile = (agileName) => { return new Promise(resolve => { this.UseAccount().then(() => { this.http.get('/rest/issue?filter=for:me+Board+' + agileName + ':+{Current+sprint}+%23Unresolved') @@ -114,7 +122,7 @@ export class ApiService { }) } - getIssue = (issueId) => { + public getIssue = (issueId) => { return new Promise(resolve => { this.UseAccount().then(() => { this.http.get('/rest/issue/' + issueId + '?wikifyDescription=true') @@ -126,7 +134,7 @@ export class ApiService { }) } - getSprintInfo = (agile) => { + public getSprintInfo = (agile) => { let query = agile.url.split("/youtrack")[1] return new Promise(resolve => { this.UseAccount().then(() => { @@ -139,7 +147,7 @@ export class ApiService { }) } - createNewWorkItem = (data: WorkItemData) => { + public createNewWorkItem = (data: WorkItemData) => { let newItem = { date: data.date, duration: Math.round(data.duration / 60), @@ -158,7 +166,7 @@ export class ApiService { }) } - getWorkItem = (issueId) => { + public getWorkItem = (issueId) => { return new Promise(resolve => { this.UseAccount().then(() => { this.http.get('/rest/issue/' + issueId + '/timetracking/workitem') @@ -170,7 +178,7 @@ export class ApiService { }) } - getTimetrackingWorkTypes = (projectId) => { + public getTimetrackingWorkTypes = (projectId) => { return new Promise(resolve => { this.UseAccount().then(() => { this.http.get('/rest/admin/project/' + projectId + '/timetracking/worktype') @@ -182,7 +190,7 @@ export class ApiService { }) } - getCurrentUser(remoteAccount: RemoteAccount) { + public getCurrentUser(remoteAccount: RemoteAccount) { this.UseAccount(remoteAccount) this.http.UseAccount(remoteAccount) return new Promise((resolve, reject) => { diff --git a/src/app/services/http.service.ts b/src/app/services/http.service.ts index 950b099..31da9cb 100644 --- a/src/app/services/http.service.ts +++ b/src/app/services/http.service.ts @@ -25,6 +25,10 @@ export class HttpService extends Http { super(backend, defaultOptions) } + public getRawUrl(url: string){ + return super.get(url); + } + public UseAccount(remoteAccount : RemoteAccount) { this.remoteAccount = remoteAccount; } From a412f31df8fa735e6834cfe9fb2ea067d5b15e45 Mon Sep 17 00:00:00 2001 From: Rafal Korszun Date: Thu, 1 Feb 2018 14:11:43 +0100 Subject: [PATCH 4/5] added new version indicator due to #28 --- package.json | 2 +- src/app/app.module.ts | 2 ++ .../edit-account/edit-account.component.html | 9 +++++++- .../edit-account/edit-account.component.scss | 21 ++++++++++++++++++- .../edit-account/edit-account.component.ts | 11 ++++++++++ .../workspace/workspace.component.html | 2 +- .../workspace/workspace.component.scss | 6 ++++++ .../workspace/workspace.component.ts | 20 ++++++++++++++---- src/app/pipes/nl2br.pipe.ts | 11 ++++++++++ src/app/services/api.service.ts | 2 +- 10 files changed, 77 insertions(+), 9 deletions(-) create mode 100644 src/app/pipes/nl2br.pipe.ts diff --git a/package.json b/package.json index a148909..70c39d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "T-Rec", - "version": "1.0.2", + "version": "1.1.0", "description": "T-Rec time tracker is built for speed and live work item update in youtrack system.", "homepage": "", "author": { diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9b918e3..21928c5 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -39,6 +39,7 @@ import { ToasterService } from './services/toaster.service'; import { ToolbarComponent } from './components/toolbar/toolbar.component'; import { SwitchAccountComponent } from './components/accounts/switch-account/switch-account.component' import { MenuService } from './services/menu.service'; +import { Nl2brPipe } from 'app/pipes/nl2br.pipe'; @NgModule({ declarations: [ @@ -48,6 +49,7 @@ import { MenuService } from './services/menu.service'; RecordsComponent, BoardsChoiceComponent, SecondsToTimePipe, + Nl2brPipe, AddAccountComponent, EditAccountComponent, EditBoardComponent, diff --git a/src/app/components/accounts/edit-account/edit-account.component.html b/src/app/components/accounts/edit-account/edit-account.component.html index a83d6a0..8776c1a 100644 --- a/src/app/components/accounts/edit-account/edit-account.component.html +++ b/src/app/components/accounts/edit-account/edit-account.component.html @@ -4,6 +4,14 @@
diff --git a/src/app/components/accounts/edit-account/edit-account.component.scss b/src/app/components/accounts/edit-account/edit-account.component.scss index 3e6b513..448434f 100644 --- a/src/app/components/accounts/edit-account/edit-account.component.scss +++ b/src/app/components/accounts/edit-account/edit-account.component.scss @@ -1,6 +1,9 @@ @import "../../../theme/colors.scss"; .container { + .new { + color: $major !important + } margin-top: 60px; width: 100%; height: 100%; @@ -46,7 +49,7 @@ font-size: 12px; font-weight: 400; letter-spacing: 1px; - cursor: default; + cursor: default; } .edit-account__form { margin-bottom: 30px; @@ -177,6 +180,22 @@ line-height: 18px; color: $white; } + .edit-account__info { + margin: 16px 0 32px; + font-family: 'Montserrat', sans-serif; + font-size: 12px; + line-height: 18px; + color: $white; + a { + cursor: pointer; + text-decoration: underline; + color: $white; + &:hover { + color: $white; + text-decoration: none; + } + } + } .edit-account__actions { margin-bottom: 50px; .edit-account__remove { diff --git a/src/app/components/accounts/edit-account/edit-account.component.ts b/src/app/components/accounts/edit-account/edit-account.component.ts index 25c110f..d7ccc3f 100644 --- a/src/app/components/accounts/edit-account/edit-account.component.ts +++ b/src/app/components/accounts/edit-account/edit-account.component.ts @@ -7,6 +7,8 @@ import { Router, ActivatedRoute } from '@angular/router'; import { RemoteAccount } from 'app/models/RemoteAccount'; import { AccountService } from '../../../services/account.service' import { ToasterService } from '../../../services/toaster.service' +import { versions } from '../../../../environments/versions' + @Component({ selector: 'app-edit-account', @@ -18,6 +20,9 @@ export class EditAccountComponent implements OnInit { public agiles: any public toasterText: string public modalText: string + public isNew = false; + public version = {name:'', published_at:'', body:''}; + constructor( public databaseService: DatabaseService, public activatedRoute: ActivatedRoute, @@ -31,6 +36,12 @@ export class EditAccountComponent implements OnInit { ngOnInit() { this.getCurrentAccount() this.getAllAgiles() + this.api.getVersionInfo().then(data => { + this.version = data; + if (data.tag_name != undefined && data.tag_name.replace("v","") !== versions.version){ + this.isNew = true + } + }) } async getCurrentAccount() { diff --git a/src/app/components/workspace/workspace.component.html b/src/app/components/workspace/workspace.component.html index 31bd04e..8085448 100644 --- a/src/app/components/workspace/workspace.component.html +++ b/src/app/components/workspace/workspace.component.html @@ -5,7 +5,7 @@
  • Records
  • diff --git a/src/app/components/workspace/workspace.component.scss b/src/app/components/workspace/workspace.component.scss index 47416a6..87a51cb 100644 --- a/src/app/components/workspace/workspace.component.scss +++ b/src/app/components/workspace/workspace.component.scss @@ -55,6 +55,12 @@ color: $custom-red; } } + .trec-icon-settings.warning { + color: $major; + &:hover { + color: $custom-red; + } + } } } .content { diff --git a/src/app/components/workspace/workspace.component.ts b/src/app/components/workspace/workspace.component.ts index 25d5eb0..bd29a4c 100644 --- a/src/app/components/workspace/workspace.component.ts +++ b/src/app/components/workspace/workspace.component.ts @@ -7,6 +7,7 @@ import { DatabaseService } from '../../services/database.service' import { ApiService } from '../../services/api.service' import { SecondsToTimePipe } from '../../pipes/seconds-to-time.pipe' import { ToasterService } from '../../services/toaster.service' +import { versions } from '../../../environments/versions' import { Router } from '@angular/router'; import { WorkItemData } from 'app/models/RemoteAccount'; @@ -30,6 +31,7 @@ export class WorkspaceComponent implements OnDestroy, OnInit { public hideHints: number secondsToTimePipe = new SecondsToTimePipe() public dbVariables: object + public differentVersion = false; constructor( public timerService: TimerService, @@ -38,7 +40,9 @@ export class WorkspaceComponent implements OnDestroy, OnInit { public api: ApiService, public router: Router, public toasterService: ToasterService - ) { } + ) { + this.checkVersion() + } ngOnInit() { this.subscribeNotificationTime() @@ -52,7 +56,15 @@ export class WorkspaceComponent implements OnDestroy, OnInit { this.alive = false } - subscribeNotificationTime() { + private checkVersion(){ + this.api.getVersionInfo().then(data => { + if (data.tag_name != undefined && data.tag_name.replace("v","") !== versions.version){ + this.differentVersion = true + } + }) + } + + private subscribeNotificationTime() { this.dataService.currentNotificationTime.takeWhile(() => this.alive).subscribe(data => { this.notificationTime = data if (this.notificationTime != undefined) { @@ -61,7 +73,7 @@ export class WorkspaceComponent implements OnDestroy, OnInit { }) } - subscribeIssueTime() { + private subscribeIssueTime() { this.dataService.currentIssueTime.takeWhile(() => this.alive).subscribe(data => { let issueTime = data["currentTime"] if (issueTime % 60 === 0) { @@ -76,7 +88,7 @@ export class WorkspaceComponent implements OnDestroy, OnInit { }) } - subscribeUnstoppedItem() { + private subscribeUnstoppedItem() { this.dataService.currentUnstoppedItem.takeWhile(() => this.alive).subscribe(data => { this.unstoppedItem = data if (Object.keys(this.unstoppedItem).length != 0) { diff --git a/src/app/pipes/nl2br.pipe.ts b/src/app/pipes/nl2br.pipe.ts new file mode 100644 index 0000000..dc0a12c --- /dev/null +++ b/src/app/pipes/nl2br.pipe.ts @@ -0,0 +1,11 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'nl2br' +}) +export class Nl2brPipe implements PipeTransform { + transform(str): any { + return str.split("\n").join("
    "); + } + +} diff --git a/src/app/services/api.service.ts b/src/app/services/api.service.ts index 89d2e1f..6144b8e 100644 --- a/src/app/services/api.service.ts +++ b/src/app/services/api.service.ts @@ -39,7 +39,7 @@ export class ApiService { }); } - public getVersionInfo(){ + public getVersionInfo(): Promise { return new Promise((resolve, reject) => { this.http.getRawUrl("https://api.github.com/repos/kleder/timetracker/releases/latest") .map(res => res.json()) From 3ed68a5576fb71a8aa5de6d8da6ab98809c49143 Mon Sep 17 00:00:00 2001 From: Rafal Korszun Date: Thu, 1 Feb 2018 14:24:18 +0100 Subject: [PATCH 5/5] open in browser download link of new version of trec app --- .../accounts/edit-account/edit-account.component.html | 2 +- .../accounts/edit-account/edit-account.component.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/components/accounts/edit-account/edit-account.component.html b/src/app/components/accounts/edit-account/edit-account.component.html index 7e52ebd..1b5145c 100644 --- a/src/app/components/accounts/edit-account/edit-account.component.html +++ b/src/app/components/accounts/edit-account/edit-account.component.html @@ -9,7 +9,7 @@
    PUBLISHED: {{version.published_at | date:"dd-MM-yyyy"}}

    - Download new version + Download new version
    diff --git a/src/app/components/accounts/edit-account/edit-account.component.ts b/src/app/components/accounts/edit-account/edit-account.component.ts index d7ccc3f..a088c64 100644 --- a/src/app/components/accounts/edit-account/edit-account.component.ts +++ b/src/app/components/accounts/edit-account/edit-account.component.ts @@ -8,6 +8,7 @@ import { RemoteAccount } from 'app/models/RemoteAccount'; import { AccountService } from '../../../services/account.service' import { ToasterService } from '../../../services/toaster.service' import { versions } from '../../../../environments/versions' +import { shell } from 'electron'; @Component({ @@ -64,6 +65,10 @@ export class EditAccountComponent implements OnInit { ) } + public async openInBrowser(url : string){ + shell.openExternal(url); + } + editNameOrUrl(account) { this.databaseService.editAccount(account).then(data => { this.toasterService.showToaster('Account updated!', "success")