Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the fork #1

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash

git_logs=$(git log `git describe --tags --abbrev=0 HEAD^`..HEAD --oneline)

git_logs_features=$(grep 'feature/' --ignore-case <<< "$git_logs")

if [ "$git_logs_features" ]
then
echo ""
echo "## Features"
while IFS= read -r line
do
echo "- $line"
done <<< "$git_logs_features"
fi

git_logs_layouts=$(grep 'layout/' --ignore-case <<< "$git_logs")

if [ "$git_logs_layouts" ]
then
echo ""
echo "## Layouts"
while IFS= read -r line
do
echo "- $line"
done <<< "$git_logs_layouts"
fi

git_logs_bugfixes=$(grep 'bugfix/' --ignore-case <<< "$git_logs")

if [ "$git_logs_bugfixes" ]
then
echo ""
echo "## Bug fixes"
while IFS= read -r line
do
echo "- $line"
done <<< "$git_logs_bugfixes"
fi

git_logs_developments=$(grep 'development/' --ignore-case <<< "$git_logs")

if [ "$git_logs_developments" ]
then
echo ""
echo "## Development"
while IFS= read -r line
do
echo "- $line"
done <<< "$git_logs_developments"
fi
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "time-tracker",
"version": "0.1.1",
"version": "0.1.3",
"license": "MIT",
"author": "Mirosław Bogacz - miroslaw.bogacz@hotmail.com",
"scripts": {
Expand Down
54 changes: 48 additions & 6 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,29 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Store } from '@ngrx/store';
import { JiraRequestOptionsService } from './shared/jira-api/services/jira-request-options.service';
import * as accountActions from './account/actions/account.actions';

describe('AppComponent', () => {
let fixture;
let app;
let storeBehaviorSubject;

const mockedStore: any = jasmine
.createSpyObj('mockedStore', [ 'select' ]);
.createSpyObj('mockedStore', [ 'select', 'dispatch' ]);

const mockedJiraRequestOptionsService = jasmine
.createSpyObj('mockedJiraRequestOptionsService', [ 'setOptions' ]);

const mockedAccount = {
www: 'http://www.test-www.com',
username: 'test-username',
token: 'test-token',
};

beforeEach(async(() => {
mockedStore.select.and.returnValue(new BehaviorSubject({}));
storeBehaviorSubject = new BehaviorSubject(mockedAccount);

mockedStore.select.and.returnValue(storeBehaviorSubject);

TestBed.configureTestingModule({
declarations: [
Expand All @@ -31,9 +43,39 @@ describe('AppComponent', () => {
}).compileComponents();
}));

it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
beforeEach(() => {
fixture = TestBed.createComponent(AppComponent);
app = fixture.debugElement.componentInstance;
fixture.detectChanges();
});

it('should be created', () => {
expect(app).toBeTruthy();
}));
});

describe('when store return account', () => {

it('should be call JiraRequestOptionsService.setOptions', () => {
expect(mockedJiraRequestOptionsService.setOptions)
.toHaveBeenCalledWith({
protocol: 'http',
port: null,
domain: 'www.test-www.com',
authentication: 'Basic Auth',
token: 'test-token',
});
});
});

describe('when logout has been call', () => {

beforeEach(() => {
app.logout();
});

it('should be call dispatch with action', () => {
expect(mockedStore.dispatch).toHaveBeenCalledWith(new accountActions.Logout());
});

});
});
2 changes: 1 addition & 1 deletion src/app/core/helpers/get-errors-from-payload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('getErrorsFromPayload', () => {
it('should return empty array', () => {
const payload = {};
const result = getErrorsFromPayload(payload);
console.log(result);

expect(result).toEqual([]);
});
});
Expand Down
57 changes: 57 additions & 0 deletions src/app/core/helpers/get-header-options-by-account.helper.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { getHeaderOptionsByAccount } from './get-header-options-by-account.helper';
import { IAccount } from '../../account/models/i-account.model';
import { IJiraRequestOptions } from '../../shared/jira-api/models/jira-request-options.interface';

describe('getHeaderOptionsByAccount', () => {

describe('when has been call without port', () => {

it ('should return value', () => {
const mockedInput: IAccount = {
www: 'http://www.example.com',
username: 'test-username',
auth: 'Basic Auth',
token: 'test-token',
};

const mockedResult: IJiraRequestOptions = <IJiraRequestOptions>{
protocol: 'http',
port: null,
domain: 'www.example.com',
authentication: mockedInput.auth,
token: mockedInput.token,
};

const result: IJiraRequestOptions = getHeaderOptionsByAccount(mockedInput);

expect(result).toEqual(mockedResult);
});

});

describe('when has been call with port', () => {

it ('should return value', () => {
const mockedInput: IAccount = {
www: 'http://www.example.com:8080',
username: 'test-username',
auth: 'Basic Auth',
token: 'test-token',
};

const mockedResult: IJiraRequestOptions = <IJiraRequestOptions>{
protocol: 'http',
port: 8080,
domain: 'www.example.com',
authentication: mockedInput.auth,
token: mockedInput.token,
};

const result: IJiraRequestOptions = getHeaderOptionsByAccount(mockedInput);

expect(result).toEqual(mockedResult);
});

});

});
4 changes: 2 additions & 2 deletions src/app/core/helpers/get-header-options-by-account.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { IAccount } from '../../account/models/i-account.model';

