Skip to content

Commit e5431bc

Browse files
mandres2015ararcossemantic-release-bot
authored
feat: TT-430 read activities localhost (#771)
* feature: TT-430 list and edit status of activities * feature: TT-430 hide add new activity in production * feat: TT-430 tests added and environment production enabled * feat: TT-430 column status change in prod or dev mode and delete is managed in backend * fix: TT-413 show projects when you do not have the latest projects (#770) * fix: TT-413 show projects when you do not have the latest projects * fix: TT-413 validate array empty * chore(release): 1.52.6 [skip ci]nn * feat: TT-430 tests added and environment production enabled * fix: TT-430 rebase with master Co-authored-by: Alexander Rafael Arcos Gómez <[email protected]> Co-authored-by: semantic-release-bot <[email protected]>
1 parent 3485aa7 commit e5431bc

File tree

9 files changed

+32660
-151
lines changed

9 files changed

+32660
-151
lines changed

package-lock.json

Lines changed: 32583 additions & 133 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"preinstall": "npx npm-force-resolutions",
66
"ng": "ng",
77
"start": "ng serve",
8-
"build": "ng build",
8+
"build": "ng build --prod",
99
"test": "ng test",
1010
"test-headless": "ng test --browsers ChromeHeadless",
1111
"ci-test": "ng test --no-watch --no-progress --browsers ChromeHeadless",

src/app/modules/activities-management/components/activity-list/activity-list.component.html

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,32 @@
44
<tr class="d-flex">
55
<th class="col-4 text-center">Activity ID</th>
66
<th class="col-4 text-center">Activity</th>
7-
<th class="col-2 text-center hidden">Options</th>
8-
<th class="col-4 text-center">Status</th>
7+
<th class="col-2 text-center" *ngIf="showOptionInDevelopment">Options</th>
8+
<th scope="col" class="col-2 text-center" *ngIf="showOptionInDevelopment">Status</th>
99
</tr>
1010
</thead>
1111
<app-loading-bar *ngIf="isLoading$ | async"></app-loading-bar>
1212
<tbody *ngIf="(isLoading$ | async) === false">
1313
<tr class="d-flex" *ngFor="let activity of activities">
1414
<td class="col-4 text-break">{{ activity.id }}</td>
1515
<td class="col-4">{{ activity.name }}</td>
16-
<td class="col-2 text-center hidden">
16+
<td class="col-2 text-center" *ngIf="showOptionInDevelopment">
1717
<button type="button" class="btn btn-sm btn-primary" (click)="updateActivity(activity.id)">
1818
<i class="fa fa-pencil fa-xs"></i>
1919
</button>
2020
</td>
21-
<td class="col-4 text-center">
22-
<div class="flex justify-center">
21+
<div *ngIf="showOptionInDevelopment; then devBlock; else prodBlock"></div>
22+
<ng-template #devBlock>
23+
<td class="col-2 text-center">
24+
<app-dropdown [info]="activity" (updateInfo)="changeOperation($event)"></app-dropdown>
25+
</td>
26+
</ng-template>
27+
<ng-template #prodBlock>
28+
<td class="col-4 text-center">
2329
<em class="fa mr-2 mt-1" [ngClass]="[activity.btnIcon, activity.iconColor]"></em>
24-
<p> {{ activity.btnName }}</p>
25-
</div>
26-
</td>
30+
<span>{{ activity.btnName }}</span>
31+
</td>
32+
</ng-template>
2733
</tr>
2834
</tbody>
2935
</table>

src/app/modules/activities-management/components/activity-list/activity-list.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
1+
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
22
import { select, Store } from '@ngrx/store';
33
import { Observable } from 'rxjs';
44
import { delay, map } from 'rxjs/operators';
@@ -16,6 +16,7 @@ import { ActivityState } from './../../store/activity-management.reducers';
1616
export class ActivityListComponent implements OnInit {
1717
@Output() changeValueShowActivityForm = new EventEmitter<boolean>();
1818
showActivityForm: boolean;
19+
@Input() showOptionInDevelopment: boolean;
1920

2021
constructor(private store: Store<ActivityState>) {
2122
this.isLoading$ = store.pipe(delay(0), select(getIsLoading));
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
<div class="col-12 col-md-9 px-0">
2-
<div class="hidden">
1+
<div class="col-12 px-0">
2+
<div *ngIf="showOptionInDevelopment">
33
<app-create-activity
4-
[showActivityForm]="showActivityForm" (changeValueShowActivityForm)="showActivityForm = $event"></app-create-activity>
4+
[showActivityForm]="showActivityForm"
5+
(changeValueShowActivityForm)="showActivityForm = $event"
6+
>
7+
</app-create-activity>
58
</div>
69
<app-activity-list
7-
(changeValueShowActivityForm)="showActivityForm = $event"></app-activity-list>
10+
[showOptionInDevelopment]="showOptionInDevelopment"
11+
(changeValueShowActivityForm)="showActivityForm = $event"
12+
>
13+
</app-activity-list>
814
</div>

src/app/modules/activities-management/pages/activities-management.component.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { waitForAsync, TestBed, ComponentFixture } from '@angular/core/testing';
2+
import { By } from '@angular/platform-browser';
23
import { ActivitiesManagementComponent } from './activities-management.component';
34

45
describe('ActivitiesManagementComponent', () => {
@@ -21,4 +22,13 @@ describe('ActivitiesManagementComponent', () => {
2122
it('should create the component', () => {
2223
expect(component).toBeTruthy();
2324
});
25+
26+
it('should check if is in development environment', () => {
27+
expect(component.showOptionInDevelopment).toBe(true);
28+
});
29+
30+
it('should check if add new entry button is render', () => {
31+
const addItemDebugElement = fixture.debugElement.query(By.css('div.col-12.px-0')).childNodes.length;
32+
expect(addItemDebugElement).toBe(3);
33+
});
2434
});
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1-
import { Component, Input } from '@angular/core';
1+
import { Component, Input, OnInit } from '@angular/core';
2+
import { environment } from 'src/environments/environment';
3+
24
@Component({
35
selector: 'app-activities-management',
46
templateUrl: './activities-management.component.html',
57
styleUrls: ['./activities-management.component.scss'],
68
})
7-
export class ActivitiesManagementComponent {
9+
export class ActivitiesManagementComponent implements OnInit {
810
@Input() showActivityForm: boolean;
11+
showOptionInDevelopment = true;
12+
13+
ngOnInit() {
14+
this.showOption();
15+
}
16+
17+
showOption(): void {
18+
if (environment.production){
19+
this.showOptionInDevelopment = false;
20+
}
21+
}
922
}
Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
11
import * as keys from './keys';
22

33
export const environment = {
4-
production: true
4+
production: true,
5+
timeTrackerApiUrl: 'https://timetracker-api.azurewebsites.net',
6+
stackexchangeApiUrl: 'https://api.stackexchange.com',
57
};
68

79
export const AUTHORITY = keys.AUTHORITY;
810
export const CLIENT_ID = keys.CLIENT_ID;
911
export const SCOPES = keys.SCOPES;
12+
export const ITEMS_PER_PAGE = 5;
13+
export const STACK_EXCHANGE_ID = keys.STACK_EXCHANGE_ID;
14+
export const STACK_EXCHANGE_ACCESS_TOKEN = keys.STACK_EXCHANGE_ACCESS_TOKEN;
15+
export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = keys.AZURE_APP_CONFIGURATION_CONNECTION_STRING;
16+
export const DATE_FORMAT = 'yyyy-MM-dd';
17+
export const DATE_FORMAT_YEAR = 'YYYY-MM-DD';
18+
export const GROUPS = {
19+
ADMIN: 'time-tracker-admin',
20+
TESTER: 'time-tracker-tester',
21+
};
22+
23+
export const ROLES = {
24+
admin: {
25+
name: 'admin',
26+
value: 'time-tracker-admin',
27+
},
28+
tester: {
29+
name: 'test',
30+
value: 'time-tracker-tester',
31+
},
32+
};

src/environments/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as keys from './keys';
55

66
export const environment = {
77
production: false,
8-
timeTrackerApiUrl: 'https://timetracker-api.azurewebsites.net',
8+
timeTrackerApiUrl: 'http://localhost:7071/api',
99
stackexchangeApiUrl: 'https://api.stackexchange.com',
1010
};
1111

0 commit comments

Comments
 (0)