diff --git a/.github/workflows/system-testing.yml b/.github/workflows/system-testing.yml index cc41ccac..45261318 100644 --- a/.github/workflows/system-testing.yml +++ b/.github/workflows/system-testing.yml @@ -5,7 +5,6 @@ on: types: [opened, reopened, synchronize] branches: - main - - slu/e2eExternal jobs: trigger-system-tests: @@ -89,7 +88,7 @@ jobs: echo " PR URL: ${{ github.event.pull_request.html_url }}" echo "" - # Trigger E2E tests in DOME-testing repository + # Trigger E2E tests in E2E-DOME-BAE repository echo "Triggering E2E tests..." curl -X POST \ -H "Authorization: token ${{ secrets.ADMIN }}" \ @@ -108,6 +107,6 @@ jobs: \"pull_request_url\": \"${{ github.event.pull_request.html_url }}\" } }" \ - https://api.github.com/repos/sluFicodes/DOME-testing/dispatches + https://api.github.com/repos/sluFicodes/E2E-DOME-BAE/dispatches echo "E2E tests triggered successfully!" diff --git a/cypress/e2e/catalog.cy.ts b/cypress/e2e/catalog.cy.ts index 0e9a5067..4cbe45a0 100644 --- a/cypress/e2e/catalog.cy.ts +++ b/cypress/e2e/catalog.cy.ts @@ -31,7 +31,7 @@ describe('/my-offerings',{ cy.visit('/my-offerings') cy.wait('@catalog') - cy.get('@catalog.all').should('have.length', 2) + cy.get('@catalog.all').should('have.length', 4) cy.getBySel('newCatalog').click() cy.getBySel('catalogName').type(name) cy.getBySel('catalogDsc').type(description) @@ -72,7 +72,7 @@ describe('/my-offerings',{ cy.visit('/my-offerings') cy.wait('@catalog') - cy.get('@catalog.all').should('have.length', 2) + cy.get('@catalog.all').should('have.length', 4) cy.getBySel('newCatalog').click() cy.getBySel('catalogName').type(name) cy.getBySel('catalogDsc').type(description) diff --git a/cypress/support/constants.ts b/cypress/support/constants.ts index a6d78a4c..9a446c3b 100644 --- a/cypress/support/constants.ts +++ b/cypress/support/constants.ts @@ -22,7 +22,8 @@ export const init_config = { 'domeRegister': 'https://dome-marketplace.github.io/onboarding/', 'domePublish': 'https://knowledgebase.dome-marketplace.org/shelves/company-onboarding-process', 'purchaseEnabled': false, - 'defaultId': 'urn:ngsi-ld:catalog:32828e1d-4652-4f4c-b13e-327450ce83c6' + 'defaultId': 'urn:ngsi-ld:catalog:32828e1d-4652-4f4c-b13e-327450ce83c6', + "theme": "DOME" } @@ -109,6 +110,21 @@ export const login_token = () => { } } +export const default_catalog = { + "id": "urn:ngsi-ld:catalog:32828e1d-4652-4f4c-b13e-327450ce83c6", + "href": "urn:ngsi-ld:catalog:32828e1d-4652-4f4c-b13e-327450ce83c6", + "lifecycleStatus": "Launched", + "name": "default", + "version": "1.0", + "category": [ + { + "id": "urn:ngsi-ld:category:26435cca-2707-4c89-8f0c-79464573c9e2", + "href": "urn:ngsi-ld:category:26435cca-2707-4c89-8f0c-79464573c9e2", + "name": "dft cat" + } + ] +} + export const catalog_launched = [ { "id": "urn:ngsi-ld:catalog:32828e1d-4652-4f4c-b13e-327450ce83c6", @@ -194,7 +210,9 @@ export const local_items = { cy.intercept( {method:'GET', url: 'http://proxy.docker:8004/stats'}, init_stat).as('stats') //cy.intercept( {method: 'GET', url: 'http://proxy.docker:8004/catalog/productOffering?*'}, product_offering).as('productOffering') cy.intercept( {method: 'GET', url: 'http://proxy.docker:8004/config'}, init_config).as('config') - cy.intercept( {method:'GET', url: 'http://proxy.docker:8004/catalog/category?*'}, category_launched).as('category') + //cy.intercept('GET', '**/catalog/category/urn:ngsi-ld:category:*', category_dft).as('category'); + cy.intercept({method: 'GET', url: 'catalog/catalog/?*'}, default_catalog).as('catalog') + cy.intercept( {method: 'GET', url: 'http://proxy.docker:8004/catalog/category/?*'}, category_dft).as('category') // Verify mocks are called 1 time cy.visit('/', {onBeforeLoad(win) { win.localStorage.setItem('color-theme', 'dark'); @@ -205,6 +223,8 @@ export const local_items = { cy.get('@config.all').should('have.length', 1) //cy.wait('@productOffering') //cy.get('@productOffering.all').should('have.length', 1) + cy.wait('@catalog') + cy.get('@catalog.all').should('have.length', 1) cy.wait('@category') cy.get('@category.all').should('have.length', 1) // Verify header interactive elemements are displayed and work as expected @@ -277,6 +297,8 @@ export const loginAcc = () => { cy.get('@config.all').should('have.length', 2) //cy.wait('@productOffering') //cy.get('@productOffering.all').should('have.length', 2) + cy.wait('@catalog') + cy.get('@catalog.all').should('have.length', 2) cy.wait('@category') cy.get('@category.all').should('have.length', 2) cy.wait('@login_token') diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 10f768a5..d42cd461 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -102,10 +102,12 @@ const routes: Routes = [ component: BlogEntryDetailComponent }, { path: 'blog-entry', - component: EntryFormComponent + component: EntryFormComponent, + canActivate: [AuthGuard], data: { roles: ['admin'] } }, { path: 'blog-entry/:id', - component: EntryFormComponent + component: EntryFormComponent, + canActivate: [AuthGuard], data: { roles: ['admin'] } }, { path: '**', redirectTo: 'dashboard', pathMatch: 'full' }, ] diff --git a/src/app/app.component.css b/src/app/app.component.css index 463d9bcb..e69de29b 100644 --- a/src/app/app.component.css +++ b/src/app/app.component.css @@ -1,8 +0,0 @@ - - -.bae-content { - width: 100%; - min-height: calc(100vh - 100px) !important; - padding-top: 75px !important; - padding-bottom: 25px !important; -} diff --git a/src/app/app.component.html b/src/app/app.component.html index 24e84480..c714a878 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,11 +1,13 @@ -
+
@if(providerThemeName=='DOME') { - + } - + + + @if(isProduction){ } \ No newline at end of file diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 5e569362..991a4490 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -77,7 +77,7 @@ export class AppComponent implements OnInit { console.log(((info.expire - moment().unix()) - 4)) this.refreshApi.startInterval(((info.expire - moment().unix())-4)*1000, ev); - + initFlowbite(); //this.refreshApi.startInterval(3000, ev.value); } }) @@ -92,6 +92,7 @@ export class AppComponent implements OnInit { this.refreshApi.startInterval(((aux.expire - moment().unix())-4)*1000, aux); console.log('token') console.log(aux.token) + initFlowbite(); } this.router.events.subscribe(event => { if (event instanceof NavigationEnd) { diff --git a/src/app/chatbot-widget/chatbot-widget.component.html b/src/app/chatbot-widget/chatbot-widget.component.html index 494dd6dd..bed89750 100644 --- a/src/app/chatbot-widget/chatbot-widget.component.html +++ b/src/app/chatbot-widget/chatbot-widget.component.html @@ -32,7 +32,7 @@

DOME support

} -
+
+ + +
+ } @else if (credentialsConfigSelected || policyConfigSelected){ +
+ + +
}
@@ -730,8 +745,8 @@

