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 26c540d..2450b79 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 83dea46..d18c5ea 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(): Promise
{
+ 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;
}