summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmedeldeeb50 <ahmed.eldeeb.ext@orange.com>2020-12-03 17:03:10 +0200
committerAhmedeldeeb50 <ahmed.eldeeb.ext@orange.com>2020-12-03 17:03:10 +0200
commiteafc8865d856cc282e0e0845c67ff232b1a5b805 (patch)
tree7a1f996fc36c17053456ebb14be861a5283b8d39
parentd578a475277774517207c96772e221e81b6c5d25 (diff)
add Enrich&Deploy function in designer
Issue-ID: CCSDK-2900 Signed-off-by: Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com> Change-Id: I098fc6bbb35953fbf3728b3863e7990918305edb
-rw-r--r--cds-ui/designer-client/src/app/common/constants/app-constants.ts1
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.html14
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html7
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts6
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts9
-rw-r--r--cds-ui/designer-client/src/styles.css2
-rw-r--r--cds-ui/server/src/controllers/blueprint-rest.controller.ts26
7 files changed, 52 insertions, 13 deletions
diff --git a/cds-ui/designer-client/src/app/common/constants/app-constants.ts b/cds-ui/designer-client/src/app/common/constants/app-constants.ts
index e29748535..51b183640 100644
--- a/cds-ui/designer-client/src/app/common/constants/app-constants.ts
+++ b/cds-ui/designer-client/src/app/common/constants/app-constants.ts
@@ -94,6 +94,7 @@ export const BlueprintURLs = {
save: '/controllerblueprint/create-blueprint',
publish: '/controllerblueprint/publish',
enrich: '/controllerblueprint/enrich-blueprint',
+ enrichandpublish: '/controllerblueprint/enrichandpublish',
download: '/controllerblueprint/download-blueprint/',
deploy: '/controllerblueprint/deploy-blueprint',
getMetaDate: '/controllerblueprint/meta-data/',
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.html
index 415179735..340ff2f48 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.html
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.html
@@ -326,7 +326,7 @@
</span>
<input type="radio" name="options"
[id]="suggestedAttribute+'.,.'" autocomplete="off"
- [checked]="suggestedAttributes[0].includes(suggestedAttribute)">
+ [checked]="suggestedAttributes[0]?.includes(suggestedAttribute)">
{{suggestedAttribute}}
<i class="icon-required-star" type="button"
aria-hidden="true"></i>
@@ -358,7 +358,7 @@
<input type="radio" name="options" [id]="suggestedArtifact"
autocomplete="off"
(click)="addArtifactFile(suggestedArtifact)"
- [checked]="currentArtifacts[0].includes(suggestedArtifact)">
+ [checked]="currentArtifacts[0]?.includes(suggestedArtifact)">
{{suggestedArtifact}}
</label>
@@ -389,7 +389,7 @@
--> <input type="radio" name="options"
[id]="suggestedMappingParameter" autocomplete="off"
(click)="addSuggestedMappingParameter(suggestedMappingParameter)"
- [checked]="suggestedMappingParameters[0].includes(suggestedMappingParameter)">
+ [checked]="suggestedMappingParameters[0]?.includes(suggestedMappingParameter)">
{{suggestedMappingParameter}}
</label>
@@ -645,17 +645,17 @@
<div class="col-sm-9">
<div class="list-group list-group-horizontal">
<button type="button" class="list-group-item list-group-item-action"
- [className]="suggestedEditedAttribute.type.includes('string')?'' +
+ [className]="suggestedEditedAttribute?.type?.includes('string')?'' +
'list-group-item list-group-item-action active':'list-group-item list-group-item-action'">String
</button>
<button type="button" class="list-group-item list-group-item-action"
- [className]="suggestedEditedAttribute.type.includes('integer')?'' +
+ [className]="suggestedEditedAttribute?.type?.includes('integer')?'' +
' list-group-item list-group-item-action active':'list-group-item list-group-item-action'">Integer</button>
<button type="button" class="list-group-item list-group-item-action"
- [className]="suggestedEditedAttribute.type.includes('boolean')?'' +
+ [className]="suggestedEditedAttribute?.type?.includes('boolean')?'' +
'list-group-item list-group-item-action active':'list-group-item list-group-item-action'">Boolean</button>
<button type="button" class="list-group-item list-group-item-action"
- [className]="suggestedEditedAttribute.type.includes('list')?'' +
+ [className]="suggestedEditedAttribute?.type?.includes('list')?'' +
'list-group-item list-group-item-action active':'list-group-item list-group-item-action'">List</button>
<button type="button" class="list-group-item list-group-item-action">Other
</button>
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html
index 87ef61c27..18ce515b5 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html
@@ -92,11 +92,12 @@
<li>
<a (click)="saveBluePrint()"><i class="icon-save-sm" aria-hidden="true"></i> Save</a>
</li>
- <li>
+ <!-- <li>
<a (click)="enrichBluePrint()"><i class="icon-enrich" aria-hidden="true"></i> Enrich</a>
- </li>
+ </li> -->
<li>
- <a (click)="publishBluePrint()"><i class="fa fa-play-circle" aria-hidden="true"></i> Deploy</a>
+ <a (click)="enrichBluePrint()"><i class="fa fa-play-circle" aria-hidden="true"></i>
+ Enrich & Deploy</a>
</li>
</ul>
</div>
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts
index 3347aa3ac..f3dc2fc4a 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts
@@ -493,15 +493,17 @@ export class DesignerComponent implements OnInit, OnDestroy {
this.create();
this.zipFile.generateAsync({ type: 'blob' })
.then(blob => {
- this.packageCreationService.enrichPackage(blob).subscribe(response => {
+ this.packageCreationService.enrichAndDeployPackage(blob).subscribe(response => {
+ // this.packageCreationService.enrichPackage(blob).subscribe(response => {
console.log('success');
const blobInfo = new Blob([response], { type: 'application/octet-stream' });
this.packageCreationStore.clear();
this.packageCreationExtractionService.extractBlobToStore(blobInfo);
- this.toastService.success('Enriched successfully ');
+ this.toastService.success('Enriched & Deployed successfully ');
}, err => {
console.log(err);
this.toastService.error(err.message, 'Enrich Failed');
+ this.ngxService.stop();
}, () => {
this.ngxService.stop();
});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts
index ed3db4286..2625dc8b3 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts
@@ -63,6 +63,10 @@ export class PackageCreationService {
return this.api.post(BlueprintURLs.enrich, body, {responseType: 'blob'});
}
+ private enrichandpublish(body: any | null, options?: any): Observable<any> {
+ return this.api.post(BlueprintURLs.enrichandpublish, body, {responseType: 'blob'});
+ }
+
private deployBluePrint(body: any | null, options?: any): Observable<any> {
return this.api.post(BlueprintURLs.deploy, body, {responseType: 'text'});
}
@@ -86,6 +90,11 @@ export class PackageCreationService {
return this.enrichBlueprint(formData);
}
+ enrichAndDeployPackage(blob) {
+ const formData = this.getFormData(blob);
+ return this.enrichandpublish(formData);
+ }
+
deploy(blob) {
const formData = this.getFormData(blob);
return this.deployBluePrint(formData);
diff --git a/cds-ui/designer-client/src/styles.css b/cds-ui/designer-client/src/styles.css
index f24b5f9ec..c52788aa3 100644
--- a/cds-ui/designer-client/src/styles.css
+++ b/cds-ui/designer-client/src/styles.css
@@ -855,7 +855,7 @@ height: 40px;
.dropdown-content{
position: absolute;
top: 32px;
- width: 140px;
+ width: 160px;
margin: 0;
padding: 0;
opacity: 0;
diff --git a/cds-ui/server/src/controllers/blueprint-rest.controller.ts b/cds-ui/server/src/controllers/blueprint-rest.controller.ts
index 91d7e66e3..86fdeda86 100644
--- a/cds-ui/server/src/controllers/blueprint-rest.controller.ts
+++ b/cds-ui/server/src/controllers/blueprint-rest.controller.ts
@@ -256,6 +256,32 @@ export class BlueprintRestController {
});
}
+ @post('/controllerblueprint/enrichandpublish')
+ async enrichAndPublish(
+ @requestBody({
+ description: 'multipart/form-data value.',
+ required: true,
+ content: {
+ 'multipart/form-data': {
+ // Skip body parsing
+ 'x-parser': 'stream',
+ schema: { type: 'object' },
+ },
+ },
+ })
+ request: Request,
+ @inject(RestBindings.Http.RESPONSE) response: Response,
+ ): Promise<Response> {
+ return new Promise((resolve, reject) => {
+ this.getFileFromMultiPartForm(request).then(file => {
+ if (appConfig.action.grpcEnabled)
+ return this.uploadFileToBlueprintProcessorGrpc(file, 'ENRICH', response);
+ else
+ return this.uploadFileToBlueprintController(file, '/blueprint-model/enrichandpublish/', response);
+ });
+ });
+ }
+
@get('/controllerblueprint/download-blueprint/{name}/{version}')
async download(
@param.path.string('name') name: string,