From b79ff55b6d039557cab00f7c2fc16cb5fc9f1d75 Mon Sep 17 00:00:00 2001 From: david zynda Date: Wed, 20 Dec 2023 16:07:46 +0100 Subject: [PATCH 1/5] WiP: sign/decline option --- src/assets/MOCK/IMR18650V1.json | 745 +++++++++++--------- src/assets/MOCK/search.json | 60 ++ src/components/general/LoadingComponent.vue | 1 + src/components/general/StepperItem.vue | 124 ++++ src/services/BackendService.js | 26 +- src/store/index.js | 75 +- src/views/PassportView.vue | 9 +- 7 files changed, 688 insertions(+), 352 deletions(-) create mode 100644 src/assets/MOCK/search.json diff --git a/src/assets/MOCK/IMR18650V1.json b/src/assets/MOCK/IMR18650V1.json index 6af879090..28ae2b84e 100644 --- a/src/assets/MOCK/IMR18650V1.json +++ b/src/assets/MOCK/IMR18650V1.json @@ -1,406 +1,475 @@ { - "status" : 200, - "data" : { - "metadata" : { - "contract" : { - "@id" : "9b3c0977-6b14-4201-bd76-55f681a92872", - "@type" : "dcat:Dataset", - "odrl:hasPolicy" : { - "@id" : "3:365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918:dc616f20-2781-450a-837a-290d861c8e0a", - "@type" : "odrl:Set", - "odrl:permission" : [ ], - "odrl:prohibition" : [ ], - "odrl:obligation" : [ ], - "odrl:target" : "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918" + "status": 200, + "data": { + "metadata": { + "contract": { + "@id": "9b3c0977-6b14-4201-bd76-55f681a92872", + "@type": "dcat:Dataset", + "odrl:hasPolicy": { + "@id": "3:365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918:dc616f20-2781-450a-837a-290d861c8e0a", + "@type": "odrl:Set", + "odrl:permission": [ + { + "odrl:target": "urn:uuid:d6a0ed29-8ba4-fc00-169c-72d3986e4684", + "odrl:action": { + "odrl:type": "USE" + }, + "odrl:constraint": { + "odrl:or": { + "odrl:leftOperand": "PURPOSE", + "odrl:operator": { + "@id": "odrl:eq" + }, + "odrl:rightOperand": "ID 3.0 Trace" + } + } + }, + { + "odrl:target": "urn:uuid:d6a0ed29-8ba4-fc00-169c-72d3986e4684", + "odrl:action": { + "odrl:type": "ACCESS" + }, + "odrl:constraint": { + "odrl:or": { + "odrl:leftOperand": "PURPOSE", + "odrl:operator": { + "@id": "odrl:eq" + }, + "odrl:rightOperand": "DPP" + } + } + } + ], + "odrl:prohibition": [], + "odrl:obligation": [], + "odrl:target": "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918" }, - "dcat:distribution" : [ { - "@type" : "dcat:Distribution", - "dct:format" : { - "@id" : "HttpProxy" - }, - "dcat:accessService" : "1795254a-e354-46c7-9d88-04608b05ca9f" - }, { - "@type" : "dcat:Distribution", - "dct:format" : { - "@id" : "AmazonS3" + "dcat:distribution": [ + { + "@type": "dcat:Distribution", + "dct:format": { + "@id": "HttpProxy" + }, + "dcat:accessService": "1795254a-e354-46c7-9d88-04608b05ca9f" }, - "dcat:accessService" : "1795254a-e354-46c7-9d88-04608b05ca9f" - } ], - "edc:description" : "Battery Passport test data", - "edc:id" : "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918" + { + "@type": "dcat:Distribution", + "dct:format": { + "@id": "AmazonS3" + }, + "dcat:accessService": "1795254a-e354-46c7-9d88-04608b05ca9f" + } + ], + "edc:description": "Battery Passport test data", + "edc:id": "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918" }, - "negotiation" : { - "init" : { - "request" : { - "@context" : { - "odrl" : "http://www.w3.org/ns/odrl/2/" + "negotiation": { + "init": { + "request": { + "@context": { + "odrl": "http://www.w3.org/ns/odrl/2/" }, - "@type" : "NegotiationInitiateRequestDto", - "connectorAddress" : "https://materialpass.dev.demo.catena-x.net/BPNL000000000000/api/v1/dsp", - "protocol" : "dataspace-protocol-http", - "connectorId" : "BPNL00000000CBA5", - "offer" : { - "offerId" : "3:365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918:dc616f20-2781-450a-837a-290d861c8e0a", - "assetId" : "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918", - "policy" : { - "@type" : "odrl:Set", - "odrl:permission" : [ ], - "odrl:prohibition" : [ ], - "odrl:obligation" : [ ], - "odrl:target" : "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918" + "@type": "NegotiationInitiateRequestDto", + "connectorAddress": "https://materialpass.dev.demo.catena-x.net/BPNL000000000000/api/v1/dsp", + "protocol": "dataspace-protocol-http", + "connectorId": "BPNL00000000CBA5", + "offer": { + "offerId": "3:365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918:dc616f20-2781-450a-837a-290d861c8e0a", + "assetId": "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918", + "policy": { + "@type": "odrl:Set", + "odrl:permission": [], + "odrl:prohibition": [], + "odrl:obligation": [], + "odrl:target": "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918" } } }, - "response" : { - "@id" : "b8a41089-1eac-462a-b8e8-e40f724b302f", - "@type" : "edc:IdResponseDto", - "edc:createdAt" : 1688393629505, - "@context" : { - "dct" : "https://purl.org/dc/terms/", - "tx" : "https://w3id.org/tractusx/v0.0.1/ns/", - "edc" : "https://w3id.org/edc/v0.0.1/ns/", - "dcat" : "https://www.w3.org/ns/dcat/", - "odrl" : "http://www.w3.org/ns/odrl/2/", - "dspace" : "https://w3id.org/dspace/v0.8/" + "response": { + "@id": "b8a41089-1eac-462a-b8e8-e40f724b302f", + "@type": "edc:IdResponseDto", + "edc:createdAt": 1688393629505, + "@context": { + "dct": "https://purl.org/dc/terms/", + "tx": "https://w3id.org/tractusx/v0.0.1/ns/", + "edc": "https://w3id.org/edc/v0.0.1/ns/", + "dcat": "https://www.w3.org/ns/dcat/", + "odrl": "http://www.w3.org/ns/odrl/2/", + "dspace": "https://w3id.org/dspace/v0.8/" } } }, - "get" : { - "response" : { - "@id" : "b8a41089-1eac-462a-b8e8-e40f724b302f", - "@type" : "edc:ContractNegotiationDto", - "edc:type" : "CONSUMER", - "edc:protocol" : "dataspace-protocol-http", - "edc:state" : "FINALIZED", - "edc:counterPartyAddress" : "https://materialpass.dev.demo.catena-x.net/BPNL000000000000/api/v1/dsp", - "edc:callbackAddresses" : [ ], - "edc:contractAgreementId" : "3:365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918:102bae7a-22de-44b2-9ed5-ca5f62023390", - "@context" : { - "dct" : "https://purl.org/dc/terms/", - "tx" : "https://w3id.org/tractusx/v0.0.1/ns/", - "edc" : "https://w3id.org/edc/v0.0.1/ns/", - "dcat" : "https://www.w3.org/ns/dcat/", - "odrl" : "http://www.w3.org/ns/odrl/2/", - "dspace" : "https://w3id.org/dspace/v0.8/" + "get": { + "response": { + "@id": "b8a41089-1eac-462a-b8e8-e40f724b302f", + "@type": "edc:ContractNegotiationDto", + "edc:type": "CONSUMER", + "edc:protocol": "dataspace-protocol-http", + "edc:state": "FINALIZED", + "edc:counterPartyAddress": "https://materialpass.dev.demo.catena-x.net/BPNL000000000000/api/v1/dsp", + "edc:callbackAddresses": [], + "edc:contractAgreementId": "3:365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918:102bae7a-22de-44b2-9ed5-ca5f62023390", + "@context": { + "dct": "https://purl.org/dc/terms/", + "tx": "https://w3id.org/tractusx/v0.0.1/ns/", + "edc": "https://w3id.org/edc/v0.0.1/ns/", + "dcat": "https://www.w3.org/ns/dcat/", + "odrl": "http://www.w3.org/ns/odrl/2/", + "dspace": "https://w3id.org/dspace/v0.8/" } } } }, - "transfer" : { - "init" : { - "request" : { - "@context" : { - "odrl" : "http://www.w3.org/ns/odrl/2/" + "transfer": { + "init": { + "request": { + "@context": { + "odrl": "http://www.w3.org/ns/odrl/2/" }, - "assetId" : "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918", - "connectorAddress" : "https://materialpass.dev.demo.catena-x.net/BPNL000000000000/api/v1/dsp", - "contractId" : "3:365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918:102bae7a-22de-44b2-9ed5-ca5f62023390", - "dataDestination" : { - "properties" : { - "type" : "HttpProxy" + "assetId": "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918", + "connectorAddress": "https://materialpass.dev.demo.catena-x.net/BPNL000000000000/api/v1/dsp", + "contractId": "3:365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918:102bae7a-22de-44b2-9ed5-ca5f62023390", + "dataDestination": { + "properties": { + "type": "HttpProxy" } }, - "managedResources" : false, - "privateProperties" : { - "receiverHttpEndpoint" : "https://materialpass.dev.demo.catena-x.net/endpoint/bb8d235e-96c1-4fa3-a9ea-2ec71255ed18" + "managedResources": false, + "privateProperties": { + "receiverHttpEndpoint": "https://materialpass.dev.demo.catena-x.net/endpoint/bb8d235e-96c1-4fa3-a9ea-2ec71255ed18" }, - "protocol" : "dataspace-protocol-http", - "transferType" : { - "contentType" : "application/octet-stream", - "isFinite" : true + "protocol": "dataspace-protocol-http", + "transferType": { + "contentType": "application/octet-stream", + "isFinite": true } }, - "response" : { - "@id" : "b9ab18f2-b624-4e2c-a922-c2e727467bb2", - "@type" : "edc:IdResponseDto", - "edc:createdAt" : 1688393631831, - "@context" : { - "dct" : "https://purl.org/dc/terms/", - "tx" : "https://w3id.org/tractusx/v0.0.1/ns/", - "edc" : "https://w3id.org/edc/v0.0.1/ns/", - "dcat" : "https://www.w3.org/ns/dcat/", - "odrl" : "http://www.w3.org/ns/odrl/2/", - "dspace" : "https://w3id.org/dspace/v0.8/" + "response": { + "@id": "b9ab18f2-b624-4e2c-a922-c2e727467bb2", + "@type": "edc:IdResponseDto", + "edc:createdAt": 1688393631831, + "@context": { + "dct": "https://purl.org/dc/terms/", + "tx": "https://w3id.org/tractusx/v0.0.1/ns/", + "edc": "https://w3id.org/edc/v0.0.1/ns/", + "dcat": "https://www.w3.org/ns/dcat/", + "odrl": "http://www.w3.org/ns/odrl/2/", + "dspace": "https://w3id.org/dspace/v0.8/" } } }, - "get" : { - "response" : { - "@id" : "b9ab18f2-b624-4e2c-a922-c2e727467bb2", - "@type" : "edc:TransferProcessDto", - "edc:state" : "COMPLETED", - "edc:stateTimestamp" : 1688393633142, - "edc:type" : "CONSUMER", - "edc:callbackAddresses" : [ ], - "edc:dataDestination" : { - "edc:type" : "HttpProxy" + "get": { + "response": { + "@id": "b9ab18f2-b624-4e2c-a922-c2e727467bb2", + "@type": "edc:TransferProcessDto", + "edc:state": "COMPLETED", + "edc:stateTimestamp": 1688393633142, + "edc:type": "CONSUMER", + "edc:callbackAddresses": [], + "edc:dataDestination": { + "edc:type": "HttpProxy" }, - "edc:dataRequest" : { - "@id" : "b9ab18f2-b624-4e2c-a922-c2e727467bb2", - "@type" : "edc:DataRequestDto", - "edc:assetId" : "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918", - "edc:contractId" : "3:365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918:102bae7a-22de-44b2-9ed5-ca5f62023390" + "edc:dataRequest": { + "@id": "b9ab18f2-b624-4e2c-a922-c2e727467bb2", + "@type": "edc:DataRequestDto", + "edc:assetId": "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918", + "edc:contractId": "3:365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918:102bae7a-22de-44b2-9ed5-ca5f62023390" }, - "edc:receiverHttpEndpoint" : "https://materialpass.dev.demo.catena-x.net/endpoint/bb8d235e-96c1-4fa3-a9ea-2ec71255ed18", - "@context" : { - "dct" : "https://purl.org/dc/terms/", - "tx" : "https://w3id.org/tractusx/v0.0.1/ns/", - "edc" : "https://w3id.org/edc/v0.0.1/ns/", - "dcat" : "https://www.w3.org/ns/dcat/", - "odrl" : "http://www.w3.org/ns/odrl/2/", - "dspace" : "https://w3id.org/dspace/v0.8/" + "edc:receiverHttpEndpoint": "https://materialpass.dev.demo.catena-x.net/endpoint/bb8d235e-96c1-4fa3-a9ea-2ec71255ed18", + "@context": { + "dct": "https://purl.org/dc/terms/", + "tx": "https://w3id.org/tractusx/v0.0.1/ns/", + "edc": "https://w3id.org/edc/v0.0.1/ns/", + "dcat": "https://www.w3.org/ns/dcat/", + "odrl": "http://www.w3.org/ns/odrl/2/", + "dspace": "https://w3id.org/dspace/v0.8/" } } } } }, - "passport" : { - "electrochemicalProperties" : { - "ratedCapacity" : 94, - "batteryEnergy" : { - "energyRoundtripEfficiencyChange" : 48.2, - "maximumAllowedBatteryEnergy" : 85000, - "energyRoundtripEfficiency" : 25 + "passport": { + "electrochemicalProperties": { + "ratedCapacity": 94, + "batteryEnergy": { + "energyRoundtripEfficiencyChange": 48.2, + "maximumAllowedBatteryEnergy": 85000, + "energyRoundtripEfficiency": 25 }, - "ratioMaximumAllowedBatteryPowerAndMaximumAllowedBatteryEnergy" : 0.588, - "batteryVoltage" : { - "nominalVoltage" : 3.7, - "maxVoltage" : 4.2, - "minVoltage" : 2.5 + "ratioMaximumAllowedBatteryPowerAndMaximumAllowedBatteryEnergy": 0.588, + "batteryVoltage": { + "nominalVoltage": 3.7, + "maxVoltage": 4.2, + "minVoltage": 2.5 }, - "internalResistance" : { - "cellinternalResistance" : 0.36, - "packinternalResistanceIncrease" : 1, - "packinternalResistance" : 100 + "internalResistance": { + "cellinternalResistance": 0.36, + "packinternalResistanceIncrease": 1, + "packinternalResistance": 100 }, - "capacityThresholdExhaustion" : 23, - "batteryPower" : { - "powerFade" : 23, - "originalPowerCapability" : -1.7976931348623157E308, - "originalPowerCapabilityLimits" : -1.7976931348623157E308, - "maximumAllowedBatteryPower" : -1.7976931348623157E308, - "powerCapabilityAt20Charge" : -1.7976931348623157E308, - "powerCapabilityAt80Charge" : -1.7976931348623157E308 + "capacityThresholdExhaustion": 23, + "batteryPower": { + "powerFade": 23, + "originalPowerCapability": -1.7976931348623157E308, + "originalPowerCapabilityLimits": -1.7976931348623157E308, + "maximumAllowedBatteryPower": -1.7976931348623157E308, + "powerCapabilityAt20Charge": -1.7976931348623157E308, + "powerCapabilityAt80Charge": -1.7976931348623157E308 }, - "capacityFade" : 1.55 + "capacityFade": 1.55 }, - "document" : { - "responsibleSourcing" : [ { - "title" : "2021 Responsible Sourcing document", - "fileLocation" : null - } ], - "packagingInstructions" : [ { - "title" : "Packing Instruction v.2.0", - "fileLocation" : null - } ], - "transportationInstructions" : [ { - "title" : "Transport manual", - "fileLocation" : null - } ], - "vehicleDismantlingProcedure" : [ { - "title" : "Car dismantling manual", - "fileLocation" : "http://www.ietf.org/rfc/rfc2396.txt" - } ], - "testReportsResults" : [ { - "title" : "Battery Test Reports", - "fileLocation" : "http://www.Batterytestreports.de" - } ], - "batteryDismantlingProcedure" : [ { - "title" : "Dismantling Manual", - "fileLocation" : "http://www.dissmantlingmanual.org" - } ], - "safetyMeasures" : [ { - "title" : "Safety Instruction", - "fileLocation" : "http://www.safetyinstructions.txt" - } ], - "declarationOfConformity" : [ { - "title" : "Declaration of Conformity No. 3", - "fileLocation" : null - } ] + "document": { + "responsibleSourcing": [ + { + "title": "2021 Responsible Sourcing document", + "fileLocation": null + } + ], + "packagingInstructions": [ + { + "title": "Packing Instruction v.2.0", + "fileLocation": null + } + ], + "transportationInstructions": [ + { + "title": "Transport manual", + "fileLocation": null + } + ], + "vehicleDismantlingProcedure": [ + { + "title": "Car dismantling manual", + "fileLocation": "http://www.ietf.org/rfc/rfc2396.txt" + } + ], + "testReportsResults": [ + { + "title": "Battery Test Reports", + "fileLocation": "http://www.Batterytestreports.de" + } + ], + "batteryDismantlingProcedure": [ + { + "title": "Dismantling Manual", + "fileLocation": "http://www.dissmantlingmanual.org" + } + ], + "safetyMeasures": [ + { + "title": "Safety Instruction", + "fileLocation": "http://www.safetyinstructions.txt" + } + ], + "declarationOfConformity": [ + { + "title": "Declaration of Conformity No. 3", + "fileLocation": null + } + ] }, - "datePlacedOnMarket" : "27.04.2022", - "cellChemistry" : { - "electrolyteComposition" : [ { - "materialPercentageMassFraction" : null, - "materialWeight" : null, - "materialName" : "dimethyl carbonate (DCM)" - } ], - "anodeCompositionOther" : [ { - "materialPercentageMassFraction" : null, - "materialWeight" : null, - "materialName" : "Carboxymethyl cellulose" - } ], - "recyclateContentActiveMaterials" : [ { - "materialPercentageMassFraction" : 6, - "materialWeight" : null, - "materialName" : "Ni/2021/PlantE" - }, { - "materialPercentageMassFraction" : 4, - "materialWeight" : null, - "materialName" : "Li/2021/PlantE" - }, { - "materialPercentageMassFraction" : 0, - "materialWeight" : null, - "materialName" : "Pb(battery model does not contain Pb)" - }, { - "materialPercentageMassFraction" : 0, - "materialWeight" : null, - "materialName" : "Co(battery model does not contain Pb)" - } ], - "anodeActiveMaterials" : [ { - "materialPercentageMassFraction" : null, - "materialWeight" : null, - "materialName" : "Graphite" - } ], - "cathodeActiveMaterials" : [ { - "materialPercentageMassFraction" : null, - "materialWeight" : null, - "materialName" : "LiMn2O4 Lithium Manganese Oxide" - } ], - "cathodeCompositionOther" : [ { - "materialPercentageMassFraction" : null, - "materialWeight" : null, - "materialName" : "binder:PVDF" - } ] + "datePlacedOnMarket": "27.04.2022", + "cellChemistry": { + "electrolyteComposition": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "dimethyl carbonate (DCM)" + } + ], + "anodeCompositionOther": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "Carboxymethyl cellulose" + } + ], + "recyclateContentActiveMaterials": [ + { + "materialPercentageMassFraction": 6, + "materialWeight": null, + "materialName": "Ni/2021/PlantE" + }, + { + "materialPercentageMassFraction": 4, + "materialWeight": null, + "materialName": "Li/2021/PlantE" + }, + { + "materialPercentageMassFraction": 0, + "materialWeight": null, + "materialName": "Pb(battery model does not contain Pb)" + }, + { + "materialPercentageMassFraction": 0, + "materialWeight": null, + "materialName": "Co(battery model does not contain Pb)" + } + ], + "anodeActiveMaterials": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "Graphite" + } + ], + "cathodeActiveMaterials": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "LiMn2O4 Lithium Manganese Oxide" + } + ], + "cathodeCompositionOther": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "binder:PVDF" + } + ] }, - "physicalDimensions" : { - "length" : 2000, - "width" : 1000, - "weight" : 3500, - "diameter" : null, - "height" : 200 + "physicalDimensions": { + "length": 2000, + "width": 1000, + "weight": 3500, + "diameter": null, + "height": 200 }, - "temperatureRangeIdleState" : { - "temperatureRangeIdleStateUpperLimit" : 50, - "temperatureRangeIdleStateLowerLimit" : -20 + "temperatureRangeIdleState": { + "temperatureRangeIdleStateUpperLimit": 50, + "temperatureRangeIdleStateLowerLimit": -20 }, - "batteryCycleLife" : { - "cycleLifeTestCRate" : 2, - "cycleLifeTestDepthOfDischarge" : 1.8, - "expectedLifetime" : 2500 + "batteryCycleLife": { + "cycleLifeTestCRate": 2, + "cycleLifeTestDepthOfDischarge": 1.8, + "expectedLifetime": 2500 }, - "manufacturer" : { - "name" : "CompanyE", - "contact" : { - "faxNumber" : "+49 89 0987654324", - "website" : "https://www.CompanyE.com", - "phoneNumber" : "+49 89 1234567893", - "email" : "companyE@company.com" + "manufacturer": { + "name": "CompanyE", + "contact": { + "faxNumber": "+49 89 0987654324", + "website": "https://www.CompanyE.com", + "phoneNumber": "+49 89 1234567893", + "email": "companyE@company.com" }, - "address" : { - "locality" : { - "value" : "CityE", - "technicalKey" : "BLOCK" + "address": { + "locality": { + "value": "CityE", + "technicalKey": "BLOCK" }, - "country" : { - "shortName" : "Germany" + "country": { + "shortName": "Germany" }, - "postCode" : { - "value" : "65-250E", - "technicalKey" : "CEDEX" + "postCode": { + "value": "65-250E", + "technicalKey": "CEDEX" }, - "thoroughfare" : { - "value" : "StreetE", - "number" : "1", - "technicalKey" : "STREET" + "thoroughfare": { + "value": "StreetE", + "number": "1", + "technicalKey": "STREET" }, - "premise" : { - "value" : null, - "technicalKey" : "BUILDING" + "premise": { + "value": null, + "technicalKey": "BUILDING" }, - "postalDeliveryPoint" : { - "value" : null, - "technicalKey" : "intERURBAN_DELIVERY_POint" + "postalDeliveryPoint": { + "value": null, + "technicalKey": "intERURBAN_DELIVERY_POint" } } }, - "warrantyPeriod" : "96", - "composition" : { - "compositionOfBattery" : [ { - "materialPercentageMassFraction" : null, - "materialWeight" : null, - "materialName" : "Separator: PE" - } ], - "criticalRawMaterials" : "Lithium, Natural graphite", - "components" : { - "componentsPartNumber" : "Voltage cables", - "componentsSupplier" : [ { - "componentsSupplierName" : "AB Corporation", - "address" : { - "locality" : { - "value" : "CityF", - "technicalKey" : "BLOCK" - }, - "country" : { - "shortName" : "Germany" - }, - "postCode" : { - "value" : "65-250F", - "technicalKey" : "CEDEX" - }, - "thoroughfare" : { - "value" : "StreetF", - "number" : "1", - "technicalKey" : "STREET" - }, - "premise" : { - "value" : "PlantF", - "technicalKey" : "BUILDING" + "warrantyPeriod": "96", + "composition": { + "compositionOfBattery": [ + { + "materialPercentageMassFraction": null, + "materialWeight": null, + "materialName": "Separator: PE" + } + ], + "criticalRawMaterials": "Lithium, Natural graphite", + "components": { + "componentsPartNumber": "Voltage cables", + "componentsSupplier": [ + { + "componentsSupplierName": "AB Corporation", + "address": { + "locality": { + "value": "CityF", + "technicalKey": "BLOCK" + }, + "country": { + "shortName": "Germany" + }, + "postCode": { + "value": "65-250F", + "technicalKey": "CEDEX" + }, + "thoroughfare": { + "value": "StreetF", + "number": "1", + "technicalKey": "STREET" + }, + "premise": { + "value": "PlantF", + "technicalKey": "BUILDING" + }, + "postalDeliveryPoint": { + "value": null, + "technicalKey": "INTERURBAN_DELIVERY_POINT" + } }, - "postalDeliveryPoint" : { - "value" : null, - "technicalKey" : "INTERURBAN_DELIVERY_POINT" + "contact": { + "faxNumber": "+49 89 0987654324", + "website": "https://www.companyF.com", + "phoneNumber": "+49 89 1234567893", + "email": "companyF@companyF.com" } - }, - "contact" : { - "faxNumber" : "+49 89 0987654324", - "website" : "https://www.companyF.com", - "phoneNumber" : "+49 89 1234567893", - "email" : "companyF@companyF.com" } - } ] + ] } }, - "manufacturing" : { - "dateOfManufacturing" : "2022-01-24", - "address" : { - "locality" : { - "value" : "CityE", - "technicalKey" : "BLOCK" + "manufacturing": { + "dateOfManufacturing": "2022-01-24", + "address": { + "locality": { + "value": "CityE", + "technicalKey": "BLOCK" }, - "country" : { - "shortName" : "Germany" + "country": { + "shortName": "Germany" }, - "postCode" : { - "value" : "65-250E", - "technicalKey" : "CEDEX" + "postCode": { + "value": "65-250E", + "technicalKey": "CEDEX" }, - "thoroughfare" : { - "value" : "StreetE", - "number" : "1", - "technicalKey" : "STREET" + "thoroughfare": { + "value": "StreetE", + "number": "1", + "technicalKey": "STREET" }, - "premise" : { - "value" : "PlantE", - "technicalKey" : "BUILDING" + "premise": { + "value": "PlantE", + "technicalKey": "BUILDING" }, - "postalDeliveryPoint" : { - "value" : "GateE", - "technicalKey" : "INTERURBAN_DELIVERY_POINT" + "postalDeliveryPoint": { + "value": "GateE", + "technicalKey": "INTERURBAN_DELIVERY_POINT" } } }, - "batteryIdentification" : { - "batteryType" : "Lithium-Manganese-Oxide (LMO)", - "batteryIDDMCCode" : "IMR18650V1", - "batteryModel" : "Pi4 Orionis" + "batteryIdentification": { + "batteryType": "Lithium-Manganese-Oxide (LMO)", + "batteryIDDMCCode": "IMR18650V1", + "batteryModel": "Pi4 Orionis" }, - "stateOfBattery" : { - "stateOfHealth" : 20, - "statusBattery" : "first life", - "stateOfCharge" : 50 + "stateOfBattery": { + "stateOfHealth": 20, + "statusBattery": "first life", + "stateOfCharge": 50 }, - "cO2FootprintTotal" : 210 + "cO2FootprintTotal": 210 } } } \ No newline at end of file diff --git a/src/assets/MOCK/search.json b/src/assets/MOCK/search.json new file mode 100644 index 000000000..0b31abcde --- /dev/null +++ b/src/assets/MOCK/search.json @@ -0,0 +1,60 @@ +{ + "status": 200, + "data": { + "id": "ededdca7-998d-4cd6-94a1-dd1e24025a85", + "token": "37da8e38e4dc14d32c0edfa82a0ea94bbf39e4013c010bfdfececdc58eadf0c5", + "contract": { + "@id": "urn:uuid:0ec8cf2b-f58e-3f13-b5ef-e7dd01d15b19", + "@type": "dcat:Dataset", + "odrl:hasPolicy": { + "@id": "MDc4NjZjMTQtOGE0YS00ZjQ3LWEyYzgtMWI5MmEwOGQ1NTlm:dXJuOnV1aWQ6MGVjOGNmMmItZjU4ZS0zZjEzLWI1ZWYtZTdkZDAxZDE1YjE5:ZDJhNGZjMDItNjc0MS00NGUzLWE5MjUtODNjZDJkMDc0MTk0", + "@type": "odrl:Set", + "odrl:permission": { + "odrl:target": "urn:uuid:0ec8cf2b-f58e-3f13-b5ef-e7dd01d15b19", + "odrl:action": { + "odrl:type": "USE" + }, + "odrl:constraint": { + "odrl:or": [ + { + "odrl:leftOperand": "Membership", + "odrl:operator": { + "@id": "odrl:eq" + }, + "odrl:rightOperand": "active" + }, + { + "odrl:leftOperand": "FrameworkAgreement.sustainability", + "odrl:operator": { + "@id": "odrl:eq" + }, + "odrl:rightOperand": "active" + } + ] + } + }, + "odrl:prohibition": [], + "odrl:obligation": [], + "odrl:target": "urn:uuid:0ec8cf2b-f58e-3f13-b5ef-e7dd01d15b19" + }, + "dcat:distribution": [ + { + "@type": "dcat:Distribution", + "dct:format": { + "@id": "HttpProxy" + }, + "dcat:accessService": "f3276bfe-7337-46f8-863f-75661717fb59" + }, + { + "@type": "dcat:Distribution", + "dct:format": { + "@id": "AmazonS3" + }, + "dcat:accessService": "f3276bfe-7337-46f8-863f-75661717fb59" + } + ], + "edc:description": "Digital Product Passport (DPP) test data", + "edc:id": "urn:uuid:0ec8cf2b-f58e-3f13-b5ef-e7dd01d15b19" + } + } +} \ No newline at end of file diff --git a/src/components/general/LoadingComponent.vue b/src/components/general/LoadingComponent.vue index 4ca3ef6dd..82a916f80 100644 --- a/src/components/general/LoadingComponent.vue +++ b/src/components/general/LoadingComponent.vue @@ -91,6 +91,7 @@ this.stepsNames.contractNegotiation.initialStepSubtitle " displayId + contractSign :idLabel=" statusData.data.history['negotiation-accepted'] ? statusData.data.history['negotiation-accepted'].status diff --git a/src/components/general/StepperItem.vue b/src/components/general/StepperItem.vue index 089b5e874..c112b0c8e 100644 --- a/src/components/general/StepperItem.vue +++ b/src/components/general/StepperItem.vue @@ -42,6 +42,57 @@

{{ condition ? idLabel : "" }}

+ @@ -50,6 +101,10 @@ + + diff --git a/src/services/BackendService.js b/src/services/BackendService.js index 4eb2ed229..0743354c8 100644 --- a/src/services/BackendService.js +++ b/src/services/BackendService.js @@ -173,32 +173,32 @@ export default class BackendService { retries++; } let history = jsonUtil.get("data.history", statusResponse); - if(jsonUtil.exists("transfer-completed", history) && jsonUtil.exists("data-received", history)){ + if (jsonUtil.exists("transfer-completed", history) && jsonUtil.exists("data-received", history)) { return await this.retrievePassport(negotiation, authentication); } // Get status again statusResponse = await this.getStatus(processId, authentication) status = jsonUtil.get("data.status", statusResponse); history = jsonUtil.get("data.history", statusResponse); - if(jsonUtil.exists("transfer-completed", history) && jsonUtil.exists("data-received", history)){ + if (jsonUtil.exists("transfer-completed", history) && jsonUtil.exists("data-received", history)) { return await this.retrievePassport(negotiation, authentication); } retries = 0; // Until the transfer is completed or the status is failed - while(retries < maxRetries){ + while (retries < maxRetries) { // Wait await threadUtil.sleep(waitingTime); // Refresh the values statusResponse = await this.getStatus(processId, authentication); status = jsonUtil.get("data.status", statusResponse); history = jsonUtil.get("data.history", statusResponse); - if((jsonUtil.exists("transfer-completed", history) && jsonUtil.exists("data-received", history)) || status === "FAILED"){ + if ((jsonUtil.exists("transfer-completed", history) && jsonUtil.exists("data-received", history)) || status === "FAILED") { break; } retries++; } - + // If the status is failed... if (status === "FAILED") { return this.getErrorMessage( @@ -210,7 +210,7 @@ export default class BackendService { // If is not failed return the passport return await this.retrievePassport(negotiation, authentication); } - + getErrorMessage(message, status, statusText) { return { "message": message, @@ -302,6 +302,17 @@ export default class BackendService { }); }); } + async acceptContract(contractToSign) { + return new Promise(resolve => { + axios.post(`${BACKEND_URL}/api/data`, contractToSign) + .then((response => { + resolve(response.data); + }) + .catch(error => { + console.error('Error accepting contract', error); + })) + }); + } async retrievePassport(negotiation, authentication) { return new Promise(resolve => { let body = this.getRequestBody(negotiation); @@ -336,7 +347,6 @@ export default class BackendService { } else { resolve(e.message) } - }); }); } @@ -345,6 +355,8 @@ export default class BackendService { let body = this.getSearchBody(id, processId); axios.post(`${BACKEND_URL}/api/contract/search`, body, this.getHeaders(authentication)) .then((response) => { + // Setting the status to the Store state + store.commit('setSearchData', response.data); resolve(response.data); }) .catch((e) => { diff --git a/src/store/index.js b/src/store/index.js index 8e4c16ad0..b474f9c7c 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -55,6 +55,68 @@ export default createStore({ ] } ], + searchData: { + "contract": { + "@id": "urn:uuid:0ec8cf2b-f58e-3f13-b5ef-e7dd01d15b19", + "@type": "dcat:Dataset", + "odrl:hasPolicy": { + "@id": "MDc4NjZjMTQtOGE0YS00ZjQ3LWEyYzgtMWI5MmEwOGQ1NTlm:dXJuOnV1aWQ6MGVjOGNmMmItZjU4ZS0zZjEzLWI1ZWYtZTdkZDAxZDE1YjE5:N2ZjNWNjM2UtMjhjZC00OWI5LTg3MjItZTQ5ODk2MDM1ZDBk", + "@type": "odrl:Set", + "odrl:permission": [{ + "odrl:target": "urn:uuid:d6a0ed29-8ba4-fc00-169c-72d3986e0000", + "odrl:action": { + "odrl:type": "USE" + }, + "odrl:constraint": { + "odrl:or": { + "odrl:leftOperand": "PURPOSE", + "odrl:operator": { + "@id": "odrl:eq" + }, + "odrl:rightOperand": "ID 3.0 Trace" + } + } + }, + + { + "odrl:target": "urn:uuid:d6a0ed29-8ba4-fc00-169c-72d3986e1111", + "odrl:action": { + "odrl:type": "ACCESS" + }, + "odrl:constraint": { + "odrl:or": { + "odrl:leftOperand": "PURPOSE", + "odrl:operator": { + "@id": "odrl:eq" + }, + "odrl:rightOperand": "DPP" + } + } + }], + "odrl:prohibition": [], + "odrl:obligation": [], + "odrl:target": "urn:uuid:0ec8cf2b-f58e-3f13-b5ef-e7dd01d15b19" + }, + "dcat:distribution": [{ + "@type": "dcat:Distribution", + "dct:format": { + "@id": "HttpProxy" + }, + "dcat:accessService": "1bcbba32-d074-4bdc-b6fb-80f4e6202d3a" + }, { + "@type": "dcat:Distribution", + "dct:format": { + "@id": "AmazonS3" + }, + "dcat:accessService": "1bcbba32-d074-4bdc-b6fb-80f4e6202d3a" + }], + "edc:description": "Digital Product Passport (DPP) test data", + "edc:id": "urn:uuid:0ec8cf2b-f58e-3f13-b5ef-e7dd01d15b19" + }, + "id": "a4a816d9-86af-4abd-bffc-d1964698d39b", + "token": "5e2e1afd6bdca53de86368b9884b67b0755f4653c5b31cb5b6bc9f070a043672" + }, + contractToSign: null, processId: null, searchContractId: null, irsState: false @@ -78,14 +140,25 @@ export default createStore({ getIrsState(state) { return state.irsState; }, + getSearchData(state) { + return state.searchData; + }, + getContractToSign(state) { + return state.contractToSign; + }, }, mutations: { + setSearchData(state, newSearchData) { + state.searchData = newSearchData; + }, + setContractToSign(state, newContractToSign) { + state.contractToSign = newContractToSign; + }, setEmail(state, newEmail) { state.email = newEmail; }, setPassword(state, newPassword) { state.password = newPassword; - }, setClientId(state, clientId) { let bytes = CryptoJS.AES.encrypt(clientId, state.sessionId); diff --git a/src/views/PassportView.vue b/src/views/PassportView.vue index f90d7b7fb..03ccfcc86 100644 --- a/src/views/PassportView.vue +++ b/src/views/PassportView.vue @@ -225,14 +225,14 @@ export default { irsData: [], processId: null, backendService: null, - error: true, + error: false, errorObj: { title: "Something went wrong while returning the passport!", description: "We are sorry for that, you can retry or try again later", type: "error", status: 500, statusText: "Internal Server Error", - } + }, }; }, @@ -316,10 +316,7 @@ export default { // Init backendService // Get access token from IDP // Get the aspect for the selected version - response = await this.backendService.getPassport( - id, - this.auth - ); + response = await this.backendService.getPassport(id, this.auth); } catch (e) { console.log("passportView.getPassport() -> " + e); this.errorObj.title = jsonUtil.exists("message", response) From 0c0139074d33e11e6d9776a7962fb398c6c08803 Mon Sep 17 00:00:00 2001 From: david zynda Date: Mon, 15 Jan 2024 13:48:15 +0100 Subject: [PATCH 2/5] modal responsivness --- .../components/general/contractModal.scss | 44 +++++++++++++++++++ src/assets/styles/main.scss | 1 + src/components/general/StepperItem.vue | 17 +------ 3 files changed, 46 insertions(+), 16 deletions(-) create mode 100644 src/assets/styles/components/general/contractModal.scss diff --git a/src/assets/styles/components/general/contractModal.scss b/src/assets/styles/components/general/contractModal.scss new file mode 100644 index 000000000..60c34f086 --- /dev/null +++ b/src/assets/styles/components/general/contractModal.scss @@ -0,0 +1,44 @@ +/** + * Catena-X - Product Passport Consumer Frontend + * + * Copyright (c) 2022, 2023 BASF SE, BMW AG, Henkel AG & Co. KGaA + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * 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. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the + * License for the specific language govern in permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +.contract-modal { + justify-content: center; + align-items: center; + .content-container { + margin-top: 20px; + width: 300px; + } + .contract-container { + display: flex; + flex-direction: column; + justify-content: center !important; + align-items: center !important; + padding: 20px 80px 50px 80px; + } + + .title-container { + width: fit-content; + font-size: 20px; + font-weight: 600; + padding: 15px; + } +} diff --git a/src/assets/styles/main.scss b/src/assets/styles/main.scss index c0c32b439..a048c5067 100644 --- a/src/assets/styles/main.scss +++ b/src/assets/styles/main.scss @@ -28,6 +28,7 @@ @import "components/general/header"; @import "components/general/search"; @import "components/general/tooltip"; +@import "components/general/contractModal"; @import "components/general/dialog"; @import "components/general/recursiveTree"; @import "components/passport/documentField"; diff --git a/src/components/general/StepperItem.vue b/src/components/general/StepperItem.vue index c112b0c8e..e036fa517 100644 --- a/src/components/general/StepperItem.vue +++ b/src/components/general/StepperItem.vue @@ -45,9 +45,7 @@