Skip to content

Commit

Permalink
Merge branch 'main' into fix-Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
juliapampus committed May 3, 2024
2 parents b6b4456 + 7ef8f8b commit 61fcbfb
Show file tree
Hide file tree
Showing 101 changed files with 17,617 additions and 17,813 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,18 @@ on:
branches:
- 'main'

# Grant permissions to obtain federated identity credentials
# see https://docs.github.com/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure
permissions:
id-token: write
contents: read

jobs:

# Build runtime image in Azure Container Registry, tagged with the commit ID.
Build:
runs-on: ubuntu-latest
steps:
# Checkout code
- uses: actions/checkout@v4

# Build Docker runtime image
- name: 'Build image'
run: docker build -t data-dashboard .

# Run Docker container
- name: 'Run container'
run: docker run -p 8080:80 -d --rm --name data-dashboard data-dashboard

# Verify docker image
- name: 'Verify container'
run: |
curl -O https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: E2E

on:
push:
branches:
- main
pull_request:

jobs:
Tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- run: |
docker compose up -d
docker compose logs -f > logs &
- uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: 'npm'

- run: npm install

- run: npm run cy

- name: Print docker logs
if: failure()
run: |
cat logs
20 changes: 20 additions & 0 deletions .github/workflows/triage-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: triage opened issue

on:
issues:
types:
- reopened
- opened

jobs:
label-issue:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- run: gh issue edit "$NUMBER" --add-label "$LABELS"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
LABELS: triage
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
30 changes: 6 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,6 @@ EDC Data Dashboard is a dev frontend application for [EDC Management API](https:

Developer documentation can be found under [docs/developer](docs/developer/), where the main concepts and decisions are captured as [decision records](docs/developer/decision-records/).

## Generate client code for EDC REST APIs

1. [optional] copy the current version of EDC's `management-api.yaml` file to `openapi/`. There is one checked in, so this is not required.
2. in a shell execute
```shell
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate -i /local/openapi/management-api.yaml -g typescript-angular -o /local/src/modules/edc-dmgmt-client/
```
This re-generates the service and model classes.

> Please note that some of the client classes were edited manually after generation. When regenerating the classes for the API update be careful especially not to overwrite service `constructor` methods using the generator!

## Running the frontend locally
Should you want to run the frontend on your development machine, you'll have to configure some backend values. Those are stored in `app.config.json`, and
by default contain the following:
Expand All @@ -41,25 +30,18 @@ Substitute the values as necessary:

As some extra safety consider running `git udpate-index --assume-unchanged src/assets/config/app.config.json` before changing this file.

## Running a frontend and a connector locally (for demo purpose)
## Running a frondend and two connectors locally (for demo purpose)
To test the correct functionality locally you can spin up a local docker compose
that will load the `data-dashboard` service and the `connector` one.
First you need to change the `app.config.json` this way:
```json
{
...
"managementApiUrl": "http://consumer-connector/management",
"catalogUrl": "http://consumer-connector/management",
...
}
```
that will load two `data-dashboard`s service and two `connector`s, one for consumer
and one for provider.

Then you can start the docker compose:
Just start the docker compose.
```shell
docker compose up
```

The DataDashboard will be available at `http://localhost:8080`
Consumer data-dashboard will be available at `http://localhost:18080`
Provider data-dashboard will be available at `http://localhost:28080`

### Running DataDashboard from the host machine (for debugging purpose)
To have a quicker development cycle, you can also run the DataDashboard from the
Expand Down
18 changes: 10 additions & 8 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1.2mb"
"maximumWarning": "1.5mb",
"maximumError": "2mb"
},
{
"type": "anyComponentStyle",
Expand Down Expand Up @@ -77,21 +77,21 @@
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "edc-demo-client:build:production"
"buildTarget": "edc-demo-client:build:production"
},
"development": {
"browserTarget": "edc-demo-client:build:development"
"buildTarget": "edc-demo-client:build:development"
}
},
"options": {
"browserTarget": "project-name:build"
"buildTarget": "project-name:build"
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "edc-demo-client:build"
"buildTarget": "edc-demo-client:build"
}
},
"test": {
Expand All @@ -114,6 +114,8 @@
}
}
}
},
"defaultProject": "edc-demo-client"
},
"cli": {
"analytics": false
}
}
13 changes: 13 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from 'cypress'