{{ 'CREATE_

}@else{ -
- +
+
@@ -830,8 +845,8 @@

{{ 'CREATE_ }@else{ -
- +
+
diff --git a/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.ts b/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.ts index 777c1421..09804bab 100644 --- a/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.ts +++ b/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.ts @@ -84,11 +84,13 @@ export class CreateProductSpecComponent implements OnInit { //CHARS INFO charsForm = new FormGroup({ name: new FormControl('', [Validators.required, Validators.maxLength(100), noWhitespaceValidator]), - description: new FormControl('') + description: new FormControl('', [Validators.maxLength(500)]) }); stringCharSelected:boolean=true; numberCharSelected:boolean=false; rangeCharSelected:boolean=false; + credentialsConfigSelected:boolean=false; + policyConfigSelected:boolean=false; booleanCharSelected:boolean=false; prodChars:ProductSpecificationCharacteristic[]=[]; finishChars:ProductSpecificationCharacteristic[]=[]; @@ -172,6 +174,7 @@ export class CreateProductSpecComponent implements OnInit { toValue: string = ''; booleanValue: boolean = false; rangeUnit: string = ''; + jsonValue: string = ''; filenameRegex = /^[A-Za-z0-9_.-]+$/; @@ -627,6 +630,8 @@ export class CreateProductSpecComponent implements OnInit { this.stringCharSelected=true; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.booleanCharSelected=false; this.showPreview=false; this.refreshChars(); @@ -932,9 +937,12 @@ export class CreateProductSpecComponent implements OnInit { this.fromValue = ''; this.toValue = ''; this.rangeUnit = ''; + this.jsonValue = ''; this.stringCharSelected=true; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.booleanCharSelected=false; this.creatingChars=[]; } @@ -999,24 +1007,48 @@ export class CreateProductSpecComponent implements OnInit { this.stringCharSelected=true; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.booleanCharSelected=false; this.charsForm.reset(); }else if (event.target.value=='number'){ this.stringCharSelected=false; this.numberCharSelected=true; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.booleanCharSelected=false; this.charsForm.reset(); - }else if (event.target.value=='range'){ + }else if(event.target.value=='range'){ this.stringCharSelected=false; this.numberCharSelected=false; this.rangeCharSelected=true; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; + this.booleanCharSelected=false; + this.charsForm.reset(); + }else if(event.target.value=='credentialsConfiguration'){ + this.stringCharSelected=false; + this.numberCharSelected=false; + this.rangeCharSelected=false; + this.credentialsConfigSelected=true; + this.policyConfigSelected=false; + this.booleanCharSelected=false; + this.charsForm.reset(); + }else if(event.target.value=='authorizationPolicy'){ + this.stringCharSelected=false; + this.numberCharSelected=false; + this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=true; this.booleanCharSelected=false; this.charsForm.reset(); } else { this.stringCharSelected=false; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.booleanCharSelected=true; // Set default only if not already selected if (!this.charsForm.get('name')?.value && this.nonBooleanChars.length > 0) { @@ -1044,7 +1076,7 @@ export class CreateProductSpecComponent implements OnInit { value:this.stringValue as any }) } - this.stringValue=''; + this.stringValue=''; } else if (this.numberCharSelected){ console.log('number') if(this.creatingChars.length==0){ @@ -1077,7 +1109,33 @@ export class CreateProductSpecComponent implements OnInit { valueFrom:this.fromValue as any, valueTo:this.toValue as any, unitOfMeasure:this.rangeUnit}) - } + } + this.fromValue=''; + this.toValue=''; + this.rangeUnit=''; + }else if(this.credentialsConfigSelected || this.policyConfigSelected){ + console.log('json') + try { + const jsonObj = JSON.parse(this.jsonValue); + if(this.creatingChars.length==0){ + this.creatingChars.push({ + isDefault:true, + value:jsonObj as any + }) + } else{ + this.creatingChars.push({ + isDefault:false, + value:jsonObj as any + }) + } + this.jsonValue=''; + } catch (e) { + this.errorMessage='Invalid JSON format'; + this.showError=true; + setTimeout(() => { + this.showError = false; + }, 3000); + } } else { console.log('boolean') if(this.creatingChars.length==0){ @@ -1115,22 +1173,32 @@ export class CreateProductSpecComponent implements OnInit { if(this.booleanCharSelected){ this.creatingChars=[ { - isDefault:true, + isDefault:false, value: true as any }, { - isDefault:false, + isDefault:true, value:false as any } ] } if(this.charsForm.value.name!=null){ - this.prodChars.push({ + let characteristic: any = { id: 'urn:ngsi-ld:characteristic:'+uuidv4(), name: this.charsForm.value.name, description: this.charsForm.value.description != null ? this.charsForm.value.description : '', productSpecCharacteristicValue: this.creatingChars - }) + }; + + if(this.credentialsConfigSelected){ + characteristic.valueType = 'credentialsConfiguration'; + characteristic['@schemaLocation'] = 'https://raw.githubusercontent.com/FIWARE/contract-management/refs/heads/main/schemas/credentials/credentialConfigCharacteristic.json'; + } else if(this.policyConfigSelected){ + characteristic.valueType = 'authorizationPolicy'; + characteristic['@schemaLocation'] = 'https://raw.githubusercontent.com/FIWARE/contract-management/refs/heads/policy-support/schemas/odrl/policyCharacteristic.json'; + } + + this.prodChars.push(characteristic); // Check if it's not a boolean-enabled characteristic if (!this.charsForm.value.name.endsWith('- enabled')) { @@ -1159,6 +1227,8 @@ export class CreateProductSpecComponent implements OnInit { this.stringCharSelected=true; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.refreshChars(); this.cdr.detectChanges(); } diff --git a/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.html b/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.html index 540070be..b8aaf27b 100644 --- a/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.html +++ b/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.html @@ -688,7 +688,7 @@

There's no char
-
diff --git a/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.ts b/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.ts index 0cfb55ad..84df4494 100644 --- a/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.ts +++ b/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.ts @@ -79,7 +79,7 @@ export class UpdateProductSpecComponent implements OnInit { //CHARS INFO charsForm = new FormGroup({ name: new FormControl('', [Validators.required, Validators.maxLength(100), noWhitespaceValidator]), - description: new FormControl('') + description: new FormControl('', [Validators.maxLength(500)]) }); stringCharSelected:boolean=true; numberCharSelected:boolean=false; @@ -332,6 +332,8 @@ export class UpdateProductSpecComponent implements OnInit { id: 'urn:ngsi-ld:characteristic:'+uuidv4(), name: this.prod.productSpecCharacteristic[i].name, description: this.prod.productSpecCharacteristic[i].description ? this.prod.productSpecCharacteristic[i].description : '', + valueType: this.prod.productSpecCharacteristic[i].valueType, + '@schemaLocation': this.prod.productSpecCharacteristic[i]['@schemaLocation'], productSpecCharacteristicValue: this.prod.productSpecCharacteristic[i].productSpecCharacteristicValue }); @@ -1329,11 +1331,11 @@ export class UpdateProductSpecComponent implements OnInit { if(this.booleanCharSelected){ this.creatingChars=[ { - isDefault:true, + isDefault:false, value: true as any }, { - isDefault:false, + isDefault:true, value:false as any } ] @@ -1476,11 +1478,10 @@ export class UpdateProductSpecComponent implements OnInit { lifecycleStatus: this.prodStatus, //isBundle: this.bundleChecked, //bundledProductSpecification: this.prodSpecsBundle, - productSpecCharacteristic: this.finishChars, productSpecificationRelationship: rels, attachment: this.prodAttachments, resourceSpecification: this.selectedResourceSpecs, - serviceSpecification: this.selectedServiceSpecs + serviceSpecification: this.selectedServiceSpecs } } this.selectStep('summary','summary-circle'); diff --git a/src/app/pages/seller-offerings/offerings/seller-resource-spec/create-resource-spec/create-resource-spec.component.html b/src/app/pages/seller-offerings/offerings/seller-resource-spec/create-resource-spec/create-resource-spec.component.html index 411fa7e9..7cb9ec39 100644 --- a/src/app/pages/seller-offerings/offerings/seller-resource-spec/create-resource-spec/create-resource-spec.component.html +++ b/src/app/pages/seller-offerings/offerings/seller-resource-spec/create-resource-spec/create-resource-spec.component.html @@ -69,16 +69,16 @@

{{ 'CREATE_PROD_SPEC._finish' | tra

{{ 'CREATE_RES_SPEC._general' | translate }}

- - + - +
-
} @else {
- - +
-
@@ -240,9 +240,9 @@

{{ 'CREATE_ @if(stringCharSelected){
- -
{{ 'CREATE_RES_SPEC._unit' | translate }} - -
- - + + } @else if (rangeCharSelected && creatingChars.length==0){
@@ -277,43 +277,43 @@

{{ 'CREATE_ {{ 'CREATE_RES_SPEC._from' | translate }} -

{{ 'CREATE_RES_SPEC._to' | translate }} -
{{ 'CREATE_RES_SPEC._unit' | translate }} -
- + + }
-
}
-
--> -