diff --git a/pom.xml b/pom.xml index d0a1bd0..23efd90 100644 --- a/pom.xml +++ b/pom.xml @@ -290,6 +290,11 @@ org.gcube.information-system resource-registry-client + + + org.gcube.information-system + resource-registry-publisher + org.gcube.common diff --git a/src/main/java/org/gcube/informationsystem/service/InformationSystemService.java b/src/main/java/org/gcube/informationsystem/service/InformationSystemService.java index 6eca6ab..2bce2a2 100644 --- a/src/main/java/org/gcube/informationsystem/service/InformationSystemService.java +++ b/src/main/java/org/gcube/informationsystem/service/InformationSystemService.java @@ -25,11 +25,14 @@ import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.properties.Metadata; import org.gcube.informationsystem.model.reference.relations.ConsistsOf; +import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.resourceregistry.api.exceptions.entities.resource.ResourceAvailableInAnotherContextException; import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath; import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath; import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient; import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory; +import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher; +import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisherFactory; import org.gcube.informationsystem.serialization.ElementMapper; import org.gcube.informationsystem.service.dto.ContextDTO; import org.gcube.informationsystem.service.dto.ResourceTypeDTO; @@ -198,7 +201,7 @@ public class InformationSystemService { /* - * per prendere tutti le istanze di un certo tipo (per riempire la tabella) + * Fetches the instance of a certain type for a given UUID */ public String getResource(String type, String uid) throws Exception { String raw = ""; @@ -218,9 +221,9 @@ public class InformationSystemService { String currentCtx = SecretManagerProvider.instance.get().getContext(); List instancesAsObject; log.debug("getResourceInstances : [currentCtx=]",currentCtx); - ResourceRegistryClient resourceRegistryClient= ResourceRegistryClientFactory.create(currentCtx); + ResourceRegistryClient resourceRegistryClient = ResourceRegistryClientFactory.create(currentCtx); resourceRegistryClient.setIncludeMeta(true); - //questo per prendere tutte le istanze (altrimenti il default è 10) + //this fetches all the instances (otherwise 10 is the default value) resourceRegistryClient.setOffset(0); resourceRegistryClient.setLimit(-1); String instances = resourceRegistryClient.getInstances(resourceType, false); @@ -228,6 +231,29 @@ public class InformationSystemService { return instancesAsObject; } + //CRUD - 1 + public void createResourceInstance(String resourceType) throws Exception { + String currentCtx = SecretManagerProvider.instance.get().getContext(); + ResourceRegistryPublisher publisher = ResourceRegistryPublisherFactory.create(currentCtx); + //publisher.createResource(new Resource) + + } + + //CRUD - 2 + public void updateResourceInstance(String resourceType) throws Exception { + String currentCtx = SecretManagerProvider.instance.get().getContext(); + //TODO: uso la getResource (riga 206)? Però restituisce una String (JSON)... + //publisher.update(resourceTypeString, jsonString); + } + + //CRUD - 3 + //TODO: vedi se questo va passato da un REST di JHipster + public void retrieveResourceInstance(String resourceType) throws Exception { + String currentCtx = SecretManagerProvider.instance.get().getContext(); + ResourceRegistryPublisher publisher = ResourceRegistryPublisherFactory.create(currentCtx); + //TODO: quale metodo usare per ottenere una risorsa partendo da UUID? + //publisher.delete(resourceType, uuidString); + } } diff --git a/src/main/java/org/gcube/informationsystem/web/rest/InformationSystemResource.java b/src/main/java/org/gcube/informationsystem/web/rest/InformationSystemResource.java index ea853c6..06846d3 100644 --- a/src/main/java/org/gcube/informationsystem/web/rest/InformationSystemResource.java +++ b/src/main/java/org/gcube/informationsystem/web/rest/InformationSystemResource.java @@ -30,9 +30,7 @@ import org.springframework.web.util.UriUtils; import lombok.RequiredArgsConstructor; import tech.jhipster.web.util.HeaderUtil; -/** - * REST controller for managing the current user's account. - */ + @RestController @RequestMapping("/api/is") @RequiredArgsConstructor @@ -102,7 +100,6 @@ public class InformationSystemResource { return ResponseEntity.ok().body(sc); } catch (Exception e) { log.error("****ERROR*************"); - e.printStackTrace(); log.error(e.getLocalizedMessage(), e); return ResponseEntity.noContent() .headers(HeaderUtil.createAlert(applicationName, e.getLocalizedMessage(), "")).build(); @@ -119,7 +116,6 @@ public class InformationSystemResource { return ResponseEntity.ok().body(sc); } catch (Exception e) { log.error("****ERROR*************"); - e.printStackTrace(); log.error(e.getLocalizedMessage(), e); return ResponseEntity.noContent() .headers(HeaderUtil.createAlert(applicationName, e.getLocalizedMessage(), "")).build(); @@ -127,7 +123,7 @@ public class InformationSystemResource { } /* - * ritorna le istanze delle risorse di un certo tipo + * returns all the instances of resources given a certain type */ @GetMapping("/resourceinstances") public ResponseEntity resourceInstances(@RequestParam @Nullable String currentContext, @RequestParam String resourceType) { @@ -145,7 +141,7 @@ public class InformationSystemResource { } }catch(Exception e) { log.error("ERROR WHILE FILLING RESOURCEIMPL DTO"); - e.printStackTrace(); + //e.printStackTrace(); } try { ObjectMapper objectMapper = new ObjectMapper(); @@ -156,7 +152,9 @@ public class InformationSystemResource { return ResponseEntity.noContent() .headers(HeaderUtil.createAlert(applicationName, e.getLocalizedMessage(), "")).build(); } - - } + + + + } diff --git a/src/main/webapp/app/app.module.ts b/src/main/webapp/app/app.module.ts index 2082aaa..65a80f0 100644 --- a/src/main/webapp/app/app.module.ts +++ b/src/main/webapp/app/app.module.ts @@ -29,6 +29,7 @@ import { RawjsonPaneComponent } from './rawjson-pane/rawjson-pane.component'; import { ClipboardModule } from '@angular/cdk/clipboard'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { SpinnercontrolInterceptor } from './shared/spinnercontrol.interceptor'; +import { ResourcesCrudComponent } from './resources-crud/resources-crud.component'; @NgModule({ imports: [ @@ -53,7 +54,7 @@ import { SpinnercontrolInterceptor } from './shared/spinnercontrol.interceptor'; { provide: NgbDateAdapter, useClass: NgbDateDayjsAdapter }, {provide:HTTP_INTERCEPTORS,useClass:SpinnercontrolInterceptor, multi: true} ], - declarations: [MainComponent, NavbarComponent, ErrorComponent, PageRibbonComponent, ActiveMenuDirective, FooterComponent], + declarations: [MainComponent, NavbarComponent, ErrorComponent, PageRibbonComponent, ActiveMenuDirective, FooterComponent, ResourcesCrudComponent], bootstrap: [MainComponent], }) export class AppModule { diff --git a/src/main/webapp/app/home/home.component.html b/src/main/webapp/app/home/home.component.html index fc64a01..9c0444e 100644 --- a/src/main/webapp/app/home/home.component.html +++ b/src/main/webapp/app/home/home.component.html @@ -14,8 +14,8 @@ -
-

Available Resources

+
+

Resource Types

diff --git a/src/main/webapp/app/layouts/navbar/navbar.component.html b/src/main/webapp/app/layouts/navbar/navbar.component.html index c60b537..b57429a 100644 --- a/src/main/webapp/app/layouts/navbar/navbar.component.html +++ b/src/main/webapp/app/layouts/navbar/navbar.component.html @@ -2,7 +2,7 @@
- Home + Home + diff --git a/src/main/webapp/app/table-screen-es/table-screen-es.component.scss b/src/main/webapp/app/table-screen-es/table-screen-es.component.scss index e69de29..4724020 100644 --- a/src/main/webapp/app/table-screen-es/table-screen-es.component.scss +++ b/src/main/webapp/app/table-screen-es/table-screen-es.component.scss @@ -0,0 +1,24 @@ +mat-option { + font-size: 14px; + width: 100%; + display:block + } + +th.mat-header-cell, td.mat-cell, td.mat-footer-cell{ + padding:18px; +} + +.mat-header-cell { + font-size: 18px; + font-weight: 800; +} + + +::ng-deep .tableTooltip{ + transform: scale(1.5)!important; + background-color: bisque!important; + position: relative !important; + font-size: 10px; + color: black!important; + font-weight: bold; +} \ No newline at end of file diff --git a/src/main/webapp/app/table-screen-es/table-screen-es.component.ts b/src/main/webapp/app/table-screen-es/table-screen-es.component.ts index 67f10bf..08044de 100644 --- a/src/main/webapp/app/table-screen-es/table-screen-es.component.ts +++ b/src/main/webapp/app/table-screen-es/table-screen-es.component.ts @@ -33,7 +33,7 @@ import { ResourcesImplService } from 'app/services/resources-impl.service'; export class TableScreenEsComponent implements OnInit, AfterViewInit, OnChanges { //NB 'actions' CI DEVE ESSERE, altrimenti la tabella non viene visualizzata //displayedColumns: string[] = ['name', 'id', 'status', 'lastMod', 'artifact', 'group', 'version', 'endpoint','actions']; - displayedColumns: string[] = ['name', 'id', 'status', 'lastMod', 'endpoint','actions']; + displayedColumns: string[] = ['name', 'id', 'status', 'lastMod', 'endpoint','actions1','actions2','actions3']; dataFromService: IEService[]; dataSource = new MatTableDataSource(); tableDetail: IEService; diff --git a/src/main/webapp/app/table-screen/table-screen.component.html b/src/main/webapp/app/table-screen/table-screen.component.html index 205275b..f5558da 100644 --- a/src/main/webapp/app/table-screen/table-screen.component.html +++ b/src/main/webapp/app/table-screen/table-screen.component.html @@ -1,7 +1,7 @@ -
+

Type: {{resourceType}}

- + Search by Name @@ -15,7 +15,7 @@ Id - {{ item.id }} + {{ item.id }} @@ -38,10 +38,22 @@ {{ item.hdSpace }} - - Actions + + View JSON - + + + + + Edit + + + + + + Remove + + diff --git a/src/main/webapp/app/table-screen/table-screen.component.scss b/src/main/webapp/app/table-screen/table-screen.component.scss index cad18be..6897b1c 100644 --- a/src/main/webapp/app/table-screen/table-screen.component.scss +++ b/src/main/webapp/app/table-screen/table-screen.component.scss @@ -1,5 +1,3 @@ -@import url('https://fonts.googleapis.com/css?family=Roboto:400,700|Material+Icons'); - mat-option { font-size: 14px; width: 100%; @@ -13,4 +11,15 @@ th.mat-header-cell, td.mat-cell, td.mat-footer-cell{ .mat-header-cell { font-size: 18px; font-weight: 800; -} \ No newline at end of file +} + +::ng-deep .tableTooltip{ + /* your own custom styles here */ + /* e.g. */ + transform: scale(1.5)!important; + background-color: bisque!important; + position: relative !important; + font-size: 10px; + color: black!important; + font-weight: bold; +} diff --git a/src/main/webapp/app/table-screen/table-screen.component.ts b/src/main/webapp/app/table-screen/table-screen.component.ts index 6b09173..e8cbed9 100644 --- a/src/main/webapp/app/table-screen/table-screen.component.ts +++ b/src/main/webapp/app/table-screen/table-screen.component.ts @@ -32,7 +32,7 @@ import { ResourcesImplService } from 'app/services/resources-impl.service'; export class TableScreenComponent implements OnInit, AfterViewInit, OnChanges { //NB 'actions' CI DEVE ESSERE, altrimenti la tabella non viene visualizzata - displayedColumns: string[] = ['name', 'id', 'status', 'lastMod', 'avMemory', 'hdSpace', 'actions']; + displayedColumns: string[] = ['name', 'id', 'status', 'lastMod', 'avMemory', 'hdSpace', 'actions1','actions2','actions3']; dataFromService: IHostingNode[]; dataSource = new MatTableDataSource(); tableDetail: IHostingNode;