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

[#877] Apply formatting and linting to NS and notifications module #1089

Merged
merged 2 commits into from
Jan 14, 2023
Merged
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
2 changes: 0 additions & 2 deletions ui/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,3 @@ src/app/editor
src/app/files
src/app/info
src/app/login
src/app/notifications
src/app/NS
2 changes: 0 additions & 2 deletions ui/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,3 @@ src/app/editor
src/app/files
src/app/info
src/app/login
src/app/notifications
src/app/NS
20 changes: 10 additions & 10 deletions ui/src/app/NS/XS.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
import { XsService } from './xs.service';

describe('XSService', () => {
const service: XsService = new XsService();
const service: XsService = new XsService();

it('should get string XS String', () => {
expect(service.XS_STRING).toBe('xs:string');
});
it('should get string XS String', () => {
expect(service.XS_STRING).toBe('xs:string');
});

it('should check for numbers', () => {
expect(service.isNumber(service.XS_DOUBLE)).toBeTrue();
expect(service.isNumber(service.XS_INTEGER)).toBeTrue();
expect(service.isNumber(service.XS_NUMBER)).toBeTrue();
expect(service.isNumber(service.XS_STRING)).toBeFalse();
});
it('should check for numbers', () => {
expect(service.isNumber(service.XS_DOUBLE)).toBeTrue();
expect(service.isNumber(service.XS_INTEGER)).toBeTrue();
expect(service.isNumber(service.XS_NUMBER)).toBeTrue();
expect(service.isNumber(service.XS_STRING)).toBeFalse();
});
});
28 changes: 14 additions & 14 deletions ui/src/app/NS/xs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ import { Injectable } from '@angular/core';

@Injectable()
export class XsService {
XS_STRING = 'xs:string';
XS_INTEGER = 'http://www.w3.org/2001/XMLSchema#integer';
XS_DOUBLE = 'http://www.w3.org/2001/XMLSchema#double';
XS_BOOLEAN = 'http://www.w3.org/2001/XMLSchema#boolean';
XS_NUMBER = 'http://www.w3.org/2001/XMLSchema#number';
XS_STRING1 = 'http://www.w3.org/2001/XMLSchema#string';
SO_URL = 'https://schema.org/URL';

XS_STRING = 'xs:string';
XS_INTEGER = 'http://www.w3.org/2001/XMLSchema#integer';
XS_DOUBLE = 'http://www.w3.org/2001/XMLSchema#double';
XS_BOOLEAN = 'http://www.w3.org/2001/XMLSchema#boolean';
XS_NUMBER = 'http://www.w3.org/2001/XMLSchema#number';
XS_STRING1 = 'http://www.w3.org/2001/XMLSchema#string';
SO_URL = 'https://schema.org/URL';

isNumber(datatype: string): boolean {
return datatype === this.XS_DOUBLE ||
datatype === this.XS_INTEGER ||
datatype === this.XS_NUMBER;
}

isNumber(datatype: string): boolean {
return (
datatype === this.XS_DOUBLE ||
datatype === this.XS_INTEGER ||
datatype === this.XS_NUMBER
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
<div class="notification-item">
<div class="i">
<div class="head">
<span class="time">{{notification.createdAt | date: 'yyyy-MM-dd HH:mm:ss'}}</span>
<span class="time">{{
notification.createdAt | date : 'yyyy-MM-dd HH:mm:ss'
}}</span>
</div>
<div class="notification-box sp-accent-bg">
<div [innerHTML]="sanitizedMessage"></div>
</div>
</div>

</div>
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@

.notification-item {
margin-top: 30px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,19 @@ import { NotificationItem } from '../model/notifications.model';
import { DomSanitizer } from '@angular/platform-browser';

@Component({
selector: 'notification-item',
selector: 'sp-notification-item',
templateUrl: './notification-item.component.html',
styleUrls: ['./notification-item.component.scss']
styleUrls: ['./notification-item.component.scss'],
})
export class NotificationItemComponent implements OnInit {

@Input() notification: NotificationItem;
sanitizedMessage;

constructor(private domSanitizer: DomSanitizer) {

}
constructor(private domSanitizer: DomSanitizer) {}

ngOnInit(): void {
this.sanitizedMessage = this.domSanitizer.bypassSecurityTrustHtml(this.notification.message);
this.sanitizedMessage = this.domSanitizer.bypassSecurityTrustHtml(
this.notification.message,
);
}
}
109 changes: 83 additions & 26 deletions ui/src/app/notifications/notifications.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,59 +17,116 @@
-->

<div fxLayout="column" class="page-container page-container-max-height">
<div fxLayout="row" style="padding:0px;" class="sp-tab-bg">
<div fxLayout="row" style="padding: 0px" class="sp-tab-bg">
<div fxFlex="100" class="page-container-nav">
<div fxFlex="100" fxLayout="row">
<div fxFlex fxLayoutAlign="start center">
<mat-tab-group color="accent">
<mat-tab label="My Notifications"></mat-tab>
</mat-tab-group>
</div>
<div fxFlex fxLayoutAlign="end center" class="mr-20">

</div>
<div fxFlex fxLayoutAlign="end center" class="mr-20"></div>
</div>
</div>
</div>
<div class="container-fluid marketplace-container" *ngIf="notificationsLoading" fxFlex="100" fxLayoutAlign="center center" fxLayout="column">
<div
class="container-fluid marketplace-container"
*ngIf="notificationsLoading"
fxFlex="100"
fxLayoutAlign="center center"
fxLayout="column"
>
<mat-spinner [mode]="'indeterminate'" [diameter]="20"></mat-spinner>
<h4>Loading notifications...</h4>
</div>
<div class="fixed-height page-container-padding-inner" *ngIf="!notificationsLoading && !pipelinesWithNotificationsPresent" fxFlex="100" fxLayoutAlign="center center" fxLayout="row">
<h4>No notifications available. Create a new pipeline using the Notification Sink to create your first notification!</h4>
<div
class="fixed-height page-container-padding-inner"
*ngIf="!notificationsLoading && !pipelinesWithNotificationsPresent"
fxFlex="100"
fxLayoutAlign="center center"
fxLayout="row"
>
<h4>
No notifications available. Create a new pipeline using the
Notification Sink to create your first notification!
</h4>
</div>
<div class="fixed-height page-container-padding-inner" fxLayout="row" fxFlex="100" *ngIf="!notificationsLoading && pipelinesWithNotificationsPresent">
<div
class="fixed-height page-container-padding-inner"
fxLayout="row"
fxFlex="100"
*ngIf="!notificationsLoading && pipelinesWithNotificationsPresent"
>
<div fxFlex="30" class="notifications-overview scrolling-auto">
<mat-list>
<mat-list-item *ngFor="let existingNotification of existingNotifications"
(click)="selectNotification(existingNotification)" class="list-item"
[ngClass]="{'selected-notification':
existingNotification.notificationId === currentlySelectedNotificationId}">
<div mat-list-avatar
class="notification-avatar sp-accent-bg">{{elementIconText.getElementIconText(existingNotification.pipelineName)}}
<mat-list-item
*ngFor="let existingNotification of existingNotifications"
(click)="selectNotification(existingNotification)"
class="list-item"
[ngClass]="{
'selected-notification':
existingNotification.notificationId ===
currentlySelectedNotificationId
}"
>
<div
mat-list-avatar
class="notification-avatar sp-accent-bg"
>
{{
elementIconText.getElementIconText(
existingNotification.pipelineName
)
}}
</div>
<h4 mat-line>{{existingNotification.pipelineName}}</h4>
<p mat-line>{{existingNotification.notificationTitle}} </p>
<h4 mat-line>{{ existingNotification.pipelineName }}</h4>
<p mat-line>{{ existingNotification.notificationTitle }}</p>
<div class="new-notification-info-panel">
<div class="new-notification-info"
*ngIf="currentlySelectedNotificationId != existingNotification.notificationId &&
newNotificationInfo[existingNotification.notificationId]"></div>
<div
class="new-notification-info"
*ngIf="
currentlySelectedNotificationId !==
existingNotification.notificationId &&
newNotificationInfo[
existingNotification.notificationId
]
"
></div>
</div>
</mat-list-item>
</mat-list>
</div>
<div fxFlex="70" class="notifications-details">
<div class="notification-details-wrapper">
<div class="notification-header" fxLayout="column" fxLayoutAlign="center start">
<div class="notification-header-pipeline-name">{{currentlySelectedNotification.pipelineName}}</div>
<div class="notification-header-notification-name">{{currentlySelectedNotification.notificationTitle}}</div>
<hr class="header-divider"/>
<div
class="notification-header"
fxLayout="column"
fxLayoutAlign="center start"
>
<div class="notification-header-pipeline-name">
{{ currentlySelectedNotification.pipelineName }}
</div>
<div class="notification-header-notification-name">
{{ currentlySelectedNotification.notificationTitle }}
</div>
<hr class="header-divider" />
</div>
<div #notificationPane class="notification-pane" (scroll)="onScroll()" *ngIf="currentlySelectedNotificationId">
<notification-item [notification]="notification" *ngFor="let notification of allNotifications.get(currentlySelectedNotificationId)"></notification-item>
<div
#notificationPane
class="notification-pane"
(scroll)="onScroll()"
*ngIf="currentlySelectedNotificationId"
>
<sp-notification-item
[notification]="notification"
*ngFor="
let notification of allNotifications.get(
currentlySelectedNotificationId
)
"
></sp-notification-item>
</div>
</div>

</div>
</div>
</div>
15 changes: 7 additions & 8 deletions ui/src/app/notifications/notifications.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}

.mr-20 {
margin-right:20px;
margin-right: 20px;
}

.notifications-overview {
Expand Down Expand Up @@ -60,11 +60,11 @@
}

.header-divider {
display:flex;
display: flex;
align-self: center;
margin: 10px 20px;
width: 100%;
border-top: 2px solid $sp-color-accent
border-top: 2px solid $sp-color-accent;
}

.notification-header-pipeline-name {
Expand All @@ -83,17 +83,17 @@
}

.list-item:hover {
background: #E0E0E0;
background: #e0e0e0;
cursor: pointer;
}

.selected-notification {
background: #E0E0E0;
background: #e0e0e0;
cursor: pointer;
}

.list-item {
border-bottom: 1px solid #BDBDBD;
border-bottom: 1px solid #bdbdbd;
}

.notification-pane {
Expand All @@ -111,7 +111,7 @@

.scrolling-auto {
overflow: auto;
width:100%;
width: 100%;
}

.new-notification-info {
Expand All @@ -120,4 +120,3 @@
height: 10px;
border-radius: 50%;
}

Loading