summaryrefslogtreecommitdiffstats
path: root/cds-ui/client/src/app/feature-modules/blueprint
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-06-25 18:57:41 +0000
committerGerrit Code Review <gerrit@onap.org>2019-06-25 18:57:41 +0000
commited124819a2c928d895ba275d51eadc97afdf5a09 (patch)
tree9e4d2180c54c968f1d2093731a892c70c2f17353 /cds-ui/client/src/app/feature-modules/blueprint
parenteba8ca3300290460f3df5e984b6de92d06de222f (diff)
parent3bc6917ecd7c3fb22c8a65d5279179fc2bb4d6aa (diff)
Merge "Replace windows alert with Notification component"
Diffstat (limited to 'cds-ui/client/src/app/feature-modules/blueprint')
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts37
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts6
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts10
3 files changed, 36 insertions, 17 deletions
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
index b982fa29f..0a3a8d2ef 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
@@ -39,6 +39,9 @@ import { ApiService } from 'src/app/common/core/services/api.service';
import { IMetaData } from 'src/app/common/core/store/models/metadata.model';
import { EditorService } from './editor.service';
import { SortPipe } from '../../../../common/shared/pipes/sort.pipe';
+import { NotificationHandlerService } from 'src/app/common/core/services/notification-handler.service';
+import { LoaderService } from 'src/app/common/core/services/loader.service';
+
interface Node {
name: string;
@@ -107,6 +110,7 @@ export class EditorComponent implements OnInit {
private tocsaMetadaData: any;
metadata: IMetaData;
uploadedFileName: string;
+ entryDefinition: string;
private transformer = (node: Node, level: number) => {
return {
@@ -126,7 +130,10 @@ export class EditorComponent implements OnInit {
artifactName: any;
artifactVersion: any;
- constructor(private store: Store<IAppState>, private apiservice: EditorService) {
+ constructor(private store: Store<IAppState>, private apiservice: EditorService,
+ private alertService: NotificationHandlerService, private loader: LoaderService
+ )
+ {
this.dataSource.data = TREE_DATA;
this.bpState = this.store.select('blueprint');
// this.dataSource.data = TREE_DATA;
@@ -162,6 +169,7 @@ export class EditorComponent implements OnInit {
this.dataSource.data = this.filesTree;
this.blueprintName = blueprintdata.name;
this.uploadedFileName = blueprintdata.uploadedFileName;
+ this.entryDefinition = blueprintdata.entryDefinition;
let blueprint = [];
for (let key in this.blueprintdata) {
if (this.blueprintdata.hasOwnProperty(key)) {
@@ -206,10 +214,10 @@ export class EditorComponent implements OnInit {
name: this.blueprintName,
files: this.filesTree,
filesData: this.filesData,
- uploadedFileName: this.uploadedFileName
+ uploadedFileName: this.uploadedFileName,
+ entryDefinition: this.entryDefinition
}
this.store.dispatch(new SetBlueprintState(blueprintState));
- // console.log(this.text);
}
selectFileToView(file) {
@@ -227,7 +235,6 @@ export class EditorComponent implements OnInit {
}
})
this.fileExtension = this.selectedFile.substr(this.selectedFile.lastIndexOf('.') + 1);
- // console.log(this.fileExtension);
this.setEditorMode();
}
@@ -248,7 +255,10 @@ export class EditorComponent implements OnInit {
console.log("processed");
}
});
- window.alert('Blueprint enriched successfully');
+ this.alertService.success('Blueprint enriched successfully');
+ },
+ (error)=>{
+ this.alertService.error('Enrich:' + error.message);
});
});
}
@@ -264,8 +274,9 @@ export class EditorComponent implements OnInit {
this.apiservice.post("/create-blueprint/", formData)
.subscribe(
data => {
- // console.log(data);
- window.alert('Success:' + JSON.stringify(data));
+ this.alertService.success('Success:' + JSON.stringify(data));
+ }, error=>{
+ this.alertService.error('Save -' +error.message);
});
});
@@ -280,8 +291,9 @@ export class EditorComponent implements OnInit {
formData.append("file", blob);
this.apiservice.deployPost("/deploy-blueprint/", formData)
.subscribe(data => {
- // console.log(data);
- window.alert('Saved Successfully:' + JSON.stringify(data));
+ this.alertService.success('Saved Successfully:' + JSON.stringify(data));
+ }, error=>{
+ this.alertService.error('Deploy - ' + error.message);
});
});
@@ -295,8 +307,9 @@ export class EditorComponent implements OnInit {
formData.append("file", blob);
this.apiservice.post("/publish/", formData)
.subscribe(data => {
- // console.log(data);
- window.alert('Published:' + JSON.stringify(data));
+ this.alertService.success('Published:' + JSON.stringify(data))
+ }, error=>{
+ this.alertService.error('Publish - ' + error.message);
});
});
@@ -580,6 +593,7 @@ export class EditorComponent implements OnInit {
}
saveEditedChanges() {
+ this.loader.showLoader();
this.filesData.forEach(fileNode => {
if (this.selectedFile && fileNode.name.includes(this.blueprintName.trim()) && fileNode.name.includes(this.selectedFile.trim())) {
fileNode.data = this.text;
@@ -596,5 +610,6 @@ export class EditorComponent implements OnInit {
}
this.updateBlueprint();
+ this.loader.hideLoader();
}
}
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts
index 0792c4478..cefe0fd93 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts
@@ -29,6 +29,7 @@ import { IBlueprintState } from 'src/app/common/core/store/models/blueprintState
import { IBlueprint } from 'src/app/common/core/store/models/blueprint.model';
import { IMetaData } from '../../../../common/core/store/models/metadata.model';
import { SetBlueprintState } from 'src/app/common/core/store/actions/blueprint.action';
+import { LoaderService } from '../../../../common/core/services/loader.service';
@Component({
selector: 'app-metadata',
@@ -48,7 +49,7 @@ export class MetadataComponent implements OnInit {
uploadedFileName: string;
entryDefinition: string;
- constructor(private formBuilder: FormBuilder, private store: Store<IAppState>) {
+ constructor(private formBuilder: FormBuilder, private store: Store<IAppState>, private loader: LoaderService) {
this.bpState = this.store.select('blueprint');
this.CBAMetadataForm = this.formBuilder.group({
template_author: ['', Validators.required],
@@ -96,6 +97,7 @@ export class MetadataComponent implements OnInit {
}
UploadMetadata() {
+ this.loader.showLoader();
this.metadata = Object.assign({}, this.CBAMetadataForm.value);
this.blueprint.metadata = this.metadata;
if( this.blueprint &&
@@ -119,6 +121,6 @@ export class MetadataComponent implements OnInit {
entryDefinition: this.entryDefinition
}
this.store.dispatch(new SetBlueprintState(blueprintState));
+ this.loader.hideLoader();
}
-
} \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
index 92003c919..1221e8f2b 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
@@ -30,6 +30,7 @@ import { IAppState } from '../../../../common/core/store/state/app.state';
import { LoadBlueprintSuccess, SET_BLUEPRINT_STATE, SetBlueprintState } from '../../../../common/core/store/actions/blueprint.action';
import { json } from 'd3';
import { SortPipe } from '../../../../common/shared/pipes/sort.pipe';
+import { LoaderService } from '../../../../common/core/services/loader.service';
@Component({
selector: 'app-search-template',
@@ -56,7 +57,7 @@ export class SearchTemplateComponent implements OnInit {
private blueprintName: string;
private entryDefinition: string;
- constructor(private store: Store<IAppState>) { }
+ constructor(private store: Store<IAppState>, private loader: LoaderService) { }
ngOnInit() {
}
@@ -68,7 +69,8 @@ export class SearchTemplateComponent implements OnInit {
this.zipFile.files = {};
this.zipFile.loadAsync(this.file)
.then((zip) => {
- if(zip) {
+ if(zip) {
+ this.loader.showLoader();
this.buildFileViewData(zip);
}
});
@@ -157,8 +159,8 @@ export class SearchTemplateComponent implements OnInit {
}
}
});
- });
- console.log('tree', tree);
+ });
+ this.loader.hideLoader();
return tree;
}