make public butto, save and finalize, dataset profile field

This commit is contained in:
annampak 2018-01-19 10:09:35 +02:00
parent 943d121e98
commit e4d1fd5398
7 changed files with 40 additions and 17 deletions

View File

@ -13,7 +13,7 @@
</auto-complete> -->
<mat-form-field>
<mat-select placeholder=" {{'DATASET-WIZARD.FIRST-STEP.PROFILE'| translate}}" formControlName="profile">
<mat-option *ngFor="let profile of availableProfiles" [value]="profile">
<mat-option *ngFor="let profile of availableProfiles" [value]=" formGroup.get('profile').value">
{{profile.label}}
</mat-option>
</mat-select>

View File

@ -67,11 +67,20 @@
<!-- Column Definition: Submission Time -->
<ng-container cdkColumnDef="actions">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.ACTIONS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"></mat-cell>
<mat-cell *matCellDef="let row">
<mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="rowClick(row.id)"><mat-icon>mode_edit</mat-icon>{{'DATASET-LISTING.ACTIONS.EDIT' | translate}}</button>
<button mat-menu-item (click)="makeItPublic(row.id)"><mat-icon>people_outline</mat-icon>{{'DATASET-LISTING.ACTIONS.MAKE-IT-PUBLIC' | translate}}</button>
</mat-menu>
<button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_vert</mat-icon>
</button>
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns" (click)="rowClick(row.id)"></mat-row>
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
<!-- (click)="rowClick(row.id)" -->
</mat-table>
<mat-paginator #paginator [length]="dataSource?.totalCount" [pageSizeOptions]="[10, 25, 100]">

View File

@ -85,6 +85,10 @@ export class DatasetListingComponent implements OnInit {
return defaultCriteria;
}
makeItPublic(){
}
}
export class DatasetDataSource extends DataSource<DatasetListingModel> {

View File

@ -6,11 +6,11 @@
<!-- <mat-sidenav-content> -->
<!-- <button mat-raised-button color="primary" style="margin: 15px;" (click)="toggleSidebar()" icon="fa-arrow-left">Table Of Contents</button> -->
<form *ngIf="form" novalidate [formGroup]="form" (ngSubmit)="onSubmit()">
<button mat-raised-button color="primary" *ngIf="datasetProfileDefinitionModel&&datasetProfileDefinitionModel.status != 1"
style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" type="submit">Save</button>
<!-- <button mat-raised-button color="primary" *ngIf="datasetProfileDefinitionModel&&datasetProfileDefinitionModel?.status != 1"
style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" (click)="submit();">Save and Finalize</button> -->
<form *ngIf="form" novalidate [formGroup]="form">
<button mat-raised-button color="primary" *ngIf="dataModel&&dataModel.status.toString() != 1"
style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" (click)="save();" type="button">Save</button>
<button mat-raised-button color="primary" *ngIf="dataModel&&dataModel?.status != 1"
style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" (click)="saveFinalize();" type ="button">Save and Finalize</button>
<div>
<div class="alignment-center">
<!-- <ngb-pagination *ngIf="pages" [collectionSize]="pages.length*10" [page]="currentPageIndex" (pageChange)="changePageIndex($event)" aria-label="Default pagination"></ngb-pagination> -->

View File

@ -78,7 +78,6 @@ export class DynamicFormComponent implements OnInit {
if (params && "page" in params)
this.changeCurrentPage(params["page"]);
});
/* else{
this.addSection();
@ -90,14 +89,20 @@ export class DynamicFormComponent implements OnInit {
this.visibilityRulesService.buildVisibilityRules(rules) */
}
submit() {
}
onSubmit(){
this.datasetWizardService.saveDataset(this.dataModel.id, this.form.value).subscribe(data => {
submit(){
this.datasetWizardService.saveDataset(this.dataModel.id, this.dataModel.status, this.form.value).subscribe(data => {
this.router.navigateByUrl("/datasets/" + this.dataModel.dmp.id);
});
}
save(){
this.dataModel.status= "0";
this.submit();
}
saveFinalize() {
this.dataModel.status= "1";
this.submit();
}
toggleSidebar() {

View File

@ -43,7 +43,8 @@ export class DatasetWizardService {
return this.http.post<DatasetWizardModel>(this.actionUrl + 'createOrUpdate', datasetModel, { headers: this.headers });
}
public saveDataset(datasetId:String, formValue){
public saveDataset(datasetId:String, datasetStatus:String, formValue){
formValue.status = datasetStatus;
return this.http.post(HostConfiguration.Server +'datasetprofile/save/'+datasetId, formValue, { headers: this.headers })
}
}

View File

@ -85,6 +85,10 @@
"DATAREPOSITORIES": "Data Repositories",
"REGISTRIES": "Registries",
"SERVICES": "Services"
},
"ACTIONS": {
"EDIT": "Edit",
"MAKE-IT-PUBLIC": "Make it public"
}
},
"PROJECT-EDITOR": {