no message

This commit is contained in:
Ioannis Kalyvas 2018-08-31 11:14:56 +03:00
parent b34c96b264
commit d5a677184f
18 changed files with 80 additions and 29 deletions

View File

@ -77,8 +77,7 @@ public class DatasetWizardController extends BaseController {
public @ResponseBody
ResponseEntity<ResponseItem<DatasetWizardModel>> getSingle(@PathVariable String id, @ClaimedAuthorities(claims = {ANONYMOUS}) Principal principal) {
try {
DatasetWizardModel dataset = new DatasetManager().getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao(), this.getApiContext().getOperationsContext().getDatasetRepository()
, id);
DatasetWizardModel dataset = new DatasetManager().getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao(), this.getApiContext().getOperationsContext().getDatasetRepository(), id);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetWizardModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataset));
} catch (Exception ex) {
ex.printStackTrace();

View File

@ -78,7 +78,7 @@ export class AppComponent implements OnInit {
// this language will be used as a fallback when a translation isn't found in the current language
this.translate.setDefaultLang('en');
this.cultureService.cultureSelected(environment.defaultCulture);
this.authentication.current() ? this.cultureService.cultureSelected(this.authentication.current().culture) : this.cultureService.cultureSelected(environment.defaultCulture);
//this.setupChangeListeners();
}

View File

@ -110,12 +110,12 @@ import { CultureService } from './utilities/culture/culture-service';
{
provide: MAT_DATE_LOCALE,
deps: [CultureService],
useFactory: (cultureService) => cultureService.getCurrentCulture().name
useFactory: (cultureService) => cultureService.getCurrentCulture()
},
{
provide: LOCALE_ID,
deps: [CultureService],
useFactory: (cultureService) => cultureService.getCurrentCulture().name
useFactory: (cultureService) => cultureService.getCurrentCulture()
},
],
bootstrap: [AppComponent]

View File

