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

Develop #13

Merged
merged 35 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c66100e
Fixed wrong XML prefix
aljoshakoecher Dec 26, 2022
6184b92
Fixes current activity not properly being displayed
aljoshakoecher Dec 26, 2022
776675a
Moved dashboard code
aljoshakoecher Dec 26, 2022
c9d8b43
Updated fontawesome
aljoshakoecher Jan 4, 2023
38f1c8d
Added iconclass to message
aljoshakoecher Jan 4, 2023
93f1e43
Started working on dashboard cleanup
aljoshakoecher Jan 4, 2023
6bc5d70
Updated bootstrap
aljoshakoecher Jan 5, 2023
a2ae2ad
Added "ping" methods to API services
aljoshakoecher Jan 5, 2023
3656468
Added a settings overview to dashboard
aljoshakoecher Jan 5, 2023
fd565a0
Added capabilityType
aljoshakoecher Feb 15, 2023
b4f872f
Added settings overview and improved graphs
aljoshakoecher Feb 15, 2023
89131e9
Updated dependencies and settings
aljoshakoecher Feb 16, 2023
be925c0
Updated HTTP and swapped UUID against crypto
aljoshakoecher Feb 16, 2023
fa1ce0a
Fixing minor UI issues
aljoshakoecher Mar 13, 2023
f363942
Fixed IRI of GetOutputs
aljoshakoecher Mar 13, 2023
96a1000
refactor(ontology): New ontology IRIs
aljoshakoecher Apr 3, 2023
d7b3e31
refactor(shared): :building_construction: aligned command / transitio…
aljoshakoecher Apr 3, 2023
0dd6004
refactor(backend): :coffin: deleted old route
aljoshakoecher Apr 3, 2023
d10500c
chore(config): :wrench: adds conventional commit scopes
aljoshakoecher Apr 3, 2023
14b8e1e
feat(frontend): :sparkles: skill type charts
aljoshakoecher Apr 3, 2023
d0ea196
refactor(ontology): :recycle: REST skills according to new ontology
aljoshakoecher Apr 12, 2023
59bb562
chore(config): :wrench: Adds conventional commit scopes
aljoshakoecher Apr 12, 2023
6816588
feat(backend): :sparkles: retrieving capability process type
aljoshakoecher Apr 12, 2023
e300969
feat(backend): :sparkles: retrieving skill interface type
aljoshakoecher Apr 12, 2023
83d926b
feat(frontend): :sparkles: new pie charts for capability and skill types
aljoshakoecher Apr 12, 2023
307e724
refactor(frontend): :lipstick: sorting messages on dashboards by date
aljoshakoecher Apr 12, 2023
f148f28
feat(front&back): :sparkles: capability filter feature
aljoshakoecher Apr 12, 2023
da9697f
feat(frontend): :sparkles: warning messages and modal for GraphDB
aljoshakoecher Apr 12, 2023
44d938e
chore(config): :wrench: conventional commit scope front&back
aljoshakoecher Apr 12, 2023
bb6edd4
fix(frontend): :bug: fixed dropdowns
aljoshakoecher Apr 12, 2023
7061901
feat(frontend): :lipstick: link to GraphDB workbench
aljoshakoecher Apr 12, 2023
47e0fe4
refactor(frontend): :recycle: code clean up and miro UI changes
aljoshakoecher Apr 13, 2023
0894b38
refactor(frontend): :recycle: improved modal handling
aljoshakoecher Apr 13, 2023
5d430e8
fix(frontend): :bug: display of currently active instance
aljoshakoecher Apr 13, 2023
7e9f799
Merge pull request #12 from aljoshakoecher/refactoring/data-model
aljoshakoecher Apr 13, 2023
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
Prev Previous commit
Next Next commit
feat(front&back): ✨ capability filter feature
  • Loading branch information
