Skip to content

Commit

Permalink
created license component
Browse files Browse the repository at this point in the history
  • Loading branch information
Langbein authored and Langbein committed Feb 21, 2020
1 parent 16698dc commit ac426eb
Show file tree
Hide file tree
Showing 14 changed files with 5,987 additions and 3 deletions.
13 changes: 13 additions & 0 deletions DEVELOPMENT_TODO.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Licenses

3rd party licenses are displayed with the component 'licenses.component'. This component requires there to be a file named 'licenses.json' in the assets directory.
This file has been autogenerated with the 'license-checker' npm-module. When new dependencies are added, the file needs to be regenerated manually.









# Getting started

- Check if [Git](https://git-scm.com/) is installed.
Expand Down
101 changes: 101 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"karma-coverage-istanbul-reporter": "~2.1.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"license-checker": "^25.0.1",
"ng-packagr": "^5.1.0",
"protractor": "~5.4.0",
"replace": "^1.1.1",
Expand Down
5 changes: 5 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Routes, RouterModule, PreloadAllModules } from '@angular/router';
import { RouteMapComponent } from './route-components/route-map/route-map.component';
import { ScenariosComponent } from './route-components/scenarios/scenarios.component';
import { RouteDocumentationComponent } from './route-components/route-documentation/route-documentation.component';
import { LicensesComponent } from './route-components/licenses/licenses.component';

const routes: Routes = [
{
Expand All @@ -23,6 +24,10 @@ const routes: Routes = [
{
path: 'documentation',
component: RouteDocumentationComponent
},
{
path: 'licenses',
component: LicensesComponent
}
];

Expand Down
3 changes: 2 additions & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<ukis-header [ukis-title]="title">
<a routerLink="/scenarios" routerLinkActive="active" class="nav-link nav-text header-nav-el">{{'Stories' | translate}}</a>
<a class="nav-link nav-text header-nav-el">{{currentMapName | async}}</a>
<!-- <a routerLink="/documentation" routerLinkActive="active" class="nav-link nav-text header-nav-el">{{'Documentation' | translate}}</a> -->
<a routerLink="/documentation" routerLinkActive="active" class="nav-link nav-text header-nav-el">{{'Documentation' | translate}}</a>
<a routerLink="/licenses" routerLinkActive="active" class="nav-link nav-text header-nav-el">{{'Licenses' | translate}}</a>
</ukis-header>

<router-outlet></router-outlet>
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import { DisclaimerComponent } from './components/disclaimer/disclaimer.componen
import { DisclaimerpopupComponent } from './components/disclaimerpopup/disclaimerpopup.component';
import { InteractionstatemonitorComponent } from './components/interactionstatemonitor/interactionstatemonitor.component';
import { HelpersModule } from '@ukis/helpers/src/public-api';
import { LicensesComponent } from './route-components/licenses/licenses.component';

@NgModule({
declarations: [
Expand Down Expand Up @@ -82,6 +83,7 @@ import { HelpersModule } from '@ukis/helpers/src/public-api';
DisclaimerComponent,
DisclaimerpopupComponent,
InteractionstatemonitorComponent,
LicensesComponent,
],
imports: [
BrowserModule,
Expand Down
3 changes: 1 addition & 2 deletions src/app/configuration/chile/reliability.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { WpsProcess, ProcessStateUnavailable, Product } from 'src/app/riesgos/riesgos.datatypes';
import { WizardableProcess, WizardProperties } from 'src/app/components/config_wizard/wizardable_processes';
import { WpsData } from '@ukis/services-ogc';
import { StringSelectUconfProduct } from 'src/app/components/config_wizard/userconfigurable_wpsdata';
import { VectorLayerProduct } from 'src/app/riesgos/riesgos.datatypes.mappable';
import { Style as olStyle, Fill as olFill, Stroke as olStroke, Circle as olCircle, Text as olText } from 'ol/style';
import { Style as olStyle, Fill as olFill, Stroke as olStroke } from 'ol/style';
import { Feature as olFeature } from 'ol/Feature';
import { HttpClient } from '@angular/common/http';
import { createKeyValueTableHtml } from 'src/app/helpers/others';
Expand Down
18 changes: 18 additions & 0 deletions src/app/route-components/licenses/licenses.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<p>{{ 'Licenses disclaimer' | translate}}</p>


<clr-datagrid>
<clr-dg-column>{{ 'Library name' | translate }}</clr-dg-column>
<clr-dg-column>{{ 'Publisher' | translate }}</clr-dg-column>
<clr-dg-column>{{ 'License' | translate }}</clr-dg-column>
<clr-dg-column>{{ 'Repository' | translate }}</clr-dg-column>

<clr-dg-row *ngFor="let l of (licenses | async)">
<clr-dg-cell>{{l.name}}</clr-dg-cell>
<clr-dg-cell>{{l.publisher}}</clr-dg-cell>
<clr-dg-cell>{{l.license}}</clr-dg-cell>
<clr-dg-cell><a href="{{l.repository}}">{{l.repository}}</a></clr-dg-cell>
</clr-dg-row>

<clr-dg-footer>{{(licenses | async).length}} third party dependencies</clr-dg-footer>
</clr-datagrid>
Empty file.
25 changes: 25 additions & 0 deletions src/app/route-components/licenses/licenses.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { LicensesComponent } from './licenses.component';

describe('LicensesComponent', () => {
let component: LicensesComponent;
let fixture: ComponentFixture<LicensesComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LicensesComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(LicensesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
47 changes: 47 additions & 0 deletions src/app/route-components/licenses/licenses.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';




interface License {
name: string;
license: string;
repository: string;
publisher: string;
}


@Component({
selector: 'ukis-licenses',
templateUrl: './licenses.component.html',
styleUrls: ['./licenses.component.scss']
})
export class LicensesComponent implements OnInit {

public licenses: Observable<License[]>;

constructor(private http: HttpClient) { }

ngOnInit() {
this.licenses = this.http.get('assets/licenses.json').pipe(map(data => {
const licenses: License[] = [];
for (const name in data) {
if (data[name]) {
const val = data[name];
licenses.push({
name: name,
license: val.licenses,
repository: val.repository,
publisher: val.publisher
});
}
}
return licenses;
}));
}

}

Loading

0 comments on commit ac426eb

Please sign in to comment.