export default defineConfig({
e2e: {
baseUrl: 'http://localhost:18080',
supportFile: false,
experimentalStudio: true
},
env: {
consumerUrl: 'http//localhost:18080',
providerUrl: 'http//localhost:28080',
},
})
32 changes: 32 additions & 0 deletions cypress/e2e/spec.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
describe('end-to-end', () => {
const uuid = () => Cypress._.random(0, 1e6)
const consumerUrl = Cypress.env('consumerUrl')
const providerUrl = Cypress.env('providerUrl')

it('should be accessible', () => {
cy.visit(consumerUrl);

cy.visit(providerUrl);
})

it('should create an asset and view it on provider side', function() {
cy.visit(providerUrl);

const id = uuid()
const name = `asset-${id}`

cy.get('[href="/my-assets"]').as('assets-menu-item').click();
cy.get('#mat-input-0').as('asset-filter')
cy.get('.container').contains('Create asset').as('open-new-asset-dialog').click();
cy.get('#mat-input-1').as('asset-id-field').clear();
cy.get('@asset-id-field').type(id);
cy.get('#mat-input-2').as('asset-name-field').clear('ra');
cy.get('@asset-name-field').type(name);
cy.get('mat-dialog-actions').click().contains('Create').as('confirm-create-asset').click();

cy.get('@asset-filter').click({force: true}).type(name);

cy.get('[fxLayout="row wrap"]').as('assets-list').find('mat-card').should('have.length', 1)
});

})
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ edc.transfer.send.retry.limit=1
edc.transfer.send.retry.base-delay.ms=10
edc.transfer.state-machine.iteration-wait-millis=10

edc.federated.node.url=http://provider-connector:9194/protocol

edc.web.rest.cors.enabled=true
8 changes: 8 additions & 0 deletions deployment/conf/consumer.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"apiKey": "ApiKeyDefaultValue",
"managementApiUrl": "http://localhost:18080/management",
"catalogUrl": "http://localhost:18080/management",
"storageAccount": "company2assets",
"storageExplorerLinkTemplate": "storageexplorer://v=1",
"theme": "theme-2"
}
19 changes: 19 additions & 0 deletions deployment/conf/consumer.nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
events {}
http {
include /etc/nginx/mime.types;
server {
listen 80;
server_name localhost;

root /usr/share/nginx/html;
index index.html;

location / {
try_files $uri $uri/ /index.html;
}

location /management {
proxy_pass http://consumer-connector:9193/management;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ edc.negotiation.state-machine.iteration-wait-millis=100
edc.transfer.send.retry.limit=1
edc.transfer.send.retry.base-delay.ms=10
edc.transfer.state-machine.iteration-wait-millis=10

edc.federated.node.url=http://consumer-connector:9194/protocol
8 changes: 8 additions & 0 deletions deployment/conf/provider.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"apiKey": "ApiKeyDefaultValue",
"managementApiUrl": "http://localhost:28080/management",
"catalogUrl": "http://localhost:28080/management",
"storageAccount": "company2assets",
"storageExplorerLinkTemplate": "storageexplorer://v=1",
"theme": "theme-2"
}
19 changes: 19 additions & 0 deletions deployment/conf/provider.nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
events {}
http {
include /etc/nginx/mime.types;
server {
listen 80;
server_name localhost;

root /usr/share/nginx/html;
index index.html;

location / {
try_files $uri $uri/ /index.html;
}

location /management {
proxy_pass http://provider-connector:9193/management;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
*
*/

package org.eclipse.edc.datadashboard;

import org.eclipse.edc.catalog.spi.FederatedCacheNode;
import org.eclipse.edc.catalog.spi.FederatedCacheNodeDirectory;
import org.eclipse.edc.connector.dataplane.selector.spi.instance.DataPlaneInstance;
import org.eclipse.edc.connector.dataplane.selector.spi.store.DataPlaneInstanceStore;
import org.eclipse.edc.runtime.metamodel.annotation.Extension;
import org.eclipse.edc.runtime.metamodel.annotation.Inject;
import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;

import java.util.List;
import java.util.UUID;

@Extension(value = DataDashboardLocalExtension.NAME)
public class DataDashboardLocalExtension implements ServiceExtension {

public static final String NAME = "DataDashboard Local - please do not use in production";

@Inject
private FederatedCacheNodeDirectory federatedCacheNodeDirectory;

@Inject
private DataPlaneInstanceStore dataPlaneInstanceStore;

@Override
public String name() {
return NAME;
}

@Override
public void initialize(ServiceExtensionContext context) {
var nodeUrl = context.getSetting("edc.federated.node.url", null);
if (nodeUrl != null) {
context.getMonitor().info("Register federated node: %s".formatted(nodeUrl));
federatedCacheNodeDirectory.insert(new FederatedCacheNode(UUID.randomUUID().toString(), nodeUrl, List.of("dataspace-protocol-http")));
}
}

@Override
public void start() {
var dataPlaneInstance = DataPlaneInstance.Builder.newInstance()
.url("http://localhost:9192/control/transfer")
.allowedSourceType("HttpData")
.allowedDestType("HttpData")
.build();
dataPlaneInstanceStore.create(dataPlaneInstance);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.eclipse.edc.datadashboard.DataDashboardLocalExtension
Loading

0 comments on commit 61fcbfb

Please sign in to comment.