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 : "" }}
+
+
+
+
+ Choose a policy
+
+
+
+
+
+ Decline
+ Agree
+
+
+
+
@@ -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 @@
-
- Choose a policy
-
+ Choose a policy
-
-
From cc7e7c6f4e9356f31a747292f1f7f43bfb676027 Mon Sep 17 00:00:00 2001
From: david zynda
Date: Mon, 29 Jan 2024 09:57:43 +0100
Subject: [PATCH 3/5] json viewer lib + policies extractor
---
package-lock.json | 87 ++++++++
package.json | 2 +
src/assets/MOCK/dpp.json | 70 +++++-
.../components/general/contractModal.scss | 15 ++
src/components/general/StepperItem.vue | 112 +++++++---
src/main.js | 5 +-
src/store/index.js | 206 +++++++++++++-----
7 files changed, 411 insertions(+), 86 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index feb75ea98..fcb909ebf 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,6 +12,7 @@
"@popperjs/core": "^2.11.2",
"@vitejs/plugin-vue": "^4.0.0",
"axios": "^0.26.0",
+ "clipboard": "^2.0.11",
"core-js": "^3.8.3",
"crypto-js": "^4.2.0",
"eslint-config-prettier": "^8.5.0",
@@ -23,6 +24,7 @@
"vite-plugin-vuetify": "^1.0.2",
"vue": "^3.2.47",
"vue-router": "^4.0.13",
+ "vue3-json-viewer": "^2.2.2",
"vue3-qrcode-reader": "^0.0.1",
"vuetify": "^3.1.4",
"vuex": "^4.0.2",
@@ -982,6 +984,16 @@
"node": ">= 6"
}
},
+ "node_modules/clipboard": {
+ "version": "2.0.11",
+ "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz",
+ "integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==",
+ "dependencies": {
+ "good-listener": "^1.2.2",
+ "select": "^1.1.2",
+ "tiny-emitter": "^2.0.0"
+ }
+ },
"node_modules/cliui": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
@@ -1104,6 +1116,11 @@
"node": ">=8"
}
},
+ "node_modules/delegate": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
+ "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
+ },
"node_modules/doctrine": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
@@ -1795,6 +1812,14 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/good-listener": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
+ "integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==",
+ "dependencies": {
+ "delegate": "^3.1.2"
+ }
+ },
"node_modules/graceful-fs": {
"version": "4.2.10",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
@@ -2633,6 +2658,11 @@
"version": "2.12.0",
"license": "MIT"
},
+ "node_modules/select": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
+ "integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA=="
+ },
"node_modules/semver": {
"version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
@@ -2841,6 +2871,11 @@
"integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==",
"dev": true
},
+ "node_modules/tiny-emitter": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
+ "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
+ },
"node_modules/tiny-invariant": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.1.tgz",
@@ -3340,6 +3375,17 @@
"typescript": "*"
}
},
+ "node_modules/vue3-json-viewer": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/vue3-json-viewer/-/vue3-json-viewer-2.2.2.tgz",
+ "integrity": "sha512-56l3XDGggnpwEqZieXsSMhNT4NhtO6d7zuSAxHo4i0UVxymyY2jRb7UMQOU1ztChKALZCAzX7DlgrsnEhxu77A==",
+ "dependencies": {
+ "clipboard": "^2.0.10"
+ },
+ "peerDependencies": {
+ "vue": "^3.2.0"
+ }
+ },
"node_modules/vue3-qrcode-reader": {
"version": "0.0.1",
"license": "MIT",
@@ -4164,6 +4210,16 @@
}
}
},
+ "clipboard": {
+ "version": "2.0.11",
+ "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz",
+ "integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==",
+ "requires": {
+ "good-listener": "^1.2.2",
+ "select": "^1.1.2",
+ "tiny-emitter": "^2.0.0"
+ }
+ },
"cliui": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
@@ -4257,6 +4313,11 @@
"integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",
"dev": true
},
+ "delegate": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
+ "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
+ },
"doctrine": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
@@ -4758,6 +4819,14 @@
"path-is-absolute": "^1.0.0"
}
},
+ "good-listener": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
+ "integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==",
+ "requires": {
+ "delegate": "^3.1.2"
+ }
+ },
"graceful-fs": {
"version": "4.2.10",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
@@ -5324,6 +5393,11 @@
"sdp": {
"version": "2.12.0"
},
+ "select": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
+ "integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA=="
+ },
"semver": {
"version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
@@ -5476,6 +5550,11 @@
"integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==",
"dev": true
},
+ "tiny-emitter": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
+ "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
+ },
"tiny-invariant": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.1.tgz",
@@ -5804,6 +5883,14 @@
"@volar/vue-typescript": "1.0.24"
}
},
+ "vue3-json-viewer": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/vue3-json-viewer/-/vue3-json-viewer-2.2.2.tgz",
+ "integrity": "sha512-56l3XDGggnpwEqZieXsSMhNT4NhtO6d7zuSAxHo4i0UVxymyY2jRb7UMQOU1ztChKALZCAzX7DlgrsnEhxu77A==",
+ "requires": {
+ "clipboard": "^2.0.10"
+ }
+ },
"vue3-qrcode-reader": {
"version": "0.0.1",
"requires": {
diff --git a/package.json b/package.json
index 1ec81c1ca..64814e79c 100644
--- a/package.json
+++ b/package.json
@@ -16,6 +16,7 @@
"@popperjs/core": "^2.11.2",
"@vitejs/plugin-vue": "^4.0.0",
"axios": "^0.26.0",
+ "clipboard": "^2.0.11",
"core-js": "^3.8.3",
"crypto-js": "^4.2.0",
"eslint-config-prettier": "^8.5.0",
@@ -27,6 +28,7 @@
"vite-plugin-vuetify": "^1.0.2",
"vue": "^3.2.47",
"vue-router": "^4.0.13",
+ "vue3-json-viewer": "^2.2.2",
"vue3-qrcode-reader": "^0.0.1",
"vuetify": "^3.1.4",
"vuex": "^4.0.2",
diff --git a/src/assets/MOCK/dpp.json b/src/assets/MOCK/dpp.json
index ef125a0bd..32ee224eb 100644
--- a/src/assets/MOCK/dpp.json
+++ b/src/assets/MOCK/dpp.json
@@ -1,5 +1,71 @@
{
- "metadata": {},
+ "metadata": {
+ "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"
+ }
+ },
"semanticId": "general",
"aspect": {
"serialization": {
@@ -187,4 +253,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/assets/styles/components/general/contractModal.scss b/src/assets/styles/components/general/contractModal.scss
index 60c34f086..db8b5927a 100644
--- a/src/assets/styles/components/general/contractModal.scss
+++ b/src/assets/styles/components/general/contractModal.scss
@@ -41,4 +41,19 @@
font-weight: 600;
padding: 15px;
}
+ .details-btn {
+ margin: 20px;
+ color: $catena-x-blue;
+ text-decoration: underline;
+ }
+ .json-viewer-container {
+ border: 1px solid lightgray;
+ border-radius: 5px;
+ .json-viewer {
+ min-width: 300px;
+ max-height: 50vh;
+ overflow: auto;
+ background-color: rgb(245, 245, 245);
+ }
+ }
}
diff --git a/src/components/general/StepperItem.vue b/src/components/general/StepperItem.vue
index e036fa517..cc15a21c7 100644
--- a/src/components/general/StepperItem.vue
+++ b/src/components/general/StepperItem.vue
@@ -42,34 +42,22 @@
{{ condition ? idLabel : "" }}
-
+
Choose a policy
+ >
+
Agree
+
+
+ {{ detailsTitle }}
+
+
+
+
+
+
+
@@ -102,9 +107,14 @@
import { mapState } from "vuex";
import store from "../../store/index";
import BackendService from "@/services/BackendService";
-
+import { JsonViewer } from "vue3-json-viewer";
+import "vue3-json-viewer/dist/index.css";
+import { reactive } from "vue";
export default {
name: "StepperItem",
+ components: {
+ JsonViewer,
+ },
props: {
condition: { type: [String, Number], default: "" },
stepTitle: { type: [String, Number], default: "" },
@@ -116,8 +126,11 @@ export default {
},
data: () => ({
showOverlay: false,
- contractItems: [],
+ contractItems: reactive([]),
radios: 0,
+ details: false,
+ detailsTitle: "More details",
+ policies: [],
}),
computed: {
...mapState(["searchData", "contractToSign"]),
@@ -125,17 +138,55 @@ export default {
async created() {
this.backendService = new BackendService();
},
+
mounted() {
- this.contractItems =
- this.searchData.contract["odrl:hasPolicy"]["odrl:permission"];
- this.contractToSign = store.commit(
- "setContractToSign",
- this.contractItems[0]
- );
+ // Initialize contractItems from searchData
+ this.contractItems = this.searchData.contracts;
+
+ // Extract policies
+ this.extractPolicies(this.contractItems);
+
+ // Check if policies array has elements and then access the @id of the first element
+ if (this.policies.length > 0) {
+ const contractId = this.policies[0];
+
+ // Commit the contract ID to the store
+ this.$store.commit("setContractToSign", contractId);
+
+ // Store the ID in state
+ this.contractToSign = contractId;
+ } else {
+ console.error("No policies found");
+ }
this.shouldShowOverlay();
},
methods: {
+ extractPolicies(contracts) {
+ const policies = [];
+ contracts.forEach((contract) => {
+ if (contract["odrl:hasPolicy"]) {
+ // Check if 'odrl:hasPolicy' is an array
+ if (Array.isArray(contract["odrl:hasPolicy"])) {
+ contract["odrl:hasPolicy"].forEach((policy) => {
+ policies.push(policy);
+ });
+ } else {
+ // 'odrl:hasPolicy' is a single object
+ policies.push(contract["odrl:hasPolicy"]);
+ }
+ }
+ });
+ return (this.policies = policies);
+ },
+ toggleDetails() {
+ this.details = !this.details;
+ if (this.details) {
+ this.detailsTitle = "Less details";
+ } else {
+ this.detailsTitle = "More details";
+ }
+ },
operatorMapper(operator) {
let opr = operator.replace("odrl:", "");
if (opr == "eq") {
@@ -171,3 +222,4 @@ export default {
},
};
+
diff --git a/src/main.js b/src/main.js
index a7dbfde51..8827b41c6 100644
--- a/src/main.js
+++ b/src/main.js
@@ -28,13 +28,16 @@ import { loadFonts } from './assets/plugins/webfontloader';
import router from './router';
import '@/assets/styles/main.scss';
import authentication from '@/services/Authentication';
-
+import JsonViewer from "vue3-json-viewer";
+// if you used v1.0.5 or latster ,you should add import "vue3-json-viewer/dist/index.css"
+import "vue3-json-viewer/dist/index.css";
loadFonts();
const app = createApp(App);
app.use(vuetify);
app.use(store);
app.use(router);
+app.use(JsonViewer);
let auth = new authentication();
app.provide('authentication', auth);
diff --git a/src/store/index.js b/src/store/index.js
index b474f9c7c..9d4ffa3b8 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -56,65 +56,165 @@ 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"
+ "contracts": [
+ {
+ "@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:748cf682-6747-33cb-630b-c35a29970f27",
+ "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:748cf682-6747-33cb-630b-c35a29970f27"
},
-
- {
- "odrl:target": "urn:uuid:d6a0ed29-8ba4-fc00-169c-72d3986e1111",
- "odrl:action": {
- "odrl:type": "ACCESS"
+ "dcat:distribution": [
+ {
+ "@type": "dcat:Distribution",
+ "dct:format": {
+ "@id": "HttpProxy"
+ },
+ "dcat:accessService": "1795254a-e354-46c7-9d88-04608b05ca9f"
+ },
+ {
+ "@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"
+ },
+ {
+ "@id": "5c4fbb7d-cf02-4401-a7a3-f0ec1c506f33",
+ "@type": "dcat:Dataset",
+ "odrl:hasPolicy": [{
+ "@id": "2:1f4a64f0-aba9-498a-917c-4936c24c50cd-49a06ad2-64b7-46c8-9f3b-a718c462ca23:ac45d75a-2542-4d1a-a0fc-034c705418a9",
+ "@type": "odrl:Set",
+ "odrl:permission": {
+ "odrl:target": "urn:uuid:748cf682-6747-33cb-630b-c35a29970f27",
+ "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:constraint": {
- "odrl:or": {
- "odrl:leftOperand": "PURPOSE",
- "odrl:operator": {
- "@id": "odrl:eq"
+ "odrl:prohibition": [],
+ "odrl:obligation": [],
+ "odrl:target": "urn:uuid:748cf682-6747-33cb-630b-c35a29970f27"
+ }, {
+ "@id": "2:67deb076-464c-4e8d-8931-087cee0afe2f:ac45d75a-2542-4d1a-a0fc-034c705418a9",
+ "@type": "odrl:Set",
+ "odrl:permission": {
+ "odrl:target": "urn:uuid:748cf682-6747-33cb-630b-c35a29970f27",
+ "odrl:action": {
+ "odrl:type": "USE"
+ },
+ "odrl:constraint": {
+ "odrl:and": [
+ {
+ "odrl:leftOperand": "DPP",
+ "odrl:operator": {
+ "@id": "odrl:eq"
+ },
+ "odrl:rightOperand": "active"
+ }
+ ]
+ }
+ },
+ "odrl:prohibition": {
+ "odrl:target": "urn:uuid:748cf682-6747-33cb-630b-c35a29970f27",
+ "odrl:action": {
+ "odrl:type": "DISTRIBUTE"
+ },
+ "odrl:duties": [{
+ "odrl:action": {
+ "@id": "odrl:compensate"
},
- "odrl:rightOperand": "DPP"
+ "odrl:constraint": {
+ "odrl:name": "odrl:payAmount",
+ "odrl:operator": {
+ "@id": "odrl:eq"
+ },
+ "odrl:rightOperand": { "@value": "0.0", "@type": "xsd:decimal" },
+ "odrl:unit": "http://example.com/iso4217a/EUR"
+ }
+ }],
+ "odrl:constraint": {
+ "odrl:leftOperand": "event",
+ "odrl:operator": "odrl:lt",
+ "odrl:rightOperand": {
+ "@id": "odrl:policyUsage"
+ }
}
+ },
+ "odrl:obligation": [],
+ "odrl:target": "urn:uuid:748cf682-6747-33cb-630b-c35a29970f27"
+ }
+ ],
+ "dcat:distribution": [
+ {
+ "@type": "dcat:Distribution",
+ "dct:format": {
+ "@id": "HttpProxy"
+ },
+ "dcat:accessService": "1795254a-e354-46c7-9d88-04608b05ca9f"
+ },
+ {
+ "@type": "dcat:Distribution",
+ "dct:format": {
+ "@id": "AmazonS3"
+ },
+ "dcat:accessService": "1795254a-e354-46c7-9d88-04608b05ca9f"
}
- }],
- "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"
+ ],
+ "edc:description": "Battery Passport test data",
+ "edc:id": "1f4a64f0-aba9-498a-917c-4936c24c50cd-49a06ad2-64b7-46c8-9f3b-a718c462ca23"
+ }
+ ],
+ "token": "688787d8ff144c502c7f5cffaafe2cc588d86079f9de88304c26b0cb99ce91c6",
+ "id": "ccbf6bfb-c7e1-4db4-8225-9fa95ee82f7f"
},
contractToSign: null,
processId: null,
From ee4e99a38be38ab582bd1451a5f24ddbb99e858e Mon Sep 17 00:00:00 2001
From: Mathias Brunkow Moser
Date: Mon, 29 Jan 2024 13:51:52 +0100
Subject: [PATCH 4/5] chore: runned IP check and approved vue3-json-viewer2
---
DEPENDENCIES_FRONTEND | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/DEPENDENCIES_FRONTEND b/DEPENDENCIES_FRONTEND
index 97d328fd1..f26ac5144 100644
--- a/DEPENDENCIES_FRONTEND
+++ b/DEPENDENCIES_FRONTEND
@@ -25,6 +25,7 @@ npm/npmjs/-/callsites/3.1.0, MIT, approved, clearlydefined
npm/npmjs/-/chalk/2.4.2, MIT, approved, clearlydefined
npm/npmjs/-/chalk/4.1.2, MIT, approved, clearlydefined
npm/npmjs/-/chokidar/3.5.3, MIT, approved, #2317
+npm/npmjs/-/clipboard/2.0.11, MIT, approved, clearlydefined
npm/npmjs/-/cliui/8.0.1, ISC AND Artistic-2.0, approved, #3753
npm/npmjs/-/color-convert/1.9.3, MIT, approved, clearlydefined
npm/npmjs/-/color-convert/2.0.1, MIT, approved, clearlydefined
@@ -92,6 +93,7 @@ npm/npmjs/-/get-caller-file/2.0.5, ISC, approved, clearlydefined
npm/npmjs/-/glob-parent/5.1.2, ISC, approved, clearlydefined
npm/npmjs/-/glob/7.2.3, ISC, approved, clearlydefined
npm/npmjs/-/globals/13.20.0, MIT, approved, #6953
+npm/npmjs/-/good-listener/1.2.2, MIT, approved, clearlydefined
npm/npmjs/-/graceful-fs/4.2.10, ISC, approved, #7413
npm/npmjs/-/has-flag/3.0.0, MIT, approved, clearlydefined
npm/npmjs/-/has-flag/4.0.0, MIT, approved, clearlydefined
@@ -179,6 +181,7 @@ npm/npmjs/-/rtcpeerconnection-shim/1.2.15, BSD-3-Clause, approved, clearlydefine
npm/npmjs/-/run-parallel/1.2.0, MIT, approved, clearlydefined
npm/npmjs/-/sass/1.58.0, Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND MIT AND MIT, approved, #6927
npm/npmjs/-/sdp/2.12.0, MIT, approved, #6956
+npm/npmjs/-/select/1.1.2, MIT, approved, clearlydefined
npm/npmjs/-/semver/7.5.4, ISC, approved, clearlydefined
npm/npmjs/-/shebang-command/2.0.0, MIT, approved, clearlydefined
npm/npmjs/-/shebang-regex/3.0.0, MIT, approved, clearlydefined
@@ -196,6 +199,7 @@ npm/npmjs/-/supports-color/5.5.0, MIT, approved, clearlydefined
npm/npmjs/-/supports-color/7.2.0, MIT, approved, clearlydefined
npm/npmjs/-/table/6.8.1, BSD-3-Clause, approved, #4596
npm/npmjs/-/text-table/0.2.0, MIT, approved, clearlydefined
+npm/npmjs/-/tiny-emitter/2.1.0, MIT, approved, clearlydefined
npm/npmjs/-/tiny-invariant/1.3.1, MIT, approved, clearlydefined
npm/npmjs/-/to-regex-range/5.0.1, MIT, approved, clearlydefined
npm/npmjs/-/type-check/0.4.0, MIT, approved, clearlydefined
@@ -223,6 +227,7 @@ npm/npmjs/-/vue-router/4.0.13, MIT, approved, clearlydefined
npm/npmjs/-/vue-template-compiler/2.7.14, 0BSD AND MIT AND MIT, approved, #3476
npm/npmjs/-/vue-tsc/1.0.24, MIT, approved, clearlydefined
npm/npmjs/-/vue/3.2.47, MIT, approved, #7094
+npm/npmjs/-/vue3-json-viewer/2.2.2, MIT AND ISC, approved, #12936
npm/npmjs/-/vue3-qrcode-reader/0.0.1, MIT AND (BSD-3-Clause AND MIT), approved, #6958
npm/npmjs/-/vuetify/3.1.4, MIT AND W3C-20150513, approved, #7092
npm/npmjs/-/vuex-persistedstate/4.1.0, MIT, approved, clearlydefined
From a79919ceb86ce23c32bd91131c321ab74be539e2 Mon Sep 17 00:00:00 2001
From: david zynda
Date: Wed, 31 Jan 2024 13:39:20 +0100
Subject: [PATCH 5/5] Confirmation + new model
---
package-lock.json | 11 +
.../components/general/contractModal.scss | 22 +-
src/components/general/StepperItem.vue | 230 ++++++++++++------
src/main.js | 1 -
src/store/index.js | 10 +-
src/views/PassportView.vue | 2 +-
6 files changed, 188 insertions(+), 88 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index f86565f70..af4cd964b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,6 +12,7 @@
"@popperjs/core": "^2.11.2",
"@vitejs/plugin-vue": "^4.0.0",
"axios": ">=1.6.0",
+ "clipboard": "^2.0.11",
"core-js": "^3.8.3",
"crypto-js": "^4.2.0",
"eslint-config-prettier": "^8.5.0",
@@ -1201,6 +1202,11 @@
"node": ">=0.4.0"
}
},
+ "node_modules/delegate": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
+ "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
+ },
"node_modules/doctrine": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
@@ -4514,6 +4520,11 @@
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
},
+ "delegate": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
+ "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
+ },
"doctrine": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
diff --git a/src/assets/styles/components/general/contractModal.scss b/src/assets/styles/components/general/contractModal.scss
index db8b5927a..cab271d4b 100644
--- a/src/assets/styles/components/general/contractModal.scss
+++ b/src/assets/styles/components/general/contractModal.scss
@@ -23,9 +23,17 @@
.contract-modal {
justify-content: center;
align-items: center;
+ .back-to-homepage {
+ margin: 5px 0;
+ }
.content-container {
margin-top: 20px;
- width: 300px;
+ width: 450px;
+
+ .policy-group-label {
+ margin-top: 15px;
+ font-weight: bolder;
+ }
}
.contract-container {
display: flex;
@@ -57,3 +65,15 @@
}
}
}
+
+@media (max-width: 628px) {
+ .contract-modal {
+ .content-container {
+ width: 320px;
+ display: inline;
+ .policy-group-label-mobile {
+ display: block;
+ }
+ }
+ }
+}
diff --git a/src/components/general/StepperItem.vue b/src/components/general/StepperItem.vue
index cc15a21c7..90236bc1a 100644
--- a/src/components/general/StepperItem.vue
+++ b/src/components/general/StepperItem.vue
@@ -44,56 +44,102 @@
-
- Choose a policy
-
-
-
-
-
- Decline
- Agree
-
-
-
- {{ detailsTitle }}
-
-
-
-
-
+
+
+ Choose a policy
+
+
+
+
+ Contract ID:
+ {{ contractId }}
+
+
+
+
+
+
+ Decline
+ Agree
+
+
+
+ {{ detailsTitle }}
+
+
+
+
+
+
+
+
+
+
+
+
+ Are you sure you want to decline?
-
-
+
+
+ This will take you back to the Homepage
+
+
+
+ Cancel
+ Yes, Decline
+
+
+
@@ -131,9 +177,21 @@ export default {
details: false,
detailsTitle: "More details",
policies: [],
+ declineContractModal: false,
+ showContractModal: true,
}),
computed: {
...mapState(["searchData", "contractToSign"]),
+ groupedPolicies() {
+ return this.policies.reduce((groups, policy) => {
+ const contractId = Object.keys(policy)[0];
+ if (!groups[contractId]) {
+ groups[contractId] = [];
+ }
+ groups[contractId].push(policy[contractId]);
+ return groups;
+ }, {});
+ },
},
async created() {
this.backendService = new BackendService();
@@ -148,13 +206,14 @@ export default {
// Check if policies array has elements and then access the @id of the first element
if (this.policies.length > 0) {
- const contractId = this.policies[0];
-
+ const firstPolicyObj = this.policies[0];
+ const initialContractToSign = Object.keys(firstPolicyObj)[0];
+ const initialPolicyToSign = firstPolicyObj[initialContractToSign]["@id"];
// Commit the contract ID to the store
- this.$store.commit("setContractToSign", contractId);
-
- // Store the ID in state
- this.contractToSign = contractId;
+ this.$store.commit("setContractToSign", {
+ contract: initialContractToSign,
+ policy: initialPolicyToSign,
+ });
} else {
console.error("No policies found");
}
@@ -163,21 +222,28 @@ export default {
},
methods: {
extractPolicies(contracts) {
- const policies = [];
- contracts.forEach((contract) => {
- if (contract["odrl:hasPolicy"]) {
- // Check if 'odrl:hasPolicy' is an array
+ let contractPolicies = [];
+
+ for (let key in contracts) {
+ // eslint-disable-next-line no-prototype-builtins
+ if (contracts.hasOwnProperty(key)) {
+ const contract = contracts[key];
+
if (Array.isArray(contract["odrl:hasPolicy"])) {
contract["odrl:hasPolicy"].forEach((policy) => {
- policies.push(policy);
+ let policyEntry = {};
+ policyEntry[key] = policy;
+ contractPolicies.push(policyEntry);
});
} else {
- // 'odrl:hasPolicy' is a single object
- policies.push(contract["odrl:hasPolicy"]);
+ // Create an entry with the contract key and the policy object
+ let policyEntry = {};
+ policyEntry[key] = contract["odrl:hasPolicy"];
+ contractPolicies.push(policyEntry);
}
}
- });
- return (this.policies = policies);
+ }
+ return (this.policies = contractPolicies);
},
toggleDetails() {
this.details = !this.details;
@@ -187,29 +253,25 @@ export default {
this.detailsTitle = "More details";
}
},
- operatorMapper(operator) {
- let opr = operator.replace("odrl:", "");
- if (opr == "eq") {
- return " = ";
- }
- return opr;
- },
- chooseContract(contract) {
- return (this.contractToSign = store.commit(
- "setContractToSign",
- contract
- ));
+ chooseContract(contract, policy) {
+ console.log("Contract chosen - contractToSign:", this.contractToSign);
+ console.log("Contract chosen - policies:", this.policies);
+
+ return (this.contractToSign = store.commit("setContractToSign", {
+ contract: contract,
+ policy: policy,
+ }));
},
shouldShowOverlay() {
- if (this.contractItems.length > 1) {
+ if (this.policies.length > 1) {
return (this.showOverlay = true);
}
},
- async callAcceptContract(contractToSign) {
+ callAcceptContract(contract, policy) {
+ alert("contract: " + contract + " " + "policy: " + policy);
try {
- // let response = await this.backendService.acceptContract(contractToSign);
+ // let response = await this.backendService.acceptContract(contract, policy);
// return response;
- alert(contractToSign);
} catch (error) {
console.error("Error accepting contract", error);
} finally {
@@ -217,8 +279,16 @@ export default {
}
},
declineContract() {
+ this.declineContractModal = true;
+ this.showContractModal = false;
+ },
+ confirmDeclineContract() {
this.$router.push("/");
},
+ cancelDeclineContract() {
+ this.declineContractModal = false;
+ this.showContractModal = true;
+ },
},
};
diff --git a/src/main.js b/src/main.js
index 449b4ea2b..99fe60907 100644
--- a/src/main.js
+++ b/src/main.js
@@ -31,7 +31,6 @@ import authentication from '@/services/Authentication';
import JsonViewer from "vue3-json-viewer";
import "vue3-json-viewer/dist/index.css";
import { createI18n } from 'vue-i18n';
-// Import translation files
import en from '@/translations/en.json';
import de from '@/translations/de.json';
diff --git a/src/store/index.js b/src/store/index.js
index 5cb9cec41..7d6d7c4ea 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -56,8 +56,8 @@ export default createStore({
}
],
searchData: {
- "contracts": [
- {
+ "contracts": {
+ "9b3c0977-6b14-4201-bd76-55f681a92872": {
"@id": "9b3c0977-6b14-4201-bd76-55f681a92872",
"@type": "dcat:Dataset",
"odrl:hasPolicy": {
@@ -110,7 +110,7 @@ export default createStore({
"edc:description": "Battery Passport test data",
"edc:id": "365e6fbe-bb34-11ec-8422-0242ac120002-61125dc3-5e6f-4f4b-838d-447432b97918"
},
- {
+ "5c4fbb7d-cf02-4401-a7a3-f0ec1c506f33": {
"@id": "5c4fbb7d-cf02-4401-a7a3-f0ec1c506f33",
"@type": "dcat:Dataset",
"odrl:hasPolicy": [{
@@ -212,11 +212,11 @@ export default createStore({
"edc:description": "Battery Passport test data",
"edc:id": "1f4a64f0-aba9-498a-917c-4936c24c50cd-49a06ad2-64b7-46c8-9f3b-a718c462ca23"
}
- ],
+ },
"token": "688787d8ff144c502c7f5cffaafe2cc588d86079f9de88304c26b0cb99ce91c6",
"id": "ccbf6bfb-c7e1-4db4-8225-9fa95ee82f7f"
},
- contractToSign: null,
+ contractToSign: {},
processId: null,
searchContractId: null,
irsState: false,
diff --git a/src/views/PassportView.vue b/src/views/PassportView.vue
index b630b9369..e92d749c2 100644
--- a/src/views/PassportView.vue
+++ b/src/views/PassportView.vue
@@ -206,7 +206,7 @@ export default {
irsData: [],
processId: null,
backendService: null,
- error: false,
+ error: true,
errorObj: {
title: "Something went wrong while returning the passport!",
description: "We are sorry for that, you can retry or try again later",