Skip to content

Commit

Permalink
feat: added Endpoint Documentation to Meta Data page (#300)
Browse files Browse the repository at this point in the history
refactor: renamed standardlicense to standardLicense
  • Loading branch information
SebastianOpriel authored Oct 28, 2022
1 parent df60f95 commit b223ba7
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 41 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
All notable changes to this project will be documented in this file.


## [x.x.x] - xxxx-xx-xx

### Added
- Endpoint Documentation to Meta Data page

### Changed
- renamed variable standardlicense to standardLicense


## [10.1.0] - 2022-10-06

### Fixed
Expand Down
19 changes: 13 additions & 6 deletions src/datamodel/clientDataModel.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import dataUtils from "@/utils/dataUtils";

export default {
createResource(url, id, creationDate, title, description, language, paymentMethod, keywords, version, standardlicense,
publisher, fileType, contractName, policyNames, contractPeriodFromValue, contractPeriodToValue, ruleIds, ruleJsons, artifactId, representationId, brokerUris, samples, catalogs, additional = {}) {
createResource(url, id, creationDate, title, description, language, paymentMethod, keywords, version,
standardLicense, publisher, fileType, contractName, policyNames, contractPeriodFromValue, contractPeriodToValue,
ruleIds, ruleJsons, artifactId, representationId, brokerUris, samples, catalogs, additional,
endpointDocumentation = {}) {
let resource = {};
if (url === undefined) {
resource.url = "";
Expand Down Expand Up @@ -49,10 +51,15 @@ export default {
} else {
resource.version = version;
}
if (standardlicense === undefined) {
resource.standardlicense = "";
if (standardLicense === undefined) {
resource.standardLicense = "";
} else {
resource.standardlicense = standardlicense;
resource.standardLicense = standardLicense;
}
if (endpointDocumentation === undefined) {
resource.endpointDocumentation = "";
} else {
resource.endpointDocumentation = endpointDocumentation;
}
if (publisher === undefined) {
resource.publisher = "";
Expand Down Expand Up @@ -394,7 +401,7 @@ export default {
return this.createResource(idsResource._links.self.href, dataUtils.getIdOfConnectorResponse(idsResource), idsResource.creationDate, title, description,
idsResource.language.replace("https://w3id.org/idsa/code/", ""), idsResource.paymentModality, idsResource.keywords,
idsResource.version, idsResource.license, idsResource.publisher, fileType, contractName, policyNames, contractPeriodFromValue, contractPeriodToValue, ruleIds, ruleJsons, artifactId, representationId, brokerUris,
idsResource.samples, catalogs, idsResource.additional);
idsResource.samples, catalogs, idsResource.additional,idsResource.endpointDocumentation);
},


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ export default {
value: 'publisher'
}, {
text: 'License',
value: 'standardlicense'
value: 'standardLicense'
}, {
text: 'Endpoint Documentation',
value: 'endpointDocumentation'
}, {
text: 'Offered from',
value: 'contractPeriodFromValue'
Expand Down Expand Up @@ -163,7 +166,7 @@ export default {
},
getConnectorSelfDescription() {
// this.$root.$emit('showBusyIndicator', true);
// TODO Get resources
// TODO Get resources
},
clear() {
this.$data.selectedCatalog = "";
Expand Down Expand Up @@ -316,7 +319,12 @@ export default {
},

async requestArtifact(item) {
this.$refs.artifactDialog.show(this.$data.selectedResource["ids:contractOffer"][0]["ids:permission"], this.$data.selectedResource["ids:standardLicense"]["@id"], item, this.clickAcceptContract);
this.$refs.artifactDialog.show(
this.$data.selectedResource["ids:contractOffer"][0]["ids:permission"],
this.$data.selectedResource["ids:standardLicense"]["@id"],
item,
this.clickAcceptContract
);
},

clickAcceptContract(artifact, subscribe, subscriptionLocation) {
Expand Down
15 changes: 8 additions & 7 deletions src/pages/dataoffering/resources/addresource/AddResourcePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ export default {
let language = this.$refs.metaDataPage.language;
let paymentMethod = this.$refs.metaDataPage.paymentMethod;
let keywords = dataUtils.commaSeperatedStringToArray(this.$refs.metaDataPage.keywords);
let standardlicense = this.$refs.metaDataPage.standardlicense;
let standardLicense = this.$refs.metaDataPage.standardLicense;
let endpointDocumentation = this.$refs.metaDataPage.endpointDocumentation;
let publisher = this.$refs.metaDataPage.publisher;
let samples = this.$refs.metaDataPage.samples;
let additionalFields = {};
Expand Down Expand Up @@ -189,22 +190,22 @@ export default {

if (this.fromRoutePage === 'true') {
// On route page this data is initially stored only in the node and will be saved with the route.
this.$emit("saved", catalogIds, title, description, language, paymentMethod, keywords, 0, standardlicense, publisher, templateTitle,
policyDescriptions, contractPeriodFromValue, contractPeriodToValue, filetype, 0, brokerList);
this.$emit("saved", catalogIds, title, description, language, paymentMethod, keywords, 0, standardLicense, publisher, templateTitle,
policyDescriptions, contractPeriodFromValue, contractPeriodToValue, filetype, 0, brokerList, endpointDocumentation);
} else {
this.$root.$emit('showBusyIndicator', true);
this.$root.$emit('blockNavigationMenu', true);
if (this.$data.currentResource == null) {
await dataUtils.createResourceWithMinimalRoute(catalogIds, title, description, language, paymentMethod, keywords, standardlicense, publisher,
templateTitle, policyDescriptions, contractPeriodFromValue, contractPeriodToValue, filetype, brokerList, file, genericEndpoint, additionalFields);
await dataUtils.createResourceWithMinimalRoute(catalogIds, title, description, language, paymentMethod, keywords, standardLicense, publisher,
templateTitle, policyDescriptions, contractPeriodFromValue, contractPeriodToValue, filetype, brokerList, file, genericEndpoint, additionalFields, endpointDocumentation);
await this.$router.push('idsresourcesoffering');
this.$root.$emit('showBusyIndicator', false);
this.$root.$emit('blockNavigationMenu', false);
} else {
await dataUtils.editResource(this.$data.currentResource.id, this.$data.currentResource.representationId, catalogIds, deletedCatalogIds,
title, description, language, paymentMethod, keywords, standardlicense, publisher, samples, templateTitle, policyDescriptions, contractPeriodFromValue,
title, description, language, paymentMethod, keywords, standardLicense, publisher, samples, templateTitle, policyDescriptions, contractPeriodFromValue,
contractPeriodToValue, filetype, brokerList, brokerDeleteList, file, genericEndpoint, this.$data.currentResource.ruleId,
this.$data.currentResource.artifactId, additionalFields);
this.$data.currentResource.artifactId, additionalFields, endpointDocumentation);
this.$router.push('idsresourcesoffering');
this.$root.$emit('showBusyIndicator', false);
this.$root.$emit('blockNavigationMenu', false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
</v-text-field>
<v-text-field label="Keywords" v-model="keywords" readonly>
</v-text-field>
<v-text-field label="Standard License" v-model="standardlicense" readonly>
<v-text-field label="Standard License" v-model="standardLicense" readonly>
</v-text-field>
<v-text-field label="Endpoint Documentation" v-model="endpointDocumentation" readonly>
</v-text-field>
<v-select label="Language" v-model="language" :items="languageItems" item-text="displayName"
item-value="originalName" readonly>
Expand All @@ -29,7 +31,9 @@
</v-text-field>
<v-text-field label="Keywords" v-model="keywords" :rules="defaultRule" required>
</v-text-field>
<v-text-field label="Standard License" v-model="standardlicense" :rules="urlRule" required>
<v-text-field label="Standard License" v-model="standardLicense" :rules="urlRule" required>
</v-text-field>
<v-text-field label="Endpoint Documentation" v-model="endpointDocumentation" :rules="urlNotRequiredRule" required>
</v-text-field>
<v-select label="Language" v-model="language" :items="languageItems" item-text="displayName"
item-value="originalName" :rules="defaultRule" required>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export default {
description: "",
keywords: "",
publisher: "",
standardlicense: "",
standardLicense: "",
endpointDocumentation: "",
language: "",
samples: [],
languageItems: [],
Expand All @@ -23,6 +24,7 @@ export default {
valid: false,
defaultRule: validationUtils.getRequiredRule(),
urlRule: validationUtils.getUrlRequiredRule(),
urlNotRequiredRule: validationUtils.getUrlNotRequiredRule(),
readonly: false,
onlyMetaData: false
};
Expand Down Expand Up @@ -56,7 +58,8 @@ export default {
this.$data.language = resource.language.substring(resource.language.lastIndexOf("/") + 1);
this.$data.paymentMethod = resource.paymentMethod;
this.$data.keywords = dataUtils.arrayToCommaSeperatedString(resource.keywords);
this.$data.standardlicense = resource.standardlicense;
this.$data.standardLicense = resource.standardLicense;
this.$data.endpointDocumentation = resource.endpointDocumentation;
this.$data.publisher = resource.publisher;
this.$data.samples = resource.samples;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export default {
this.$refs.addResourcePage.set(resource, false);
this.$data.dialog = true;
},
saved(catalogIds, title, description, language, paymentMethod, keywords, version, standardlicense, publisher, templateTitle, policyDescriptions,
contractPeriodFromValue, contractPeriodToValue, filetype, bytesize, brokerList) {
saved(catalogIds, title, description, language, paymentMethod, keywords, version, standardLicense, publisher, templateTitle, policyDescriptions,
contractPeriodFromValue, contractPeriodToValue, filetype, bytesize, brokerList, endpointDocumentation) {
let isNew = false;
if (this.$data.node == null) {
isNew = true;
Expand All @@ -68,7 +68,8 @@ export default {
resource.paymentMethod = paymentMethod;
resource.keywords = keywords;
resource.version = version;
resource.standardlicense = standardlicense;
resource.standardLicense = standardLicense;
resource.endpointDocumentation = endpointDocumentation;
resource.publisher = publisher;
resource.title = templateTitle;
resource.policyDescriptions = policyDescriptions;
Expand Down
43 changes: 25 additions & 18 deletions src/utils/dataUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -958,8 +958,8 @@ export default {
}
},

async createResourceWithMinimalRoute(catalogIds, title, description, language, paymentMethod, keywords, standardlicense, publisher, templateTitle, policyDescriptions,
contractPeriodFromValue, contractPeriodToValue, filetype, brokerUris, file, genericEndpoint, additionalFields = {}) {
async createResourceWithMinimalRoute(catalogIds, title, description, language, paymentMethod, keywords, standardLicense, publisher, templateTitle, policyDescriptions,
contractPeriodFromValue, contractPeriodToValue, filetype, brokerUris, file, genericEndpoint, additionalFields, endpointDocumentation = {}) {
try {
let routeSelfLink = null;
if (genericEndpoint != null) {
Expand All @@ -968,25 +968,26 @@ export default {
routeSelfLink = response._links.self.href;
await restUtils.callConnector("PUT", "/api/routes/" + routeId + "/endpoint/start", null, "\"" + genericEndpoint.selfLink + "\"");
}
let resourceResponse = await this.createResource(catalogIds, title, description, language, paymentMethod, keywords, standardlicense, publisher,
policyDescriptions, templateTitle, contractPeriodFromValue, contractPeriodToValue, filetype, file, routeSelfLink, additionalFields);
let resourceResponse = await this.createResource(catalogIds, title, description, language, paymentMethod, keywords, standardLicense, publisher,
policyDescriptions, templateTitle, contractPeriodFromValue, contractPeriodToValue, filetype, file, routeSelfLink, additionalFields, endpointDocumentation);
await this.updateResourceAtBrokers(brokerUris, resourceResponse.resourceId);
} catch (error) {
errorUtils.showError(error, "Save resource");
}
},

async createResource(catalogIds, title, description, language, paymentMethod, keywords, standardlicense, publisher, policyDescriptions, templateTitle,
contractPeriodFromValue, contractPeriodToValue, filetype, file, routeSelfLink, additionalFields= {}) {
// TODO Sovereign, EndpointDocumentation
async createResource(catalogIds, title, description, language, paymentMethod, keywords, standardLicense, publisher, policyDescriptions, templateTitle,
contractPeriodFromValue, contractPeriodToValue, filetype, file, routeSelfLink, additionalFields, endpointDocumentation= {}) {
// TODO Sovereign
let resourceFields = {
"title": title,
"description": description,
"keywords": keywords,
"publisher": publisher,
"language": language,
"paymentMethod": paymentMethod,
"license": standardlicense
"license": standardLicense,
"endpointDocumentation": endpointDocumentation
}
let response = (await restUtils.callConnector("POST", "/api/offers", null, Object.assign(resourceFields, additionalFields)));

Expand Down Expand Up @@ -1033,8 +1034,8 @@ export default {
},

async editResource(resourceId, representationId, catalogIds, deletedCatalogIds, title, description, language, paymentMethod,
keywords, standardlicense, publisher, samples, templateTitle, policyDescriptions, contractPeriodFromValue, contractPeriodToValue,
filetype, brokerUris, brokerDeleteUris, file, genericEndpoint, ruleId, artifactId, additionalFields = {}) {
keywords, standardLicense, publisher, samples, templateTitle, policyDescriptions, contractPeriodFromValue, contractPeriodToValue,
filetype, brokerUris, brokerDeleteUris, file, genericEndpoint, ruleId, artifactId, additionalFields, endpointDocumentation = {}) {
try {
let resourceFields = {
"title": title,
Expand All @@ -1043,7 +1044,8 @@ export default {
"publisher": publisher,
"language": language,
"paymentMethod": paymentMethod,
"license": standardlicense,
"license": standardLicense,
"endpointDocumentation": endpointDocumentation,
"samples": samples
}
await restUtils.callConnector("PUT", "/api/offers/" + resourceId, null, Object.assign(resourceFields, additionalFields));
Expand Down Expand Up @@ -1117,7 +1119,8 @@ export default {
"publisher": resource.publisher,
"language": resource.language,
"paymentMethod": resource.paymentMethod,
"license": resource.standardlicense,
"license": resource.standardLicense,
"endpointDocumentation": resource.endpointDocumentation,
"samples": samples
});
} catch (error) {
Expand All @@ -1142,16 +1145,17 @@ export default {
let language = resource.language;
let paymentMethod = resource.paymentMethod;
let keywords = resource.keywords;
let standardlicense = resource.standardlicense;
let standardLicense = resource.standardLicense;
let endpointDocumentation = resource.endpointDocumentation;
let publisher = resource.publisher;
let policyDescriptions = resource.policyDescriptions;
let contractPeriodFromValue = resource.contractPeriodFromValue;
let contractPeriodToValue = resource.contractPeriodToValue;
let filetype = resource.fileType;
let brokerUris = resource.brokerUris;
let contractName = resource.contractName;
let resourceResponse = await this.createResource(catalogIds, title, description, language, paymentMethod, keywords, standardlicense, publisher,
policyDescriptions, contractName, contractPeriodFromValue, contractPeriodToValue, filetype, null, routeSelfLink);
let resourceResponse = await this.createResource(catalogIds, title, description, language, paymentMethod, keywords, standardLicense, publisher,
policyDescriptions, contractName, contractPeriodFromValue, contractPeriodToValue, filetype, null, routeSelfLink, undefined, endpointDocumentation);

await this.updateResourceAtBrokers(brokerUris, resourceResponse.resourceId);
},
Expand Down Expand Up @@ -1461,7 +1465,8 @@ export default {
keywords.push(idsKeyword["@value"]);
}
let version = resource["ids:version"];
let standardlicense = resource["ids:standardLicense"]["@id"];
let standardLicense = resource["ids:standardLicense"]["@id"];
let endpointDocumentation = resource["ids:endpointDocumentation"]["@id"];
let publisher = resource["ids:publisher"]["@id"];
let fileType = null;
if (resource["ids:representation"] !== undefined && resource["ids:representation"].length > 0) {
Expand All @@ -1474,8 +1479,10 @@ export default {
contractPeriodToValue = resource["ids:contractOffer"][0]["ids:contractEnd"]["@value"];
}
let contractName = resource.contractName;
let clientResource = clientDataModel.createResource(resource["@id"], id, creationDate, title, description, language, paymentMethod, keywords, version, standardlicense,
publisher, fileType, contractName, "", contractPeriodFromValue, contractPeriodToValue, null);
let clientResource = clientDataModel.createResource(resource["@id"], id, creationDate, title, description,
language, paymentMethod, keywords, version, standardLicense, publisher, fileType, contractName, "",
contractPeriodFromValue, contractPeriodToValue, undefined, undefined, undefined, undefined, undefined,
undefined, undefined, undefined, endpointDocumentation);
clientResource.idsResource = resource;
resources.push(clientResource);
},
Expand Down

0 comments on commit b223ba7

Please sign in to comment.