Skip to content
Prev Previous commit
Next Next commit
feature: TT-430 hide add new activity in production
  • Loading branch information
mandres2015 committed Dec 1, 2021
commit 97e8664240339c903b20da46b33586732283c69c
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
<tr class="d-flex">
<th class="col-2 text-center">Activity ID</th>
<th class="col-4 text-center">Activity</th>
<th class="col-2 text-center">Status</th>
<th class="col-2 text-center">Options</th>
<th class="col-2 text-center">Status</th>
<th class="{{showOptionInDevelopment ? 'col-2' : 'col-6'}} text-center">Status</th>
<th class="col-2 text-center" *ngIf="showOptionInDevelopment">Options</th>
<th class="col-2 text-center" *ngIf="showOptionInDevelopment">Status</th>
</tr>
</thead>
<app-loading-bar *ngIf="isLoading$ | async"></app-loading-bar>
<tbody *ngIf="(isLoading$ | async) === false">
<tr class="d-flex" *ngFor="let activity of activities">
<td class="col-2 text-break">{{ activity.id }}</td>
<td class="col-4">{{ activity.name }}</td>
<td class="col-2">{{ activity.status }}</td>
<td class="col-2 text-center">
<td class="{{showOptionInDevelopment ? 'col-2' : 'col-6'}} text-center">{{ activity.status }}</td>
<td class="col-2 text-center" *ngIf="showOptionInDevelopment">
<button type="button" class="btn btn-sm btn-primary" (click)="updateActivity(activity.id)">
<i class="fa fa-pencil fa-xs"></i>
</button>
</td>
<td class="col-2 text-center">
<td class="col-2 text-center" *ngIf="showOptionInDevelopment">
<app-dropdown [info]="activity" (updateInfo)="changeOperation($event)"> </app-dropdown>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { select, Store } from '@ngrx/store';
import { Observable } from 'rxjs';
import { delay, map } from 'rxjs/operators';
Expand All @@ -16,6 +16,7 @@ import { ActivityState } from './../../store/activity-management.reducers';
export class ActivityListComponent implements OnInit {
@Output() changeValueShowActivityForm = new EventEmitter<boolean>();
showActivityForm: boolean;
@Input() showOptionInDevelopment: boolean;

constructor(private store: Store<ActivityState>) {
this.isLoading$ = store.pipe(delay(0), select(getIsLoading));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<div class="col-12 col-md-9 px-0">
<div class="hidden">
<div class="col-12 px-0">
<div *ngIf="showOptionInDevelopment">
<app-create-activity
[showActivityForm]="showActivityForm" (changeValueShowActivityForm)="showActivityForm = $event"></app-create-activity>
[showActivityForm]="showActivityForm"
(changeValueShowActivityForm)="showActivityForm = $event"
>
</app-create-activity>
</div>
<app-activity-list
(changeValueShowActivityForm)="showActivityForm = $event"></app-activity-list>
[showOptionInDevelopment]="showOptionInDevelopment"
(changeValueShowActivityForm)="showActivityForm = $event"
>
</app-activity-list>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { waitForAsync, TestBed, ComponentFixture } from '@angular/core/testing';
import { by, By, element } from 'protractor';
import { ActivitiesManagementComponent } from './activities-management.component';

describe('ActivitiesManagementComponent', () => {
Expand All @@ -21,4 +22,8 @@ describe('ActivitiesManagementComponent', () => {
it('should create the component', () => {
expect(component).toBeTruthy();
});

it('should check if is in development environment', () => {
expect(component.showOptionInDevelopment).toBe(true)
})
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
import { Component, Input } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { environment } from 'src/environments/environment'

@Component({
selector: 'app-activities-management',
templateUrl: './activities-management.component.html',
styleUrls: ['./activities-management.component.scss'],
})
export class ActivitiesManagementComponent {
export class ActivitiesManagementComponent implements OnInit {
@Input() showActivityForm: boolean;
showOptionInDevelopment: boolean = true;

ngOnInit() {
this.showOption()
}

showOption(): void {
if(environment.production){
this.showOptionInDevelopment = false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ export class ActivityEffects {
ofType(actions.ActivityManagementActionTypes.UNARCHIVE_ACTIVITY),
map((action: actions.UnarchiveActivity) => ({
id: action.payload,
status: 'active'
status: 'active',
deleted: false
})
),
mergeMap((activity: ActivityStatus) =>
Expand Down