aljoshakoecher committed Apr 12, 2023
commit f148f2852287a6570d506c32d7de3ea7acf94956
2 changes: 1 addition & 1 deletion backend/src/routes/capabilities/capability.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Controller, Get, Param, Delete, Post, Query } from '@nestjs/common';
import { Controller, Get, Param, Delete, Post, Query, NotImplementedException } from '@nestjs/common';
import { CapabilityService } from './capability.service';
import { CapabilityDto } from '@shared/models/capability/Capability';
import { StringBody } from '../../custom-decorators/StringBodyDecorator';
Expand Down
7 changes: 3 additions & 4 deletions backend/src/routes/capabilities/capability.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Injectable, BadRequestException } from '@nestjs/common';
import { Injectable, BadRequestException, InternalServerErrorException } from '@nestjs/common';
import { GraphDbConnectionService } from '../../util/GraphDbConnection.service';
import { CapabilityDto } from '@shared/models/capability/Capability';
import { capabilityMapping } from './capability-mappings';
Expand Down Expand Up @@ -43,8 +43,7 @@ export class CapabilityService {
* @param capabilityType Default: Capability. Can be set to either "CaSk:ProvidedCapability" or "CaSk: RequiredCapability" to filter for one or the other
* @returns A list of capabilities
*/
async getAllCapabilities(capabilityType = "CSS:Capability"): Promise<Array<CapabilityDto>> {

async getAllCapabilities(capabilityType = "http://www.w3id.org/hsu-aut/css#Capability"): Promise<Array<CapabilityDto>> {
try {
const queryResult = await this.graphDbConnection.executeQuery(`
PREFIX VDI3682: <http://www.hsu-ifa.de/ontologies/VDI3682#>
Expand Down Expand Up @@ -74,7 +73,7 @@ export class CapabilityService {
})
}
# Filter only relevant if specific type given
FILTER(EXISTS{?capability a ${capabilityType}})
FILTER(EXISTS{?capability a <${capabilityType}>})
}`);
const capabilities = converter.convertToDefinition(queryResult.results.bindings, capabilityMapping).getFirstRootElement() as Array<CapabilityDto>;
// add skills
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div class="row">
<div class="row" [formGroup]="capabilityTypeForm">
<div class="col-12">
<div class="form-check form-check-inline form-switch">
<input class="form-check-input" [(ngModel)]="showProvided" type="checkbox" id="providedCapabilitiesSwitch">
<input class="form-check-input" formControlName="showProvided" type="checkbox" id="providedCapabilitiesSwitch">
<label class="form-check-label" for="providedCapabilitiesSwitch">Show provided capabilities</label>
</div>
</div>
<div class="col-12">
<div class="form-check form-check-inline form-switch">
<input class="form-check-input" [(ngModel)]="showRequired" type="checkbox" id="requiredCapabilitiesSwitch">
<input class="form-check-input" formControlName="showRequired" type="checkbox" id="requiredCapabilitiesSwitch">
<label class="form-check-label" for="requiredCapabilitiesSwitch">Show required capabilities</label>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { CapabilityService } from 'src/shared/services/capability.service';
import { SkillService } from 'src/shared/services/skill.service';
import { Subscription, tap } from 'rxjs';
import { CapabilityService, CapabilityTypes } from 'src/shared/services/capability.service';
import { Subscription } from 'rxjs';
import { Capability } from '../../../shared/models/Capability';
import { Skill } from '../../../shared/models/Skill';
import { HttpClient } from '@angular/common/http';
import { FormControl, FormGroup } from '@angular/forms';

@Component({
selector: 'app-capability-overview',
Expand All @@ -14,33 +13,35 @@ import { HttpClient } from '@angular/common/http';
export class CapabilityOverviewComponent implements OnInit {

constructor(
private httpClient: HttpClient,
private capabilityService: CapabilityService,
private skillService: SkillService
) {}

capabilities= new Array<Capability>();
skillsOfModule = new Array<Skill>();

showProvided = true;
showRequired = true;
capabilityTypeForm = new FormGroup({
showProvided: new FormControl(true),
showRequired: new FormControl(true)
})

capabilitySubscription: Subscription;

ngOnInit(): void {
this.capabilitySubscription = this.capabilityService.getAllCapabilities().subscribe(caps => this.capabilities = caps);
// this.skills.forEach(skill => {
// skill.relatedCapabilities.forEach(capability => {
// const foundCapability= this.executableCapabilities.find(cap=>cap.capability.iri==capability.iri);
// if (foundCapability== undefined){
// this.executableCapabilities.push(new ExecutableCapability(capability, skill));
// }
// else {
// foundCapability.skills.push(skill);
// }
// });

// });
this.loadCapabilities(CapabilityTypes.All);
this.capabilityTypeForm.valueChanges.subscribe(val => {
console.log("new val");
const {showProvided, showRequired} = val;
console.log(showProvided);
console.log(showRequired);
if(showProvided && showRequired) this.loadCapabilities(CapabilityTypes.All);
if(showProvided && !showRequired) this.loadCapabilities(CapabilityTypes.ProvidedCapability);
if(!showProvided && showRequired) this.loadCapabilities(CapabilityTypes.RequiredCapability);
if(!showProvided && !showRequired) this.capabilities = [];
});
}

loadCapabilities(type?: CapabilityTypes): void {
this.capabilitySubscription = this.capabilityService.getAllCapabilities(type).subscribe(caps => this.capabilities = caps);
}

onCapabilityDeleted(capabilityIri: string): void {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/modules/capabilities/capability.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import { CapabilityGraphVisuComponent } from './capability-graph-visu/capability
import { CapabilityRegistrationComponent } from './capability-registration/capability-registration.component';
import { SkillCardModule } from 'src/shared/modules/skill-card/skill-card.module';
import { OntologyRegistrationModule } from 'src/shared/modules/ontology-registration/ontology-registration.module';
import { FormsModule } from '@angular/forms';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CapabilityCardModule } from '../../shared/modules/capability-card/capability-card.module';

@NgModule({
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
CapabilityRoutes,
CapabilityCardModule,
SkillCardModule,
Expand Down
25 changes: 18 additions & 7 deletions frontend/src/shared/services/capability.service.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import { Injectable } from '@angular/core';
import { Observable, Observer } from 'rxjs';
import { CapabilityDto } from '@shared/models/capability/Capability';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { map, take, tap } from 'rxjs/operators';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { map, take } from 'rxjs/operators';
import { SkillService } from './skill.service';
import { Capability } from '../models/Capability';
import { environment } from '../../../environments/environment';
import { CapabilitySocketService } from './sockets/capability-socket.service';


export enum CapabilityTypes {
"All" = "http://www.w3id.org/hsu-aut/css#Capability",
"ProvidedCapability" = "http://www.w3id.org/hsu-aut/cask#ProvidedCapability",
"RequiredCapability" = "http://www.w3id.org/hsu-aut/cask#RequiredCapability"
}


@Injectable({
providedIn: 'root'
})
Expand All @@ -26,15 +34,17 @@ export class CapabilityService {
/**
* Returns all capabilities that are currently registered
*/
getAllCapabilities(): Observable<Capability[]> {
getAllCapabilities(capType?: CapabilityTypes): Observable<Capability[]> {
console.log(capType);

let capabilities;
this.loadCapabilities().pipe(take(1)).subscribe(initialCapabilities => {
this.loadCapabilities(capType).pipe(take(1)).subscribe(initialCapabilities => {
capabilities = initialCapabilities;
this.observer.next(capabilities);
});

this.capabilitySocket.getCapabilityAdded().subscribe(msg => {
this.loadCapabilities().pipe(take(1)).subscribe((newCapabilities: Capability[]) => {
this.loadCapabilities(capType).pipe(take(1)).subscribe((newCapabilities: Capability[]) => {
this.observer.next(newCapabilities);
});
});
Expand All @@ -45,9 +55,10 @@ export class CapabilityService {
/**
* Loads all capabilities from GraphDB with a single HTTP request
*/
private loadCapabilities(): Observable<Capability[]> {
private loadCapabilities(capType = CapabilityTypes.All): Observable<Capability[]> {
const apiURL = `${this.apiRoot}/capabilities`;
return this.http.get<CapabilityDto[]>(apiURL).pipe(
const typeParam = new HttpParams().append("type", capType);
return this.http.get<CapabilityDto[]>(apiURL, {params: typeParam}).pipe(
map((data: CapabilityDto[]) => data.map(capabilityDto => new Capability(capabilityDto))
));
}
Expand Down