@ -50,6 +50,7 @@ export class DatasetPublicListingComponent implements OnInit {
ngOnInit() {
this.route.params.subscribe(async (params: Params) => {
this.dmpId = params['dmpId'];
this.criteria.setCriteria(this.getDefaultCriteria(this.dmpId));
@ -68,7 +69,7 @@ export class DatasetPublicListingComponent implements OnInit {
}
rowClick(rowId: String) {
this.router.navigate(['/datasets/edit/' + rowId]);
this.router.navigate(['/datasets/publicEdit/' + rowId]);
}
getDefaultCriteria(dmpId: String): DatasetCriteria {

View File

@ -36,7 +36,8 @@
</mat-form-field>
<app-dataset-editor-component [formGroup]="formGroup"></app-dataset-editor-component>
<div class="navigation-buttons-container">
<button matStepperNext mat-raised-button style="float:right;" color="primary">{{'DATASET-WIZARD.ACTIONS.NEXT' | translate}}</button>
<button matStepperNext mat-raised-button style="float:right;" color="primary">{{'DATASET-WIZARD.ACTIONS.NEXT' |
translate}}</button>
</div>
</form>
@ -54,7 +55,7 @@
<app-external-item-listing *ngIf="formGroup.get('dataRepositories') && dataRepositoriesTemplate && externalSourcesConfiguration"
[options]="externalSourcesConfiguration.dataRepositories" placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}"
[parentTemplate]='dataRepositoriesTemplate' [displayFunction]='dataRepositoryDisplayFunc' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc'
[formGroup]="formGroup.get('dataRepositories')" [autoCompleteConfiguration]="dataRepositoriesAutoCompleteConfiguration"
[formGroup]="formGroup.get('dataRepositories')" [viewOnly]='viewOnly' [autoCompleteConfiguration]="dataRepositoriesAutoCompleteConfiguration"
(onItemChange)="dataRepositoriesOnItemChange($event)">
</app-external-item-listing>
@ -87,7 +88,7 @@
<app-external-item-listing *ngIf="formGroup.get('externalDatasets') && externalDatasetsTemplate && externalSourcesConfiguration"
[options]="externalSourcesConfiguration.externalDatasets" placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASETS' | translate}}"
[parentTemplate]='externalDatasetsTemplate' [displayFunction]='externalDatasetDisplayFunc' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc'
[formGroup]="formGroup.get('externalDatasets')" [autoCompleteConfiguration]="externalDatasetAutoCompleteConfiguration"
[formGroup]="formGroup.get('externalDatasets')" [viewOnly]='viewOnly' [autoCompleteConfiguration]="externalDatasetAutoCompleteConfiguration"
(onItemChange)="externalDatasetsOnItemChange($event)">
</app-external-item-listing>
@ -129,7 +130,7 @@
</mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('registries') && registriesTemplate && externalSourcesConfiguration" [options]="externalSourcesConfiguration.registries"
placeholder="{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}" [parentTemplate]='registriesTemplate' [displayFunction]='registriesDisplayFunc'
[formGroup]="formGroup.get('registries')" [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [autoCompleteConfiguration]="registriesAutoCompleteConfiguration"
[formGroup]="formGroup.get('registries')" [viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [autoCompleteConfiguration]="registriesAutoCompleteConfiguration"
(onItemChange)="registriesOnItemChange($event)">
</app-external-item-listing>
@ -156,7 +157,7 @@
</mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('services') && servicesTemplate && externalSourcesConfiguration" [options]="externalSourcesConfiguration.services"
placeholder="{{'DATASET-EDITOR.FIELDS.SERVICES' | translate}}" [parentTemplate]='servicesTemplate' [displayFunction]='servicesDisplayFunc'
[formGroup]="formGroup.get('services')" [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [autoCompleteConfiguration]="servicesAutoCompleteConfiguration"
[formGroup]="formGroup.get('services')" [viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [autoCompleteConfiguration]="servicesAutoCompleteConfiguration"
(onItemChange)="servicesOnItemChange($event)">
</app-external-item-listing>
@ -183,7 +184,7 @@
</mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('tags') && tagsTemplate && externalSourcesConfiguration" [options]="externalSourcesConfiguration.tags"
placeholder="{{'DATASET-EDITOR.FIELDS.TAGS' | translate}}" [parentTemplate]='tagsTemplate' [displayFunction]='tagsDisplayFunc'
[formGroup]="formGroup.get('tags')" [subtitleFunction]='tagsDisplaySubtitleFunc' [autoCompleteConfiguration]="tagsAutoCompleteConfiguration"
[formGroup]="formGroup.get('tags')" [viewOnly]='viewOnly' [subtitleFunction]='tagsDisplaySubtitleFunc' [autoCompleteConfiguration]="tagsAutoCompleteConfiguration"
(onItemChange)="tagsOnItemChange($event)">
</app-external-item-listing>
@ -204,7 +205,8 @@
<div class="navigation-buttons-container">
<button matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' | translate}}</button>
<button matStepperNext mat-raised-button color="primary" style="float:right;" (click)="getDefinition()">{{'DATASET-WIZARD.ACTIONS.NEXT' | translate}}</button>
<button matStepperNext mat-raised-button color="primary" style="float:right;" (click)="getDefinition()">{{'DATASET-WIZARD.ACTIONS.NEXT'
| translate}}</button>
</div>
</form>
</mat-step>
@ -213,7 +215,8 @@
<dynamic-form class="full-width" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition" [form]="this.formGroup.get('datasetProfileDefinition')"
[dataModel]="datasetWizardModel"></dynamic-form>
<div class="navigation-buttons-container">
<button style="margin-top:10px;" matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' | translate}}</button>
<button style="margin-top:10px;" matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK'
| translate}}</button>
</div>
</mat-step>
</mat-horizontal-stepper>

View File

@ -46,8 +46,8 @@ import { DataManagementPlanListingModel } from '../../models/data-managemnt-plan
})
export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
breadCrumbs: Observable<BreadcrumbItem[]>;
viewOnly = false;
@ViewChild('stepper') stepper: MatStepper;
//autocomplete Display Functions;
externalDatasetDisplayFunc = (item) => item ? item.label : null;
registriesDisplayFunc = (item) => item ? item.label : null;
@ -100,6 +100,12 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
secondFormGroup: FormGroup;
ngOnInit() {
this.route
.data
.subscribe(v => this.viewOnly = v["public"]);
let dmpRequestItem: RequestItem<DataManagementPlanCriteria> = new RequestItem();
dmpRequestItem.criteria = new DataManagementPlanCriteria();
@ -168,6 +174,7 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
]
}])
this.formGroup = this.datasetWizardModel.buildForm();
if (this.viewOnly) this.formGroup.disable();
this.loadDatasetProfiles();
});
} else if (dmpId != null) {
@ -202,6 +209,8 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
} else {
this.datasetWizardModel = new DatasetWizardModel();
this.formGroup = this.datasetWizardModel.buildForm()
if (this.viewOnly) this.formGroup.disable();
this.formGroup.get('dmp').valueChanges.subscribe(x => {
this.loadDatasetProfiles();
})

View File

@ -16,10 +16,19 @@ export const DatasetRoutes: Routes = [
{
path: "edit/:id",
component: DatasetWizardComponent,
canActivate: [AuthGuard],
data: {
breadcrumb: true,
public: false
},
},
{
path: "publicEdit/:id",
component: DatasetWizardComponent,
//canActivate: [AuthGuard],
data: {
breadcrumb: true
},
public: true
}
},
{
path: "new",

View File

@ -32,6 +32,7 @@ export class DynamicFormComponent implements OnInit {
@Input() path: string;
@Input() form: FormGroup;
id: string;
// @Input() datasetId: string;
pathName: string;
pages: Array<number>;
@ -58,6 +59,7 @@ export class DynamicFormComponent implements OnInit {
ngOnInit() {
let rules: Rule[] = JsonSerializer.fromJSONArray(this.dataModel.datasetProfileDefinition.rules, Rule);
this.visibilityRulesService.formGroup = this.form;
this.visibilityRulesService.buildVisibilityRules(rules)

View File

@ -10,12 +10,14 @@ import { CommonModule } from '@angular/common';
import { SharedModule } from '../shared/shared.module'
import { NgModule } from '@angular/core';
import { NgModule, LOCALE_ID } from '@angular/core';
import { ProjectService } from '../services/project/project.service';
import { ProjectFileUploaderService } from '../services/files/project-file-uploader.service';
import { RouterModule } from '@angular/router';
import { BaseHttpModule } from '../utilities/cite-http-service-module/cite-http.module';
import { MaterialModule } from '../shared/material/material.module';
import { CultureService } from '../utilities/culture/culture-service';
import { MAT_DATE_LOCALE } from '@angular/material';
@NgModule({
imports: [
@ -50,6 +52,17 @@ import { MaterialModule } from '../shared/material/material.module';
ProjectService,
ProjectFileUploaderService,
/* ProjectResolver */
CultureService,
{
provide: MAT_DATE_LOCALE,
deps: [CultureService],
useFactory: (cultureService) => cultureService.getCurrentCulture()
},
{
provide: LOCALE_ID,
deps: [CultureService],
useFactory: (cultureService) => cultureService.getCurrentCulture()
}
]
})

View File

@ -3,7 +3,7 @@
<div class="row">
<div class="col-md-5">
<mat-form-field >
<mat-select placeholder="Sources" [(ngModel)]="choice" (selectionChange)="selectionChange($event)">
<mat-select placeholder="Sources" [(ngModel)]="choice" (selectionChange)="selectionChange($event)" [disabled]="viewOnly">
<mat-option *ngFor="let option of options" [value]="option.key">
{{ option.label }}
</mat-option>

View File

@ -27,6 +27,9 @@ export class ExternalItemListingComponent implements OnInit {
@Input()
public disabled = true;
@Input()
public viewOnly = false;
@Input()
public titleKey: string;

View File

@ -3,7 +3,7 @@ import { FigurecardComponent } from './components/figurecard/figurecard.componen
import { CommonModule } from '@angular/common';
import { FlexLayoutModule } from '@angular/flex-layout';
import { NgModule } from '@angular/core';
import { NgModule, LOCALE_ID } from '@angular/core';
import { RouterModule } from '@angular/router';
import { NavigationComponent } from './components/navigation/navigation.component';
import { SnackBarNotificationComponent } from './components/notificaiton/snack-bar-notification.component';
@ -26,6 +26,8 @@ import { MultipleAutoCompleteComponent } from './components/autocompletes/multip
import { UserDialogComponent } from './components/user-dialog/user-dialog.component';
import { SearchBarComponent } from './components/search-bar/search-bar.component';
import { TimezoneInfoDisplayPipe } from '../utilities/culture/pipes/TimezoneInfoDisplayPipe';
import { CultureService } from '../utilities/culture/culture-service';
import { MAT_DATE_LOCALE } from '@angular/material';
@NgModule({
imports: [
@ -85,7 +87,8 @@ import { TimezoneInfoDisplayPipe } from '../utilities/culture/pipes/TimezoneInfo
],
entryComponents: [
UserDialogComponent
]
],
})
export class SharedModule { }

View File

@ -19,7 +19,7 @@
<i class="fa fa-twitter"></i>
</button>
</div>
<button *ngIf="hasB2AccessOauth()" mat-icon-button (click)="b2AccessLogin()">
<button *ngIf="hasB2AccessOauth()" class="b2access-button" mat-icon-button (click)="b2AccessLogin()">
<span class="iconmedium"></span>
<span></span>
</button>

View File

@ -160,3 +160,8 @@ span.iconmedium {
width: 100px;
height: 56px;
}
.b2access-button{
margin-top: 10px;
width: fit-content;
}

View File

@ -7,7 +7,7 @@
</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-nav-list *ngIf="dmpActivities!=null">
<mat-nav-list *ngIf="dmpActivities != null">
<mat-list-item (click)="redirect(activity.id,RecentActivityTypes.DMP)" *ngFor="let activity of dmpActivities">
<p mat-line>
{{activity.label}}

View File

@ -64,7 +64,7 @@ export class UserProfileComponent implements OnInit {
timezone: new FormControl(result["additionalinfo"]["timezone"]),
culture: new FormControl(result["additionalinfo"]["culture"])
})
this.formGroup.get('language').valueChanges.subscribe(x => { if (x) this.translate.use(x.value) })
//this.formGroup.get('language').valueChanges.subscribe(x => { if (x) this.translate.use(x.value) })
this.formGroup.get('timezone').valueChanges.subscribe(x => { if (x) this.timezones = this._filterTimezone(x) });
this.formGroup.get('culture').valueChanges.subscribe(x => { if (x) this.cultures = this._filterCulture(x) });
this.formGroup.disable()
@ -123,6 +123,8 @@ export class UserProfileComponent implements OnInit {
this.userReferenceService.updateUserSettings(this.formGroup.value).subscribe(
x => {
this.editMode = false;
this.translate.use(this.formGroup.value.language)
this.authService.current().culture = this.formGroup.value.culture.name
this.formGroup.disable();
},
error => {

View File

@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import { CultureInfo } from './models/culture-info';
import { registerLocaleData } from '@angular/common';
import { AuthService } from '../../services/auth/auth.service';
const availableCultures: CultureInfo[] = require('../../../assets/resources/available-cultures.json');
@ -13,6 +14,7 @@ export class CultureService {
private currentCulture: CultureInfo;
constructor(
private authService: AuthService
) {
if (availableCultures) {
this.cultureValues = new Map<string, CultureInfo>();
@ -63,7 +65,7 @@ export class CultureService {
return this.cultureChangeSubject.asObservable();
}
getCurrentCulture(): CultureInfo {
return this.currentCulture;
getCurrentCulture(): String {
return this.authService.current() && this.authService.current().culture ? this.authService.current().culture : this.currentCulture.name;
}
}