summaryrefslogtreecommitdiffstats
path: root/cds-ui
diff options
context:
space:
mode:
Diffstat (limited to 'cds-ui')
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.html2
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html8
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.html2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.ts10
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html4
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html4
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.scss5
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts19
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.module.ts4
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts39
10 files changed, 76 insertions, 21 deletions
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.html b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.html
index 546668d43..a6612d537 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.html
+++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.html
@@ -26,7 +26,7 @@ limitations under the License.
<div style="display: flex;flex-direction: row">
<div style="width: 30em;">
- <button class="btn-active" (click)="changeView()">{{viewText}}</button>
+ <button class="btn-active" (click)="changeView()" disabled>{{viewText}}</button>
</div>
<div style="width: 16em">
</div>
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html b/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html
index 9c2d721e0..d66b559f3 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html
@@ -19,7 +19,7 @@ limitations under the License.
============LICENSE_END============================================
-->
<mat-radio-group>
- <mat-radio-button value="1" (click)="selected(1)">Upload Template file</mat-radio-button><br><br>
- <mat-radio-button value="2" (click)="selected(2)">Starter Template</mat-radio-button><br><br>
- <mat-radio-button value="3" (click)="selected(3)">Existing Model File</mat-radio-button>
-</mat-radio-group>
+ <mat-radio-button value="1" (click)="selected(1)">Upload Template file</mat-radio-button><br><br>
+ <!-- <mat-radio-button value="2" (click)="selected(2)">Starter Template</mat-radio-button><br><br>
+ <mat-radio-button value="3" (click)="selected(3)">Existing Model File</mat-radio-button> -->
+</mat-radio-group> \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.html
index d02cef429..a2e0a7c05 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.html
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.html
@@ -20,7 +20,7 @@
<form class="example-form" [formGroup]="myControl">
<mat-form-field class="example-full-width">
- <input type="text" [(ngModel)]="searchText" placeholder="Search Resources" matInput [matAutocomplete]="auto" formControlName="search_input">
+ <input #resourceSelect type="text" [(ngModel)]="searchText" placeholder="Search Resources" matInput [matAutocomplete]="auto" formControlName="search_input">
<button matSuffix mat-icon-button (click)="fetchResourceByName()"><mat-icon>search</mat-icon></button>
<mat-autocomplete #auto="matAutocomplete">
<mat-option (click)="selected(option)" *ngFor="let option of options | search : searchText" [value]="option.tags">
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.ts
index 1850549aa..5aac51bed 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.ts
@@ -21,6 +21,7 @@
import { Component, OnInit, ViewChild, EventEmitter, Output } from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import { ExsistingModelService } from '../exsisting-model.service';
+import { MatAutocompleteTrigger } from '@angular/material'
@Component({
selector: 'app-search-resource',
@@ -31,8 +32,9 @@ export class SearchResourceComponent implements OnInit {
myControl: FormGroup;
@Output() resourcesData = new EventEmitter();
- options: any[] = [] ;
- // = ['One','One1', 'Two', 'Three'];
+ options: any[] = ['One','One1', 'Two', 'Three'];
+ // @ViewChild('resourceSelect') resourceSelect;
+ @ViewChild('resourceSelect', { read: MatAutocompleteTrigger }) resourceSelect: MatAutocompleteTrigger;
searchText: string = '';
constructor(private _formBuilder: FormBuilder,
@@ -53,8 +55,8 @@ export class SearchResourceComponent implements OnInit {
console.log(data);
data.forEach(element => {
this.options.push(element)
- });
- // this.options = data.
+ });
+ this.resourceSelect.openPanel();
}, error=>{
window.alert('error' + error);
})
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html
index 9b4dbe5e1..afb2b9d55 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html
@@ -29,10 +29,10 @@
<app-resource-template-options (option)="selectedOption($event)"></app-resource-template-options>
<br>
<div>
- <button mat-button matStepperNext class="matStepNextBtn">Proceed</button>
+ <button mat-button matStepperNext class="matStepNextBtn" *ngIf="selectedValue == 1 || selectedValue == 3">Proceed</button>
</div>
</mat-step>
- <mat-step [stepControl]="step2FormGroup">
+ <mat-step [stepControl]="step2FormGroup" *ngIf="selectedValue == 1 || selectedValue == 3">
<ng-template matStepLabel>Browse or Search Resources</ng-template>
<app-upload-resource (fileData)=upload($event) *ngIf="selectedValue == 1"></app-upload-resource><br><br>
<app-existing-model *ngIf="selectedValue == 3"></app-existing-model>
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html
index de81e2394..4bd4ad456 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html
@@ -19,7 +19,7 @@
*/-->
-<button (click) ="changeView()" class="toggle-view-btn">{{viewText}}</button>
+<button disabled style="opacity: 0.5;" (click) ="changeView()" class="toggle-view-btn">{{viewText}}</button>
<br><br>
<div *ngIf="designerMode">
<mat-card class="metadata-card">
@@ -50,5 +50,5 @@
<div class="btn">
<button mat-button matStepperPrevious>Back</button></div>
<div class="btn">
- <button mat-button matStepperNext type="submit" (click)="updateResourcesState()">Upload</button>
+ <button mat-button matStepperNext type="submit" (click)="saveToBackend()">Save</button>
</div>
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.scss b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.scss
index 280645e3d..9c2d42a83 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.scss
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.scss
@@ -41,7 +41,7 @@
background:#3f51b5;
margin-top: 10px;
position: absolute;
- border-radius: 1em;
+ border-radius: 4px;
}
.mat-card-title{
padding-top: 7px;
@@ -61,11 +61,12 @@
margin: 0 25px 25px 0;
display: inline-block;
vertical-align: top;
+ border-radius: 4px;
}
.toggle-view-btn{
color:white;
background:#3f51b5;
- border-radius: 1em;
+ border-radius: 4px;
margin-top: 10px;
padding:0.6em;
border: 1px solid #3f51b5;
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts
index 55b80628d..77e901717 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts
@@ -27,6 +27,7 @@ import { IAppState } from '../../../common/core/store/state/app.state';
import { JsonEditorComponent, JsonEditorOptions } from 'ang-jsoneditor';
import { Observable } from 'rxjs';
import { A11yModule } from '@angular/cdk/a11y';
+import { ResourceEditService } from './resource-edit.service';
@Component({
selector: 'app-resource-edit',
@@ -38,13 +39,13 @@ export class ResourceEditComponent implements OnInit {
resources:IResources;
data:IResources;
rdState: Observable<IResourcesState>;
- designerMode: boolean = true;
- editorMode: boolean = false;
+ designerMode: boolean = false;
+ editorMode: boolean = true;
viewText: string = "Open in Editor Mode";
@ViewChild(JsonEditorComponent) editor: JsonEditorComponent;
options = new JsonEditorOptions();
- constructor(private store: Store<IAppState>) {
+ constructor(private store: Store<IAppState>, private resourceEditService: ResourceEditService) {
this.rdState = this.store.select('resources');
this.options.mode = 'text';
this.options.modes = [ 'text', 'tree', 'view'];
@@ -92,5 +93,15 @@ export class ResourceEditComponent implements OnInit {
this.designerMode = true;
this.viewText = 'Open in Editor Mode'
}
- }
+ }
+
+ saveToBackend() {
+ this.resourceEditService.saveResource(this.data)
+ .subscribe(response=>{
+ window.alert("save success");
+ },
+ error=>{
+ window.alert('Error saving resources');
+ })
+ }
}
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.module.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.module.ts
index 2b25ae339..ae7143cfb 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.module.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.module.ts
@@ -30,6 +30,7 @@ import { SourcesTemplateComponent } from './sources-template/sources-template.co
import { ResourceMetadataComponent } from './resource-metadata/resource-metadata.component';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { NgJsonEditorModule } from 'ang-jsoneditor';
+import { ResourceEditService } from './resource-edit.service';
@NgModule({
declarations: [ ResourceEditComponent,SourcesTemplateComponent,ResourceMetadataComponent ],
@@ -42,6 +43,7 @@ import { NgJsonEditorModule } from 'ang-jsoneditor';
MatExpansionModule,MatToolbarModule,MatIconModule, MatButtonModule, MatSidenavModule, MatCheckboxModule, MatListModule, MatGridListModule, MatCardModule, MatMenuModule, MatTableModule, MatPaginatorModule, MatSortModule, MatInputModule, MatSelectModule, MatRadioModule, MatFormFieldModule, MatStepperModule,
NgJsonEditorModule
],
- exports: [ ResourceEditComponent,SharedModule ]
+ exports: [ ResourceEditComponent,SharedModule ],
+ providers: [ ResourceEditService ]
})
export class ResourceEditModule { }
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts
new file mode 100644
index 000000000..982d71d58
--- /dev/null
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts
@@ -0,0 +1,39 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://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 governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+
+import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { Observable, observable } from 'rxjs';
+import { ApiService } from '../../../common/core/services/api.service';
+import { LoopbackConfig, ResourceDictionaryURLs } from '../../../common/constants/app-constants';
+
+@Injectable()
+export class ResourceEditService {
+ // blueprintUrl = '../../constants/blueprint.json';
+
+ constructor(private _http: HttpClient, private api: ApiService) {
+ }
+
+ saveResource(resource) {
+ return this.api.post(LoopbackConfig.url+ ResourceDictionaryURLs.saveResourceDictionary, resource);
+ }
+} \ No newline at end of file