export function getHeaderOptionsByAccount(options: IAccount): IJiraRequestOptions {
const url: URL = new URL(options.www);
const { protocol, host, port } = url;
const { protocol, hostname, port } = url;

return {
protocol: protocol.replace(':', '') as any,
port: Number(port) || null,
domain: host,
domain: hostname,
authentication: 'Basic Auth',
token: options.token,
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<div class="item" [ngClass]="{ 'item--active': project.isSelected }" (click)="onChangeProject($event)">
<span class="item__label">{{ project.key }}</span>
<img [src]="project.avatarUrls['48x48']" class="item__image">
<div class="project-avatar"
[ngClass]="{ 'project-avatar--active': project.isSelected }"
(click)="onChangeProject($event)">
<span class="project-avatar__label">{{ project.key }}</span>
</div>
Original file line number Diff line number Diff line change
@@ -1,42 +1 @@
.item {
width: 60px;
height: 60px;
margin: 10px auto;
border: 2px solid #ffffff;
box-shadow: 0 0 4px #666666;
border-radius: 50%;
cursor: pointer;
position: relative;
overflow: hidden;

&:hover, &.item--active {
.item__image {
opacity: 1;
}
}
}

.item__image {
opacity: .70;
transition: .3s all ease-in-out;
}

.item__image, .item__label {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border: none;
z-index: 1;
}

.item__label {
color: #fff;
display: flex;
align-items: center;
justify-content: center;
z-index: 2;
text-shadow: 1px 1px #000;
font-weight: 700;
}
@import '../../../../../assets/scss/project-avatar';
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';
export class ProjectItemComponent implements OnInit {

@Input() public project: any;

@Output() public changeProject: EventEmitter<string> = new EventEmitter();

constructor() { }
Expand Down
4 changes: 3 additions & 1 deletion src/app/issues/issues.component.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../../assets/scss/variables';

:host {
height: 100%;
position: relative;
Expand All @@ -11,7 +13,7 @@
position: absolute;
top: 0;
left: 0;
background: #247BA0;
background: $sidebar-background-color;
}

.content {
Expand Down
24 changes: 23 additions & 1 deletion src/app/worklogs/actions/worklogs-list.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export const REMOVE_WORKLOG = '[Worklogs] [Worklogs list] remove worklog';
export const REMOVE_WORKLOG_SUCCESS = '[Worklogs] [Worklogs list] remove worklog success';
export const REMOVE_WORKLOG_ERROR = '[Worklogs] [Worklogs list] remove worklog error';

export const COPY_WORKLOG = '[Worklogs] [Worklogs list] copy worklog';
export const COPY_WORKLOG_SUCCESS = '[Worklogs] [Worklogs list] copy worklog success';
export const COPY_WORKLOG_ERROR = '[Worklogs] [Worklogs list] copy worklog error';

export class FetchWorklogsList implements Action {
readonly type = FETCH_WORKLOGS_LIST;
constructor(public payload: any) {}
Expand Down Expand Up @@ -57,6 +61,21 @@ export class RemoveWorklogError implements Action {
constructor(public payload: any) {}
}

export class CopyWorklog implements Action {
readonly type = COPY_WORKLOG;
constructor(public payload: any) {}
}

export class CopyWorklogSuccess implements Action {
readonly type = COPY_WORKLOG_SUCCESS;
constructor(public payload: any) {}
}

export class CopyWorklogError implements Action {
readonly type = COPY_WORKLOG_ERROR;
constructor(public payload: any) {}
}

export type WorklogsListActions =
FetchWorklogsList
| FetchWorklogsListSuccess
Expand All @@ -66,4 +85,7 @@ export type WorklogsListActions =
| SyncWorklogError
| RemoveWorklog
| RemoveWorklogSuccess
| RemoveWorklogError;
| RemoveWorklogError
| CopyWorklog
| CopyWorklogSuccess
| CopyWorklogError;
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

<div class="col col-6">
<button class="btn btn-success"
(click)="onSaveClick()"
[disabled]="timeSpentControl.invalid || dateControl.invalid"
><i class="fa fa-save"></i></button>
(click)="onSaveClick()"
[disabled]="timeSpentControl.invalid || dateControl.invalid">
<i class="fa fa-save"></i>
</button>

<button class="btn btn-danger" (click)="onRemoveClick()"><i class="fa fa-trash"></i></button>
<button class="btn btn-warning" (click)="hideEdit()"><i class="fa fa-ban"></i></button>
Expand All @@ -22,6 +23,10 @@
</div>

<p>
<button class="btn btn-sm btn-primary" (click)="onClickCopy()">
<i class="fa fa-copy"></i>
</button>

<button class="btn btn-sm btn-info" (click)="showEdit()"><i class="fa fa-pencil"></i></button>
{{ worklog.issue.key }} - {{ worklog.issue.fields?.summary }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export class WorklogItemComponent implements OnInit {

@Output() public removeClick: EventEmitter<any> = new EventEmitter();

@Output() public copyClick: EventEmitter<any> = new EventEmitter();

@Input() public worklog: any;

public isVisible = false;
Expand Down Expand Up @@ -75,4 +77,8 @@ export class WorklogItemComponent implements OnInit {
this.isVisible = false;
}

public onClickCopy(): void {
this.copyClick.emit(this.worklog);
}

}
Loading