Skip to content

Commit 1f6198f

Browse files
author
Yuqera
authored
Merge pull request #418 from DigitalExcellence/origin/bugfix/refactor-friday
Small bugfixes
2 parents d219d46 + 82e5b4a commit 1f6198f

16 files changed

+126
-28
lines changed

CHANGELOG.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020

2121
### Changed
2222

23-
- Changed the open graph tags in order to show a more appealing website preview [#405](https://github.com/DigitalExcellence/dex-frontend/issues/405)
23+
- Changed the open graph tags in order to show a more appealing website preview - [#405](https://github.com/DigitalExcellence/dex-frontend/issues/405)
24+
- Changed it so you can now clear query paramters like pagination or search by clicking on 'projects' again - [#401](https://github.com/DigitalExcellence/dex-frontend/issues/401)
2425
- Changed the design of the filtermenu on project overview page- [#287](https://github.com/DigitalExcellence/dex-frontend/issues/287)
2526

2627
### Deprecated
@@ -32,7 +33,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3233
### Fixed
3334

3435
- Fixed issue where images in the project-details view would go outside the page - [#397](https://github.com/DigitalExcellence/dex-frontend/issues/397)
35-
- Fixed issue where builds failed due to Lighthouse budgets not being high enough [#411](https://github.com/DigitalExcellence/dex-backend/issues/411)
36+
- Fixed issue where builds failed due to Lighthouse budgets not being high enough - [#411](https://github.com/DigitalExcellence/dex-backend/issues/411)
37+
- Fixed issue where long collaborator names would mess up styling - [#354](https://github.com/DigitalExcellence/dex-frontend/issues/354)
38+
- Fixed issue where in some cases the alert banner would not disapear automatically - [#392](https://github.com/DigitalExcellence/dex-frontend/issues/392)
39+
- Fixed issue where opening a modal or long usernames would cause the page to get unaligned - [#400](https://github.com/DigitalExcellence/dex-frontend/issues/400)
3640

3741
### Security
3842

src/app/components/app-layout/app-layout.component.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
</button>
3030

3131
<div class="collapse navbar-collapse" [ngClass]="{ 'show': navbarOpen }">
32-
<div class="header-nav">
33-
<a routerLink="project/overview" routerLinkActive="active" class="nav-link nav-text">Projects</a>
32+
<div class="header-nav project-link">
33+
<a (click)="onClickProjects()" routerLinkActive="active" class="nav-link nav-text">Projects</a>
3434
<a routerLink="project/add/source" routerLinkActive="active" class="nav-link nav-text">Add project</a>
3535
</div>
3636
<div class="header-nav account">

src/app/components/app-layout/app-layout.component.scss

+11
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,17 @@
129129
}
130130
}
131131

132+
.project-link a {
133+
cursor: pointer;
134+
-webkit-touch-callout: none; /* iOS Safari */
135+
-webkit-user-select: none; /* Safari */
136+
-khtml-user-select: none; /* Konqueror HTML */
137+
-moz-user-select: none; /* Old versions of Firefox */
138+
-ms-user-select: none; /* Internet Explorer/Edge */
139+
user-select: none; /* Non-prefixed version, currently
140+
supported by Chrome, Edge, Opera and Firefox */
141+
}
142+
132143
.account {
133144
display: flex;
134145
align-items: flex-start;

src/app/components/app-layout/app-layout.component.ts

+11
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@ export class AppLayoutComponent implements OnInit {
8888
this.displayBetaBanner = false;
8989
}
9090

91+
/**
92+
* Navigate to project overview, if on project overview already reload page.
93+
*/
94+
public onClickProjects() {
95+
if (this.router.url === '/project/overview') {
96+
location.reload();
97+
} else {
98+
this.router.navigate(['project/overview']);
99+
}
100+
}
101+
91102
/**
92103
* Method which triggers when the user clicks the beta text in the header.
93104
* Displays the beta banner.

src/app/models/internal/alert-config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ export interface AlertConfig {
2323
preMessage?: string;
2424
mainMessage: string;
2525
dismissible?: boolean;
26+
autoDismiss?: boolean;
2627
timeout?: number;
2728
}

src/app/modules/project/add/manual/manual.component.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ export class ManualComponent implements OnInit {
172172
preMessage: 'The add project form is invalid',
173173
mainMessage: 'The project could not be saved, please fill all required fields',
174174
dismissible: true,
175+
autoDismiss: true,
175176
timeout: this.alertService.defaultTimeout
176177
};
177178
this.alertService.pushAlert(alertConfig);
@@ -231,7 +232,8 @@ export class ManualComponent implements OnInit {
231232
type: AlertType.danger,
232233
preMessage: 'The add collaborator form is invalid',
233234
mainMessage: 'Collaborator could not be added',
234-
dismissible: true
235+
dismissible: true,
236+
autoDismiss: true
235237
};
236238
this.alertService.pushAlert(alertConfig);
237239
return;
@@ -252,7 +254,8 @@ export class ManualComponent implements OnInit {
252254
const alertConfig: AlertConfig = {
253255
type: AlertType.danger,
254256
mainMessage: 'Collaborator could not be removed',
255-
dismissible: true
257+
dismissible: true,
258+
autoDismiss: true
256259
};
257260
this.alertService.pushAlert(alertConfig);
258261
return;
@@ -270,6 +273,7 @@ export class ManualComponent implements OnInit {
270273
type: AlertType.success,
271274
mainMessage: 'Project was succesfully saved',
272275
dismissible: true,
276+
autoDismiss: true,
273277
timeout: this.alertService.defaultTimeout
274278
};
275279
this.alertService.pushAlert(alertConfig);

src/app/modules/project/add/source/source.component.ts

+2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export class SourceComponent implements OnInit {
105105
preMessage: 'Source uri/url was invalid',
106106
mainMessage: 'Source details could not be fetched',
107107
dismissible: true,
108+
autoDismiss: true,
108109
timeout: this.alertService.defaultTimeout,
109110
};
110111
this.alertService.pushAlert(alertConfig);
@@ -137,6 +138,7 @@ export class SourceComponent implements OnInit {
137138
preMessage: 'You\'re not logged in!',
138139
mainMessage: 'You can only add a project when you\'re logged in.',
139140
dismissible: true,
141+
autoDismiss: true,
140142
timeout: this.alertService.defaultTimeout,
141143
};
142144
this.alertService.pushAlert(alertConfig);

src/app/modules/project/details/details.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ <h2 class="project-title">{{ project.name }}</h2>
149149
</div>
150150

151151
<ng-template #noProject>
152-
<div class="row">
152+
<div class="row not-found">
153153
<div class="offset-2 col-8">
154154
<h1>Project details</h1>
155155
<p>The project with the identifier "{{invalidId}}" could not be found.</p>

src/app/modules/project/details/details.component.scss

+10-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
}
5252
}
5353

54-
.row {
54+
.not-found {
5555
margin: 0;
5656
max-width: 100%;
5757
}
@@ -74,6 +74,15 @@
7474
}
7575
}
7676

77+
.modal-open {
78+
.feedback-button-container {
79+
right: 15.77%!important;
80+
}
81+
.background {
82+
width: 101.8vw;
83+
}
84+
}
85+
7786
.project-modal-content {
7887
border: none;
7988
padding: 40px;

src/app/modules/project/details/details.component.ts

+5
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ export class DetailsComponent implements OnInit {
177177
preMessage: 'Project could not be highlighted',
178178
mainMessage: 'Project id could not be found',
179179
dismissible: true,
180+
autoDismiss: true,
180181
timeout: this.alertService.defaultTimeout
181182
};
182183
this.alertService.pushAlert(alertConfig);
@@ -209,6 +210,7 @@ export class DetailsComponent implements OnInit {
209210
type: AlertType.success,
210211
mainMessage: 'Project was successfully highlighted',
211212
dismissible: true,
213+
autoDismiss: true,
212214
timeout: this.alertService.defaultTimeout
213215
};
214216
this.alertService.pushAlert(alertConfig);
@@ -275,6 +277,7 @@ export class DetailsComponent implements OnInit {
275277
mainMessage: 'Removal of project was successful',
276278
timeout: this.alertService.defaultTimeout,
277279
dismissible: true,
280+
autoDismiss: true,
278281
type: AlertType.success
279282
});
280283
this.router.navigate(['project/overview']);
@@ -409,6 +412,7 @@ export class DetailsComponent implements OnInit {
409412
type: AlertType.warning,
410413
mainMessage: 'You need to be logged in to like a project',
411414
dismissible: true,
415+
autoDismiss: true,
412416
timeout: this.alertService.defaultTimeout
413417
};
414418
this.alertService.pushAlert(alertConfig);
@@ -458,6 +462,7 @@ export class DetailsComponent implements OnInit {
458462
type: AlertType.success,
459463
mainMessage: 'Highlight was successfully updated',
460464
dismissible: true,
465+
autoDismiss: true,
461466
timeout: this.alertService.defaultTimeout
462467
};
463468
this.alertService.pushAlert(alertConfig);

src/app/modules/project/edit/edit.component.html

+14-2
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,23 @@ <h3>Collaborator role</h3>
163163
<h3>Collaborators</h3>
164164
</div>
165165

166-
<div *ngFor="let collaborator of collaborators" class="col-5 collaborator-item">
166+
<div *ngFor="let collaborator of collaborators; index as i" class="col-5 collaborator-item">
167167
<button type="button" class="btn btn-icon btn-danger" aria-label="error"
168168
(click)="onClickDeleteCollaborator(collaborator)"> <span aria-hidden="true"> &times; </span>
169169
</button>
170-
<p class="collaborator-text large"><strong>{{collaborator?.fullName}}</strong>- {{collaborator?.role}}</p>
170+
171+
<div class="collaborator-text-container w-100">
172+
173+
<div>
174+
<p class="collaborator-text large font-weight-bold" [tooltip]="collaborator?.fullName" delay="300">{{collaborator?.fullName}}</p>
175+
</div>
176+
<p class="collaborator-text large dash">-</p>
177+
<div>
178+
<p class="collaborator-text large" [tooltip]="collaborator?.role" delay="300">{{collaborator?.role}}</p>
179+
</div>
180+
181+
</div>
182+
171183
<hr class="dashed">
172184
</div>
173185
</div>

src/app/modules/project/edit/edit.component.scss

+22-3
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,30 @@
9595
margin-left: 10px;
9696
}
9797

98-
.collaborator-text {
98+
.collaborator-text-container {
9999
display: flex;
100-
align-self: center;
101-
margin: 0;
100+
justify-content: flex-start;
102101
}
102+
.collaborator-text-container .dash {
103+
margin-left: 5px;
104+
margin-right: 5px;
105+
}
106+
.collaborator-text-container div {
107+
max-width: 50%;
108+
}
109+
.collaborator-text.font-weight-bold {
110+
margin-left: 10px;
111+
}
112+
113+
.collaborator-text {
114+
align-self: center;
115+
margin: 0;
116+
max-width: 100%;
117+
118+
text-overflow: ellipsis;
119+
overflow: hidden;
120+
white-space: nowrap;
121+
}
103122
}
104123

105124
button {

src/app/modules/project/edit/edit.component.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt
1616
*/
1717

18-
import { Component, OnInit, ViewChild } from '@angular/core';
18+
import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core';
1919
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
2020
import { Router, ActivatedRoute } from '@angular/router';
21-
import { catchError, finalize } from 'rxjs/operators';
21+
import { finalize } from 'rxjs/operators';
2222
import { CollaboratorAdd } from 'src/app/models/resources/collaborator-add';
2323
import { ProjectService } from 'src/app/services/project.service';
2424
import { Project } from 'src/app/models/domain/project';
@@ -186,7 +186,8 @@ export class EditComponent implements OnInit {
186186
type: AlertType.danger,
187187
preMessage: 'The edit project form is invalid',
188188
mainMessage: 'The project could not be updated, please fill all required fields',
189-
dismissible: true
189+
dismissible: true,
190+
autoDismiss: true
190191
};
191192
this.alertService.pushAlert(alertConfig);
192193
return;
@@ -258,7 +259,8 @@ export class EditComponent implements OnInit {
258259
type: AlertType.danger,
259260
preMessage: 'The add collaborator form is invalid',
260261
mainMessage: 'Collaborator could not be added',
261-
dismissible: true
262+
dismissible: true,
263+
autoDismiss: true
262264
};
263265
this.alertService.pushAlert(alertConfig);
264266
return;
@@ -279,7 +281,8 @@ export class EditComponent implements OnInit {
279281
const alertConfig: AlertConfig = {
280282
type: AlertType.danger,
281283
mainMessage: 'Collaborator could not be removed',
282-
dismissible: true
284+
dismissible: true,
285+
autoDismiss: true
283286
};
284287
this.alertService.pushAlert(alertConfig);
285288
return;
@@ -303,7 +306,9 @@ export class EditComponent implements OnInit {
303306
type: AlertType.success,
304307
mainMessage: 'Project was succesfully updated',
305308
dismissible: true,
309+
autoDismiss: true,
306310
timeout: this.alertService.defaultTimeout
311+
307312
};
308313
this.alertService.pushAlert(alertConfig);
309314
this.router.navigate([`project/details/${this.project.id}`]);

src/app/modules/project/overview/project/project.component.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@ <h3 class="project-name">{{project.name}}</h3>
9393
<em class='far fa-clock'></em>
9494
<div class="project-created-date">{{project.created | date: 'mediumDate'}}</div>
9595
</div>
96-
<div (click)="userClicked($event)" class='item disabled'>
96+
<div (click)="userClicked($event)" [tooltip]="projectUsername" class='item'>
9797
<em class='fa fa-user'></em>
9898
<div class="project-user-name">{{project.user.name}}</div>
99+
<ng-template #projectUsername>
100+
<p>{{project.user.name}}</p>
101+
</ng-template>
99102
</div>
100103
</div>
101104
</div>

src/app/modules/project/overview/project/project.component.scss

+5
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@
238238
white-space: nowrap;
239239
text-overflow: ellipsis;
240240
}
241+
.project-user-name {
242+
text-overflow: ellipsis;
243+
white-space: nowrap;
244+
overflow: hidden;
245+
}
241246
i {
242247
justify-self: center;
243248
color: $light-mode-black;

src/app/services/alert.service.ts

+16-9
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ export class AlertService {
4949

5050
this.$activeAlerts.next(this.activeAlerts);
5151

52-
// Dismissible alerts with no timeout will not be automatically removed.
53-
if (alertConfig.dismissible && (alertConfig.timeout == null || alertConfig.timeout <= 0)) {
52+
// Alerts that aren't configured to auto dismiss will return.
53+
if (alertConfig.autoDismiss == null || !alertConfig.autoDismiss) {
5454
return;
5555
}
5656

@@ -69,13 +69,20 @@ export class AlertService {
6969
}
7070

7171
timer(alertTimeOut).subscribe(() => {
72-
const index = this.activeAlerts.findIndex(activeAlert => activeAlert === alertConfig);
73-
if (index < 0) {
74-
return;
75-
}
76-
77-
this.activeAlerts.splice(index, 1);
78-
this.$activeAlerts.next(this.activeAlerts);
72+
this.removeAlert(alertConfig);
7973
});
8074
}
75+
76+
/**
77+
* Method to remove an alert.
78+
* @param alertConfig the alert to remove.
79+
*/
80+
private removeAlert(alertConfig: AlertConfig): void {
81+
const index = this.activeAlerts.findIndex(activeAlert => activeAlert === alertConfig);
82+
83+
if (index < 0) { return; }
84+
85+
this.activeAlerts.splice(index, 1);
86+
this.$activeAlerts.next(this.activeAlerts);
87+
}
8188
}

0 commit comments

Comments
 (0)