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 UI linting to projects module #1012

Merged
merged 2 commits into from
Jan 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion ui/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dist

# Remove these in the future to lint additional modules
# Please also see .prettierignore
projects
src/app/_enums
src/app/_guards
src/app/_models
Expand Down
1 change: 0 additions & 1 deletion ui/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dist

# Remove these in the future to format additional modules
# Please also see .eslintignore
projects
src/app/_enums
src/app/_guards
src/app/_models
Expand Down
127 changes: 49 additions & 78 deletions ui/package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion ui/projects/streampipes/platform-services/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ This library was generated with [Angular CLI](https://github.com/angular/angular
## Code scaffolding

Run `ng generate component component-name --project platform-services` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project platform-services`.
> Note: Don't forget to add `--project platform-services` or else it will be added to the default project in your `angular.json` file.

> Note: Don't forget to add `--project platform-services` or else it will be added to the default project in your `angular.json` file.

## Build

Expand Down
19 changes: 9 additions & 10 deletions ui/projects/streampipes/platform-services/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*
*/


// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

Expand All @@ -28,7 +27,7 @@ module.exports = function (config) {
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
jasmine: {
Expand All @@ -37,18 +36,18 @@ module.exports = function (config) {
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
suppressAll: true, // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, '../../../coverage/streampipes/platform-services'),
dir: require('path').join(
__dirname,
'../../../coverage/streampipes/platform-services',
),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
reporters: [{ type: 'html' }, { type: 'text-summary' }],
},
reporters: ['progress', 'kjhtml'],
port: 9876,
Expand All @@ -57,6 +56,6 @@ module.exports = function (config) {
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
});
};
2 changes: 1 addition & 1 deletion ui/projects/streampipes/platform-services/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"lib": {
"entryFile": "src/public-api.ts"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,30 @@ import { HttpClient } from '@angular/common/http';
import { PlatformServicesCommons } from './commons.service';

export abstract class AbstractMonitoringService {
constructor(
protected http: HttpClient,
protected platformServicesCommons: PlatformServicesCommons,
) {}

constructor(protected http: HttpClient,
protected platformServicesCommons: PlatformServicesCommons) {
}
triggerMonitoringUpdate(): Observable<any> {
return this.http.get(this.monitoringBasePath);
}

triggerMonitoringUpdate(): Observable<any> {
return this.http.get(this.monitoringBasePath);
}
protected logUrl(elementId: string): string {
return `${this.monitoringUrl(elementId)}/logs`;
}

protected logUrl(elementId: string): string {
return `${this.monitoringUrl(elementId)}/logs`;
}
protected metricsUrl(elementId: string): string {
return `${this.monitoringUrl(elementId)}/metrics`;
}

protected metricsUrl(elementId: string): string {
return`${this.monitoringUrl(elementId)}/metrics`;
}
protected monitoringUrl(elementId): string {
return `${this.monitoringBasePath}/${
this.monitoringPathAppendix
}/${encodeURIComponent(elementId)}`;
}

protected monitoringUrl(elementId): string {
return `${this.monitoringBasePath}/${this.monitoringPathAppendix}/${encodeURIComponent(elementId)}`;
}
protected abstract get monitoringBasePath();

protected abstract get monitoringBasePath();

protected abstract get monitoringPathAppendix();
protected abstract get monitoringPathAppendix();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,43 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { PipelineMonitoringInfo, SpLogEntry, SpMetricsEntry } from '../model/gen/streampipes-model';
import {
PipelineMonitoringInfo,
SpLogEntry,
SpMetricsEntry,
} from '../model/gen/streampipes-model';
import { PlatformServicesCommons } from './commons.service';
import { map } from 'rxjs/operators';
import { AbstractMonitoringService } from './abstract-monitoring.service';

@Injectable({
providedIn: 'root'
providedIn: 'root',
})
export class AdapterMonitoringService extends AbstractMonitoringService {

constructor(http: HttpClient,
platformServicesCommons: PlatformServicesCommons) {
super(http, platformServicesCommons);
}

getLogInfoForAdapter(elementId: string): Observable<SpLogEntry[]> {
return this.http.get(this.logUrl(elementId))
.pipe(map(response => response as SpLogEntry[]));
}

getMetricsInfoForAdapter(elementId: string): Observable<SpMetricsEntry> {
return this.http.get(this.metricsUrl(elementId))
.pipe(map(response => response as SpMetricsEntry));
}

protected get monitoringBasePath(): string {
return `${this.platformServicesCommons.apiBasePath}/adapter-monitoring`;
}

protected get monitoringPathAppendix(): string {
return 'adapter';
}

constructor(
http: HttpClient,
platformServicesCommons: PlatformServicesCommons,
) {
super(http, platformServicesCommons);
}

getLogInfoForAdapter(elementId: string): Observable<SpLogEntry[]> {
return this.http
.get(this.logUrl(elementId))
.pipe(map(response => response as SpLogEntry[]));
}

getMetricsInfoForAdapter(elementId: string): Observable<SpMetricsEntry> {
return this.http
.get(this.metricsUrl(elementId))
.pipe(map(response => response as SpMetricsEntry));
}

protected get monitoringBasePath(): string {
return `${this.platformServicesCommons.apiBasePath}/adapter-monitoring`;
}

protected get monitoringPathAppendix(): string {
return 'adapter';
}
}
Loading