Skip to content

Commit 0bf0336

Browse files
committed
Fixed filters
1 parent 22ffd69 commit 0bf0336

File tree

16 files changed

+84
-53
lines changed

16 files changed

+84
-53
lines changed

frontend/dist/frontend/assets/i18n/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
"git_branch": "Git Branch",
155155
"no-task": "No task found",
156156
"invalid-email": "Invalid email",
157-
"committed-at": "Committed at"
157+
"committed-at": "Committed at",
158+
"branch": "Branch"
158159

159160
}

frontend/dist/frontend/assets/i18n/it.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
"git_branch": "Git Branch",
155155
"no-task": "Nessun task trovato",
156156
"invalid-email": "Email non valida",
157-
"committed-at": "Committed at"
157+
"committed-at": "Committed at",
158+
"branch": "Branch"
158159

159160
}

frontend/dist/frontend/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@
4444
});
4545

4646
</script>
47-
<script src="runtime.0ff8b5c7db2b67dc.js" type="module"></script><script src="polyfills.794d7387aea30963.js" type="module"></script><script src="main.9018a183dc159f19.js" type="module"></script>
47+
<script src="runtime.0ff8b5c7db2b67dc.js" type="module"></script><script src="polyfills.794d7387aea30963.js" type="module"></script><script src="main.115c0c7fdccf5539.js" type="module"></script>
4848

4949
</body></html>

frontend/dist/frontend/main.9018a183dc159f19.js renamed to frontend/dist/frontend/main.115c0c7fdccf5539.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/app/page/dashboard/dashboard.component.html

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
<!-- FILTER -->
2525
<app-filter *ngIf="dashboard && dashboard?.tasks"
2626
[filterFields]="['name', 'description']"
27-
[(entities)]="dashboard.tasks">
27+
[entities]="dashboard.tasks"
28+
(entitiesChange)="tasks = $event">
2829
</app-filter>
2930

3031

@@ -224,7 +225,7 @@ <h3 class="text-center">
224225
data-bs-dismiss="modal"
225226
aria-label="Close"
226227
>
227-
<i data-feather="x"></i>
228+
<i class="bi bi-x"></i>
228229
</button>
229230
</div>
230231
<div class="modal-body">
@@ -257,7 +258,13 @@ <h3 class="text-center">
257258
</div>
258259
</div>
259260

260-
<div class="row align-items-center">
261+
<div class="row align-items-center justify-content-center">
262+
<div class="col-auto">
263+
<label>
264+
{{ "priority" | translate }}:
265+
</label>
266+
</div>
267+
261268
<div class="col-md-9">
262269
<input
263270
class="form-control"
@@ -267,23 +274,6 @@ <h3 class="text-center">
267274
formControlName="priority"
268275
/>
269276
</div>
270-
271-
<div class="col-md-3">
272-
<div class="form-check">
273-
<div class="checkbox">
274-
<input
275-
type="checkbox"
276-
id="self-assigned"
277-
class="form-check-input"
278-
[checked]="creationForm.controls['selfAssigned'].value"
279-
formControlName="selfAssigned"
280-
/>
281-
<label for="self-assigned">
282-
{{ "assign-yourself" | translate }}
283-
</label>
284-
</div>
285-
</div>
286-
</div>
287277
</div>
288278

289279
<div class="row mt-2">
@@ -305,6 +295,25 @@ <h3 class="text-center">
305295
</div>
306296
</div>
307297

298+
<div class="row justify-content-center">
299+
<div class="col-auto">
300+
<div class="form-check">
301+
<div class="checkbox">
302+
<input
303+
type="checkbox"
304+
id="self-assigned"
305+
class="form-check-input"
306+
[checked]="creationForm.controls['selfAssigned'].value"
307+
formControlName="selfAssigned"
308+
/>
309+
<label for="self-assigned">
310+
{{ "assign-yourself" | translate }}
311+
</label>
312+
</div>
313+
</div>
314+
</div>
315+
</div>
316+
308317
</form>
309318

310319
</div>

