available profiles

This commit is contained in:
annampak 2018-02-08 10:50:39 +02:00
parent 3df3ed15ce
commit 6efe95614e
11 changed files with 108 additions and 10 deletions

View File

@ -19,7 +19,7 @@ export class RestBase {
*/
protocol: string = "http";
//hostname: string = "localhost";
hostname: string = "192.168.32.67";
hostname: string = "192.168.32.64";
port: number = 8080;
webappname: string = "";
restpath: string = "";

View File

@ -1,5 +1,5 @@
export const HostConfiguration = {
Server: 'http://192.168.32.67:8080/', //'http://dl043.madgik.di.uoa.gr:8080/'
Server: 'http://192.168.32.64:8080/', //'http://dl043.madgik.di.uoa.gr:8080/'
App: 'localhost:4200/' // 'http://dl043.madgik.di.uoa.gr:8080/'
//CASHost: 'https://login-devel.uoa.gr/login',
//Service: 'http://elkefinman/login'

View File

@ -0,0 +1,11 @@
<mat-selection-list #datasetsprofiles>
<mat-list-option *ngFor="let profile of profiles">
{{profile.label}}
</mat-list-option>
</mat-selection-list>
<p>
Dataset Profiles selected: {{datasetsprofiles.selectedOptions.selected.length}}
Dataset Profiles selected: {{datasetsprofiles.value}}
</p>
<button mat-raised-button color="primary" (click)="addProfiles(datasetsprofiles.selectedOptions.selected)">OK</button>

View File

@ -0,0 +1,40 @@
import { JsonSerializer } from '../utilities/JsonSerializer';
import { RequestItem } from '../models/criteria/RequestItem';
import { Component, OnInit, Inject } from "@angular/core";
import { FormGroup } from '@angular/forms';
import { Params, ActivatedRoute, Router } from '@angular/router';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { DatasetService } from '@app/services/dataset/dataset.service';
import { DatasetProfileModel } from '@app/models/datasetprofile/DatasetProfileModel';
@Component({
selector: 'available-profiles-component',
templateUrl: 'available-profiles.component.html',
providers: [DatasetService]
})
export class AvailableProfilesComponent implements OnInit {
private formGroup: FormGroup;
private profiles: DatasetProfileModel[] =[];
constructor(
private datasetService: DatasetService,
private route: ActivatedRoute,
public router: Router,
public dialogRef: MatDialogRef<AvailableProfilesComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) { }
ngOnInit(): void {
this.datasetService.getDatasetProfiles().subscribe(data=>{
this.profiles = JsonSerializer.fromJSONArray(data, DatasetProfileModel)
}
)
}
addProfiles(profiles){
this.dialogRef.close();
}
}

View File

@ -24,7 +24,8 @@ export class FormComponent {
form: FormGroup;
private profileID: string;
constructor(public datasetprofileAdmin: DatasetProfileAdmin, private datasetProfileService: DatasetProfileService, private route: ActivatedRoute) {
constructor(public datasetprofileAdmin: DatasetProfileAdmin, private datasetProfileService: DatasetProfileService, private route: ActivatedRoute,
private router:Router) {
this.profileID = route.snapshot.params['id'];
}
@ -82,8 +83,12 @@ export class FormComponent {
onSubmit() {
let data = this.form.value;
if (this.profileID) this.updateForm(this.profileID, data).subscribe();
else this.createForm(data).subscribe();
if (this.profileID) this.updateForm(this.profileID, data).subscribe(()=>{
this.router.navigate(['/datasetsProfiles'])
});
else this.createForm(data).subscribe(()=>{
this.router.navigate(['/datasetsProfiles'])
});
}
}

View File

@ -14,6 +14,7 @@ import { CovalentDialogsModule } from '@covalent/core';
import { SharedModule } from '../shared/shared.module'
import { NgModule } from '@angular/core';
import { AddResearchersComponent } from '@app/add-researchers/add-researchers.component';
import { AvailableProfilesComponent } from '@app/available-profiles/available-profiles.component';
@NgModule({
imports: [
@ -38,7 +39,8 @@ import { AddResearchersComponent } from '@app/add-researchers/add-researchers.co
DataManagementPlanEditorComponent,
InvitationComponent,
InvitationAcceptedComponent,
AddResearchersComponent
AddResearchersComponent,
AvailableProfilesComponent
],
exports: [
@ -46,12 +48,14 @@ import { AddResearchersComponent } from '@app/add-researchers/add-researchers.co
DataManagementPlanEditorComponent,
InvitationComponent,
InvitationAcceptedComponent,
AddResearchersComponent
AddResearchersComponent,
AvailableProfilesComponent
],
entryComponents: [
InvitationComponent,
AddResearchersComponent
AddResearchersComponent,
AvailableProfilesComponent
],
providers: [
BaseHttpService

View File

@ -38,6 +38,8 @@
<mat-error style="font-size:10.5px" *ngIf="formGroup.get('profiles').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</span>
</td-chips>
<!-- <button mat-button (click)="availableProfiles()">View All</button> -->
<a style="float:right" href="#" (click)="availableProfiles()">View All</a>
<td-chips color="accent" [items]="filteredOrganisations" formControlName="organisations" placeholder="{{'DMP-EDITOR.FIELDS.ORGANISATIONS' | translate}}"

View File

@ -23,6 +23,7 @@ import { DmpUsersModel } from "@app/models/dmpUsers/DmpUsersModel";
import { AddResearchersComponent } from "@app/add-researchers/add-researchers.component";
import { ViewContainerRef } from '@angular/core';
import { TdDialogService } from '@covalent/core';
import { AvailableProfilesComponent } from "@app/available-profiles/available-profiles.component";
@Component({
@ -223,6 +224,24 @@ export class DataManagementPlanEditorComponent implements AfterViewInit {
dmpName: rowName
}
});
}
availableProfiles() {
let dialogRef = this.dialog.open(AvailableProfilesComponent, {
height: '355px',
width: '700px',
data: {
}
});
dialogRef.afterClosed().subscribe(result => {
console.log(result);
});
return false;
}
openConfirm(dmpLabel, id): void {

View File

@ -1,3 +1,14 @@
.radio-label {
margin-left: 10px;
}
.inline-radio{
display: inline-flex;
flex-direction: row;
}
.mat-radio-group .mat-radio-inline {
display: flex;
}
.radio-button{
margin-right: 15px;
}

View File

@ -1,7 +1,7 @@
<div [formGroup]="form">
<mat-radio-group formControlName="value" [required]="field.validationRequired">
<mat-radio-group formControlName="value" [required]="field.validationRequired" class= "mat-radio-inline">
<div *ngFor="let option of this.field.data.options let index = index">
<mat-radio-button [value]="option.value" >{{option.label}}</mat-radio-button>
<mat-radio-button class="radio-button" [value]="option.value" >{{option.label}}</mat-radio-button>
</div>
</mat-radio-group>
</div>

View File

@ -9,6 +9,8 @@ import { DataTableData } from '../../models/data-table/DataTableData';
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
import { DatasetModel } from '../../models/datasets/DatasetModel';
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
import { DatasetProfileModel } from '@app/models/datasetprofile/DatasetProfileModel';
@Injectable()
@ -34,4 +36,8 @@ export class DatasetService {
return this.http.get(this.actionUrl + 'makepublic/' + id, { headers: this.headers })
}
getDatasetProfiles(): Observable<DatasetProfileModel[]>{
return this.http.get<DatasetProfileModel[]>(HostConfiguration.Server +'datasetprofiles/getAll', { headers: this.headers })
}
}