frontend/src/app/page/dashboard/dashboard.component.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,15 @@ export class DashboardComponent {
4444

4545
dashboard: DashboardModel | null = null;
4646

47+
tasks: TaskModel[] = []; // different by dashboard.task because they may be filtered
48+
4749
onTopTaskIdList: number[] = [];
4850

4951
creationForm = new FormGroup({
5052
name: new FormControl('', [Validators.required]),
5153
description: new FormControl(''),
5254
priority: new FormControl('', [Validators.required]),
53-
selfAssigned: new FormControl(false, [Validators.required])
55+
selfAssigned: new FormControl(false)
5456
});
5557

5658
constructor(private dashboardService: DashboardService, public authService: AuthService, private taskService: TaskService) {
@@ -113,9 +115,12 @@ export class DashboardComponent {
113115
this.dashboardService.getData().then((response) => {
114116
response.subscribe({
115117
next: (value: DashboardModel | null) => {
116-
if(value) {
118+
if(!!value) {
117119
this.dashboard = value;
118120

121+
// set effective task
122+
this.tasks = [...this.dashboard.tasks];
123+
119124
// set default id index if it is not setted
120125
if(!this.taskStatusIdIndex)
121126
this.taskStatusIdIndex = this.dashboard.default_task_status_id;
@@ -175,10 +180,10 @@ export class DashboardComponent {
175180

176181
getAllTaskBasedOnStatusId(taskStatusId: number | undefined): TaskModel[] | null {
177182

178-
if(!this.dashboard || !taskStatusId)
183+
if(!this.tasks || !taskStatusId)
179184
return null;
180185

181-
let tasksBasedOnStatusId = this.dashboard!.tasks.filter(task => task !== undefined && task.task_status_id === taskStatusId);
186+
let tasksBasedOnStatusId = this.tasks.filter(task => task !== undefined && task.task_status_id === taskStatusId);
182187

183188
if(!tasksBasedOnStatusId)
184189
return null;
@@ -246,26 +251,24 @@ export class DashboardComponent {
246251
}
247252

248253
removeTask(taskId: number) {
249-
if(!this.dashboard?.tasks)
254+
if(!this.tasks)
250255
return;
251256

252-
this.dashboard.tasks = this.dashboard.tasks.filter(t => t.id != taskId);
257+
this.tasks = this.tasks.filter(t => t.id != taskId);
253258
}
254259

255260
updateTask(managedTask: UpdateTaskModel) {
256-
if(!this.dashboard?.tasks)
261+
if(!this.tasks)
257262
return;
258263

259-
for (let index = 0; index < this.dashboard.tasks.length; index++) {
260-
const element = this.dashboard.tasks[index];
264+
for (let index = 0; index < this.tasks.length; index++) {
265+
const element = this.tasks[index];
261266

262267
if(element.id == managedTask.target)
263-
this.dashboard.tasks[index] = managedTask.new;
268+
this.tasks[index] = managedTask.new;
264269

265270
}
266271

267-
console.log(this.dashboard.tasks);
268-
269272
}
270273

271274
newTask() {
@@ -296,7 +299,10 @@ export class DashboardComponent {
296299
response.subscribe({
297300
next: (task) => {
298301

299-
this.creationForm.reset();
302+
if(!!task) {
303+
this.creationForm.reset();
304+
305+
}
300306

301307
// self assign
302308
if(selfAssigned) {
@@ -309,7 +315,7 @@ export class DashboardComponent {
309315
this.taskService.find(task.id).then((respose) => {
310316
respose.subscribe({
311317
next: (t) => {
312-
this.dashboard?.tasks.push(t);
318+
this.tasks.push(t);
313319

314320
}
315321
})
@@ -323,7 +329,7 @@ export class DashboardComponent {
323329

324330
} else { // append immediatly task
325331

326-
this.dashboard?.tasks.push(task);
332+
this.tasks.push(task);
327333
}
328334
}
329335
})

frontend/src/app/page/login/login.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ <h1 class="auth-title">
1515
class="form-control form-control-xl"
1616
placeholder="Email"
1717
formControlName="email"
18-
[class.is-valid]="loginForm.controls['email'].dirty && loginForm.controls['email'].valid"
1918
[class.is-invalid]="loginForm.controls['email'].dirty && !loginForm.controls['email'].valid"
2019
/>
2120
<div class="form-control-icon">

frontend/src/app/widget/filter/filter.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export class FilterComponent<E> {
6060
}
6161

6262
filter(): void {
63+
6364
if(!this.entitiesBackup || !this.filterFields)
6465
return;
6566

@@ -74,9 +75,6 @@ export class FilterComponent<E> {
7475
const filteredValue = String((this.filterForm?.controls as any)[filterField].value).toLowerCase();
7576
const associatedEntityValue = String((entity as any)[filterField]).toLowerCase();
7677

77-
console.log(filterField, associatedEntityValue, filteredValue, filteredValue !== "" && associatedEntityValue.includes(filteredValue));
78-
79-
8078
if(filteredValue !== "" && associatedEntityValue.includes(filteredValue))
8179
return true;
8280
}

frontend/src/app/widget/footer/footer.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
<i class="bi bi-arrow-clockwise"></i>
1818
</button>
1919

20-
<button class="btn icon btn-light"
20+
<!--<button class="btn icon btn-light"
2121
data-bs-toggle="modal"
2222
data-bs-target="#close-app-modal"
2323
type="button">
2424
<i class="bi bi-power"></i>
25-
</button>
25+
</button>-->
2626

2727
<app-dialog-modal [centered]="true"
2828
[target]="'close-app-modal'"

frontend/src/app/widget/manage/manage-entities/manage-entities.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<ng-container *ngIf="!!title && !!entities">
2-
<app-filter [filterFields]="filterFields" [(entities)]="entities">
2+
<app-filter [filterFields]="filterFields" [entities]="entities"
3+
(entitiesChange)="entitiesFiltered = $event">
34
</app-filter>
45

56

@@ -15,7 +16,7 @@
1516

1617

1718
<!-- MANAGE ENTITIES -->
18-
<ng-container *ngFor="let entity of entities">
19+
<ng-container *ngFor="let entity of entitiesFiltered">
1920

2021
<app-manage-entity
2122
[entity]="entity"

0 commit comments

Comments
 (0)