Merge branch 'Development'

# Conflicts:
#	dmp-backend/src/main/java/eu/eudat/helpers/Transformers.java
This commit is contained in:
Diamantis Tziotzios 2018-02-12 10:23:41 +02:00
commit 85bdb7fad1
558 changed files with 15676 additions and 36025 deletions

1
.gitignore vendored
View File

@ -18,3 +18,4 @@ dmp-backend/src/main/ui-resources/static/index.html
dmp-backend/src/main/ui-resources/static/favicon.ico
dmp-backend/src/main/ui-resources/static/assets/lang/en.json
dmp-frontend/new 3.xml
dmp-backend/src/main/ui-resources/static/

File diff suppressed because it is too large Load Diff

View File

@ -12,15 +12,17 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^4.2.4",
"@angular/common": "^4.2.4",
"@angular/compiler": "^4.2.4",
"@angular/core": "^4.2.4",
"@angular/forms": "^4.2.4",
"@angular/http": "^4.2.4",
"@angular/platform-browser": "^4.2.4",
"@angular/platform-browser-dynamic": "^4.2.4",
"@angular/router": "^4.2.4",
"@angular/animations": "^5.1.1",
"@angular/cdk": "^5.0.1",
"@angular/common": "5.1.1",
"@angular/compiler": "5.1.1",
"@angular/core": "5.1.1",
"@angular/forms": "5.1.1",
"@angular/http": "5.1.1",
"@angular/material": "^5.0.1",
"@angular/platform-browser": "5.1.1",
"@angular/platform-browser-dynamic": "5.1.1",
"@angular/router": "5.1.1",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.5",
"angular-datatables": "^4.4.0",
"angular2-datatable": "^0.6.0",
@ -31,15 +33,15 @@
"jquery": "^3.2.1",
"ng2-bootstrap-modal": "^1.0.1",
"ng2-simple-global": "^1.2.5",
"ngx-contextmenu": "^1.3.5",
"ngx-webstorage": "^1.8.0",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
"zone.js": "^0.8.14",
"@ngx-translate/core": "^9.0.1",
"@ngx-translate/http-loader": "^2.0.0"
},
"devDependencies": {
"@angular/cli": "1.3.1",
"@angular/compiler-cli": "^4.2.4",
"@angular/language-service": "^4.2.4",
"@angular/cli": "1.6.5",
"@angular/compiler-cli": "^5.1.1",
"@angular/language-service": "^5.1.1",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/jquery": "^3.2.12",
@ -56,6 +58,6 @@
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.3.2",
"typescript": "~2.3.3"
"typescript": "2.4.2"
}
}

View File

@ -42,7 +42,7 @@
<!-- <form-comp></form-comp>-->
<main-window [ngClass]="{false:'invisible'}[tokenService.isLoggedIn() == true]"></main-window>
<app-main-sign-in [ngClass]="{true:'invisible'}[tokenService.isLoggedIn() == true]"></app-main-sign-in>
<!-- <app-main-sign-in [ngClass]="{true:'invisible'}[tokenService.isLoggedIn() == true]"></app-main-sign-in> -->
</div>

View File

@ -0,0 +1,6 @@
export const HostConfiguration = {
Server: 'http://192.168.32.67: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

@ -1,13 +1,15 @@
import { CheckBoxComponent } from './components/checkbox/checkbox-component';
import { FreeTextData } from './models/DataField/FreeTextData';
import { BooleanDecisionComponent } from './components/booleanDecision/booleanDecision-component';
import { FreeTextComponent } from './components/freetext/freetext-component';
import { TextAreaComponent } from './components/textarea/textarea-component';
import { RadioBoxComponent } from './components/radiobox/radiobox-component';
import { WordlistComponent } from './components/wordlist/wordlist-component';
import { AutocompleteComponent } from './components/autocomplete/autocomplete-component';
import { ComboboxComponent } from './components/combobox/combobox-component';
// import { CheckBoxComponent } from './components/checkbox/checkbox-component';
// import { FreeTextData } from './models/DataField/FreeTextData';
// import { BooleanDecisionComponent } from './components/booleanDecision/booleanDecision-component';
// import { FreeTextComponent } from './components/freetext/freetext-component';
// import { TextAreaComponent } from './components/textarea/textarea-component';
// import { RadioBoxComponent } from './components/radiobox/radiobox-component';
// import { WordlistComponent } from './components/wordlist/wordlist-component';
// import { AutocompleteComponent } from './components/autocomplete/autocomplete-component';
// import { ComboboxComponent } from './components/combobox/combobox-component';
//import { MaterialModule } from './shared/material/material.module';
import { AuthService } from './services/auth/auth.service';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule, Routes } from '@angular/router';
@ -18,8 +20,6 @@ import { DataTableModule } from "angular2-datatable";
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { DialogService } from "ng2-bootstrap-modal";
import { ReactiveFormsModule } from '@angular/forms';
import { ContextMenuModule } from 'ngx-contextmenu';
import { Ng2Webstorage } from 'ngx-webstorage';
import { RestBase } from './services/rest-base';
import { TokenService } from './services/login/token.service';
@ -51,7 +51,6 @@ import { DatarepoTableFilterPipe } from './pipes/datarepo-table-filter.pipe';
import { GooggleSignInComponent } from './login/googgle-sign-in/googgle-sign-in.component';
import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component';
import { ProjectEditorComponent } from './managers/project-editor/project-editor.component';
import { DatasetsViewerComponent } from './datasets-viewer/datasets-viewer.component';
import { AppComponent } from './app.component';
import { FormsModule } from '@angular/forms';
@ -59,25 +58,22 @@ import { ProfileEditorComponent } from './bootstrap/profile-editor/profile-edito
import { PropertiesEditorComponent } from './bootstrap/properties-editor/properties-editor.component';
import { NewDatasetComponent } from './bootstrap/new-dataset/new-dataset.component';
import { ConfirmationComponent } from './bootstrap/confirmation/confirmation.component';
import { DmpEditorComponent } from './managers/dmp-editor/dmp-editor.component';
import { MainWindowComponent } from './main-window/main-window.component';
import { AppRouting } from './routes';
import { DmpProfileEditorComponent } from './managers/dmp-profile-editor/dmp-profile-editor.component';
import { OrganisationEditorComponent } from './managers/organisation-editor/organisation-editor.component';
import { RegistryEditorComponent } from './managers/registry-editor/registry-editor.component';
import { ServiceEditorComponent } from './managers/service-editor/service-editor.component';
import { ResearcherEditorComponent } from './managers/researcher-editor/researcher-editor.component';
import { DatareposEditorComponent } from './managers/datarepos-editor/datarepos-editor.component';
import { DatasetprofileEditorComponent } from './managers/datasetprofile-editor/datasetprofile-editor.component';
import { DatasetProfileGUIEditorComponent } from './dataset-profile-gui-editor/dataset-profile-gui-editor.component';
import { FieldFormComponent } from './dataset-profile-form/field-form/field-form.component';
import { FormComponent } from './dataset-profile-form/form/form.component';
import { GroupFieldFormComponent } from './dataset-profile-form/groupfield-form/groupfield-form.component';
import { RuleFormComponent } from './dataset-profile-form/rule-component/rule.component';
import { SectionFormComponent } from './dataset-profile-form/section-form/section-form.component';
import { PageFormComponent } from './dataset-profile-form/page-form/page-component';
import { CompositeFieldFormComponent } from './dataset-profile-form/compositefield-form/compositefield-form.component';
import { DatasetProfileModule } from './dataset-profile-form/dataset-profile.module';
import { UnauthorizedModule } from './unauthorized/unauthorized.module';
// import { FieldFormComponent } from './dataset-profile-form/field-form/field-form.component';
// import { FormComponent } from './dataset-profile-form/form/form.component';
// import { GroupFieldFormComponent } from './dataset-profile-form/groupfield-form/groupfield-form.component';
// import { RuleFormComponent } from './dataset-profile-form/rule-component/rule.component';
// import { SectionFormComponent } from './dataset-profile-form/section-form/section-form.component';
// import { PageFormComponent } from './dataset-profile-form/page-form/page-component';
// import { CompositeFieldFormComponent } from './dataset-profile-form/compositefield-form/compositefield-form.component';
@ -97,38 +93,31 @@ import { CompositeFieldFormComponent } from './dataset-profile-form/compositefie
AppComponent,
GooggleSignInComponent,
FieldFormComponent,
FormComponent,
GroupFieldFormComponent,
RuleFormComponent,
SectionFormComponent,
PageFormComponent,
CompositeFieldFormComponent,
ComboboxComponent,
AutocompleteComponent,
WordlistComponent,
RadioBoxComponent,
// FieldFormComponent,
// FormComponent,
// GroupFieldFormComponent,
// RuleFormComponent,
// SectionFormComponent,
// PageFormComponent,
// CompositeFieldFormComponent,
// ComboboxComponent,
// AutocompleteComponent,
// WordlistComponent,
// RadioBoxComponent,
DatasetsViewerComponent,
ProfileEditorComponent,
PropertiesEditorComponent,
NewDatasetComponent,
ConfirmationComponent,
DmpEditorComponent,
MainWindowComponent,
ProjectEditorComponent,
DmpProfileEditorComponent,
OrganisationEditorComponent,
RegistryEditorComponent,
ServiceEditorComponent,
MainSignInComponent,
ResearcherEditorComponent,
DatareposEditorComponent,
DatasetprofileEditorComponent,
DatasetProfileGUIEditorComponent,
TextAreaComponent,
CheckBoxComponent,
BooleanDecisionComponent,
FreeTextComponent
// TextAreaComponent,
// CheckBoxComponent,
// BooleanDecisionComponent,
// FreeTextComponent
],
imports: [
BrowserModule,
@ -137,12 +126,11 @@ import { CompositeFieldFormComponent } from './dataset-profile-form/compositefie
DataTableModule,
FormsModule,
ReactiveFormsModule,
ContextMenuModule,
Ng2Webstorage,
NgbModule.forRoot(),
AppRouting
],
providers: [{
providers: [AuthService,
{
provide: HTTP_INTERCEPTORS,
useClass: GlobalInterceptor,
multi: true,

View File

@ -13,7 +13,7 @@ export class ComboboxComponent implements OnInit{
options = [{id:"autocomplete", value: "autocomplete"}, {id:"wordlist", value: "wordlist"}];
ngOnInit(){
if (this.dataModel.data){
if (this.dataModel.data && this.form.get("data")){
this.type = this.form.get("data").get("type").value;
}

View File

@ -1,9 +1,10 @@
<div [formGroup]="form" class="form-row">
<div formGroupName="data">
<div class="form-group col-md-12">
<label>Label</label>
<input type="string" class="form-control" formControlName="label">
</div>
<div formGroupName="data">
<div formArrayName="options">
<div *ngFor="let option of form.get('data').get('options').controls index as i">
<div [formGroupName]="i">

View File

@ -17,9 +17,10 @@ export class RadioBoxComponent implements OnInit{
private options = new Array<ListingItem>();
ngOnInit(){
if (this.form.get("data")) this.form.removeControl("data");
//if (this.form.get("data")) this.form.removeControl("data");
if (!this.form.get("data"))
this.form.addControl("data", this.data.buildForm());
this.addNewRow();
if(!this.dataModel.data) this.addNewRow();
}
addNewRow(){
@ -27,6 +28,6 @@ export class RadioBoxComponent implements OnInit{
(<FormArray>this.form.get("data").get("options")).push(radioListOptions.buildForm());
this.data.options = [];
this.data.options.push(radioListOptions);
this.dataModel.data = new JsonSerializer<RadioBoxData>().fromJSONObject(this.data,RadioBoxData);
this.dataModel.data = JsonSerializer.fromJSONObject(this.data,RadioBoxData);
}
}

View File

@ -29,6 +29,6 @@ export class WordlistComponent implements OnInit{
(<FormArray>this.form.get("data").get("options")).push(wordListOptions.buildForm());
this.data.options = [];
this.data.options.push(wordListOptions);
this.dataModel.data = new JsonSerializer<WordListData>().fromJSONObject(this.data,WordListData);
this.dataModel.data = JsonSerializer.fromJSONObject(this.data,WordListData);
}
}

View File

@ -0,0 +1,19 @@
import { CommonModule } from '@angular/common';
import { ModuleWithProviders, NgModule } from '@angular/core';
import { MaterialModule } from '../material/material.module';
@NgModule({
imports: [
CommonModule,
MaterialModule,
]
})
export class CoreModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: CoreModule,
providers: [
]
};
}
}

View File

@ -0,0 +1,3 @@
export class Criteria {
public Like: string;
}

View File

@ -0,0 +1,7 @@
import { Criteria } from './Criteria';
import { Principal } from '../../models/login/Principal';
export class UserCriteria extends Criteria {
public Label: String;
public Roles: Principal.AppRole[];
}

View File

@ -0,0 +1,45 @@
import { UserListingModel } from '../../shared/components/criteria/models/errormodel/users/userListingModel';
import 'rxjs/add/operator/map';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { DataTableRequest } from '../../models/data-table/dataTableRequest';
import { DataTableData } from '../../models/data-table/dataTableData';
import { MyHttpService } from 'app/utilities/httpservice/myhttpservice.service';
import { HostConfiguration } from 'app/app.constants';
@Injectable()
export class UserReferenceService {
private actionUrl: string;
private headers: HttpHeaders;
constructor(private http: MyHttpService) {
this.actionUrl = HostConfiguration.Server + 'api/user/';
this.headers = new HttpHeaders();
this.headers = this.headers.set('Content-Type', 'application/json');
this.headers = this.headers.set('Accept', 'application/json');
}
// formatItem(utilities: Utilities, item: ConfigurationModel): ConfigurationModel {
// item.validFrom = new Date(item.validFrom);
// item.validTo = new Date(item.validTo);
// return item
// }
getPaged(dataTableRequest: DataTableRequest): Observable<DataTableData<UserListingModel>> {
return this.http.post<DataTableData<UserListingModel>>(this.actionUrl + 'getPaged', JSON.stringify(dataTableRequest), { headers: this.headers });
}
updateRoles(itemToUpdate: UserListingModel): Observable<UserListingModel> {
return this.http.post<UserListingModel>(this.actionUrl + 'updateRoles', JSON.stringify(itemToUpdate), { headers: this.headers });
}
delete(id: String): Observable<any> {
return this.http.delete<any>(this.actionUrl + id, { headers: this.headers });
}
}

View File

@ -0,0 +1,77 @@
import { NgModule } from "@angular/core";
import { CommonModule } from '@angular/common';
import { FormsModule,ReactiveFormsModule } from '@angular/forms';
import { DatasetProfileRoutes } from "./dataset-profile.router";
import { RouterModule } from "@angular/router";
import { FormComponent } from './form/form.component';
import { GroupFieldFormComponent } from './groupfield-form/groupfield-form.component';
import { RuleFormComponent } from './rule-component/rule.component';
import { SectionFormComponent } from './section-form/section-form.component';
import { PageFormComponent } from './page-form/page-component';
import { CompositeFieldFormComponent } from './compositefield-form/compositefield-form.component';
import { FieldFormComponent } from './field-form/field-form.component';
import { HttpClientModule, HttpClient } from "@angular/common/http";
import { CheckBoxComponent } from '../components/checkbox/checkbox-component';
import { FreeTextData } from '../models/DataField/FreeTextData';
import { BooleanDecisionComponent } from '../components/booleanDecision/booleanDecision-component';
import { FreeTextComponent } from '../components/freetext/freetext-component';
import { TextAreaComponent } from '../components/textarea/textarea-component';
import { RadioBoxComponent } from '../components/radiobox/radiobox-component';
import { WordlistComponent } from '../components/wordlist/wordlist-component';
import { AutocompleteComponent } from '../components/autocomplete/autocomplete-component';
import { ComboboxComponent } from '../components/combobox/combobox-component';
@NgModule({
imports: [
CommonModule,
FormsModule,
HttpClientModule,
ReactiveFormsModule,
RouterModule,
RouterModule.forChild(DatasetProfileRoutes)
],
declarations: [
FormComponent,
GroupFieldFormComponent,
RuleFormComponent,
SectionFormComponent,
PageFormComponent,
CompositeFieldFormComponent,
FieldFormComponent,
TextAreaComponent,
CheckBoxComponent,
BooleanDecisionComponent,
FreeTextComponent,
ComboboxComponent,
AutocompleteComponent,
WordlistComponent,
RadioBoxComponent
],
exports: [
FormComponent,
GroupFieldFormComponent,
RuleFormComponent,
SectionFormComponent,
PageFormComponent,
CompositeFieldFormComponent,
FieldFormComponent,
TextAreaComponent,
CheckBoxComponent,
BooleanDecisionComponent,
FreeTextComponent,
ComboboxComponent,
AutocompleteComponent,
WordlistComponent,
RadioBoxComponent
],
providers:[
]
})
export class DatasetProfileModule { }

View File

@ -0,0 +1,15 @@
import { RouterModule, Routes } from '@angular/router';
import { FormComponent } from 'app/dataset-profile-form/form/form.component';
export const DatasetProfileRoutes: Routes = [
//{ path: "new/:dmpId", component: DatasetWizardComponent, canActivate: [AuthGuard] }
{
path: ':id',
component: FormComponent
},
{
path: '',
component: FormComponent
}
];

View File

@ -9,7 +9,7 @@
<div formGroupName="viewStyle">
<div class="form-group">
<label>View style</label>
<select class="form-control" formControlName="renderStyle">
<select class="form-control" formControlName="renderStyle" (change)= "onchangeCombo($event)">
<option value="textarea">textarea</option>
<option value="booleanDecision">booleanDecision</option>
<option value='combobox'>combobox</option>

View File

@ -48,6 +48,6 @@ export class FieldFormComponent {
}
onchangeCombo() {
debugger;
if (this.form.get("data")) this.form.removeControl("data");
}
}

View File

@ -1,6 +1,6 @@
<div class="container">
<div style="background-color: #f5f5f5;border: 1px solid #e3e3e3;padding: 24px;">
<form novalidate [formGroup]="form" (ngSubmit)="onSubmit()">
<form *ngIf="form" novalidate [formGroup]="form" (ngSubmit)="onSubmit()">
<div class="row">
<div class="form-group col-md-12">
<label>Label</label>

View File

@ -25,28 +25,22 @@ export class FormComponent {
constructor(public restBase: RestBase, private datasetProfileService: DatasetProfileService, private route: ActivatedRoute) {
this.profileID = route.snapshot.params['id'];
}
ngOnInit() {
this.dataModel = new JsonSerializer<DatasetProfileModel>().fromJSONObject(new DatasetProfileModel(), DatasetProfileModel);
this.dataModel = JsonSerializer.fromJSONObject(new DatasetProfileModel(), DatasetProfileModel);
this.form = this.dataModel.buildForm();
if (this.profileID) {
this.datasetProfileService.getDatasetProfileById(this.profileID).subscribe((data) => {
this.dataModel = new JsonSerializer<DatasetProfileModel>().fromJSONObject(data, DatasetProfileModel);
this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModel);
this.form = this.dataModel.buildForm();
});
}
else {
this.addSection();
this.addPage(0);
}
// this.dataModel = new JsonSerializer<DatasetProfileModel>().fromJSONObject(TestModel, DatasetProfileModel);
// this.form = this.dataModel.buildForm();
}
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {

View File

@ -25,35 +25,20 @@ export class SectionFormComponent {
ngOnInit() {
var self = this;
this.form.root.get("pages").valueChanges.subscribe(function (value) {
self.keepPageSelectionValid(value);
});
}
// addGroupField() {
// let fieldGroup: FieldGroup = new FieldGroup();
// if (this.dataModel.fieldGroups)
// this.dataModel.fieldGroups.push(fieldGroup);
// (<FormArray>this.form.get("fieldGroups")).push(fieldGroup.buildForm());
// }
addField() {
let fieldSet: FieldSet = new FieldSet();
let field: Field = new Field();
//let fieldGroup: FieldGroup = new FieldGroup();
fieldSet.fields.push(field);
//fieldGroup.compositeFields.push(fieldSet);
if (this.dataModel.fieldSets)
this.dataModel.fieldSets.push(fieldSet);
(<FormArray>this.form.get("fieldSets")).push(fieldSet.buildForm());
}
// DeleteFieldGroup(index) {
// this.dataModel.fieldGroups.splice(index, 1);
// (<FormArray>this.form.get("fieldGroups")).removeAt(index)
// }
addSectioninSection() {
let section: Section = new Section();
this.dataModel.sections.push(section);
@ -71,9 +56,9 @@ export class SectionFormComponent {
}
keepPageSelectionValid(pagesJson: Array<any>) {
let selectedPage = this.form.get("page").value as number;
let pages: Array<Page> = new JsonSerializer<Page>().fromJSONArray(pagesJson, Page);
if (!isNaN(selectedPage) && pages.find(elem => elem.id === selectedPage) === undefined)
let selectedPage = this.form.get("page").value as String;
let pages: Array<Page> = JsonSerializer.fromJSONArray(pagesJson, Page);
if (pages.find(elem => elem.id === selectedPage) === undefined)
this.form.get("page").reset();
}
}

View File

@ -0,0 +1,17 @@
import { AuthService } from '../services/auth/auth.service';
import { Injectable } from '@angular/core';
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
@Injectable()
export class AuthGuard implements CanActivate {
constructor(private auth: AuthService, private router: Router) { }
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
let url: string = state.url;
if (!this.auth.current()) {
this.router.navigate(['/unauthorized'], { queryParams: { returnUrl: url } });
return false;
}
return true;
}
}

View File

@ -3,7 +3,7 @@
<div class="col-sm-6 col-md-4 col-md-offset-4">
<h1 class="text-center login-title"></h1>
<div class="account-wall">
<img class="profile-img" src="/admin-ui/assets/icons/user-icon.png">
<img class="profile-img" src="assets/icons/user-icon.png">
<form class="form-signin" [formGroup]="nativeLoginForm">
<input type="text" class="form-control" [(ngModel)]="creds.username" formControlName="username" placeholder="Username or Email" required autofocus>
<input type="password" class="form-control" [(ngModel)]="creds.password" formControlName="password" placeholder="Password" required>

View File

@ -5,7 +5,10 @@ import { TokenService, TokenProvider } from '../../services/login/token.service'
import { Router } from '@angular/router';
import '../../../assets/custom.js';
declare function simple_notifier(type: string, title: string, message:string): any;
import { AuthService } from 'app/services/auth/auth.service';
import { Credential } from 'app/models/login/Credential';
import { ActivatedRoute, Params } from '@angular/router';
import { NgZone } from '@angular/core';
@Component({
selector: 'app-main-sign-in',
@ -20,7 +23,8 @@ export class MainSignInComponent implements OnInit {
creds: any = { "username": "", "password": "" };
constructor( private fb: FormBuilder, private nativeLogin : NativeLoginService, private tokenService : TokenService, private router : Router) {
constructor(private fb: FormBuilder, private nativeLogin: NativeLoginService, private tokenService: TokenService,
private router: Router, private authservice: AuthService, public route: ActivatedRoute, private zone: NgZone) {
}
@ -43,19 +47,47 @@ export class MainSignInComponent implements OnInit {
login() {
//login using the credentials
this.nativeLogin.login(this.creds.username, this.creds.password).subscribe(
response => {
// this.nativeLogin.login(this.creds.username, this.creds.password).subscribe(
// response => {
simple_notifier("success",null,"Successful login");
// simple_notifier("success",null,"Successful login");
this.tokenService.login(response['token'], TokenProvider.native, this.creds.username, response['email']);
// this.tokenService.login(response['token'], TokenProvider.native, this.creds.username, response['email']);
},
err => {
simple_notifier("danger",null,"Failed to login");
}
// },
// err => {
// simple_notifier("danger",null,"Failed to login");
// }
// );
let credentials = new Credential();
credentials.username = this.creds.username;
credentials.secret = this.creds.password;
this.authservice.nativeLogin(credentials).subscribe(
res => this.onLogInSuccess(res),
error => this.onLogInError(error)
);
}
public onLogInSuccess(logoutMessage: any) {
// this.snackBar.openFromComponent(SnackBarNotificationComponent, {
// data: { message: 'GENERAL.SNACK-BAR.SUCCESSFUL-LOGIN', language: this.language },
// duration: 3000,
// extraClasses: ['snackbar-success']
// });
this.route.queryParams.subscribe((params: Params) => {
let redirectUrl = params['returnUrl'] ? params['returnUrl'] : '/';
this.zone.run(() => this.router.navigate([redirectUrl]));
})
}
public onLogInError(errorMessage: string) {
// this.snackBar.openFromComponent(SnackBarNotificationComponent, {
// data: { message: 'GENERAL.SNACK-BAR.UNSUCCESSFUL-LOGIN', language: this.language },
// duration: 3000,
// extraClasses: ['snackbar-warning']
// })
}
}

View File

@ -15,57 +15,6 @@
<li [ngClass]="{true:'active'}[currentlySelected=='datasetprofiles']" (click)="setActive('datasetprofiles')" [routerLink]="['/datasetprofiles']" ><a style="cursor:pointer">Dataset Profiles</a></li>
</ul>
<li data-toggle="collapse" data-target="#manage-dmps" class="collapsed">
<a style="cursor:pointer"><i class="fa fa-newspaper-o"></i>Manage DMPs <span class="arrow"></span></a>
</li>
<ul class="sub-menu collapse" id="manage-dmps">
<li [ngClass]="{true:'active'}[currentlySelected=='dmps']" (click)="setActive('dmps')" [routerLink]="['/dmps']">DMP</li>
<li [ngClass]="{true:'active'}[currentlySelected=='dmpprofiles']" (click)="setActive('dmpprofiles')" [routerLink]="['/dmpprofiles']">DMP profiles</li>
</ul>
<li data-toggle="collapse" data-target="#manage-repositories" class="collapsed">
<a style="cursor:pointer"><i class="fa fa-database"></i> Manage Data Repositories <span class="arrow"></span></a>
</li>
<ul class="sub-menu collapse" id="manage-repositories">
<li [ngClass]="{true:'active'}[currentlySelected=='datarepos']" (click)="setActive('datarepos')" [routerLink]="['/datarepos']">Data Repositories</li>
<li>Non-assigned repositories</li>
</ul>
<li data-toggle="collapse" data-target="#manage-projects" class="collapsed">
<a style="cursor:pointer"><i class="fa fa-newspaper-o"></i>Manage Projects <span class="arrow"></span></a>
</li>
<ul class="sub-menu collapse" id="manage-projects">
<li [ngClass]="{true:'active'}[currentlySelected=='projects']" (click)="setActive('projects')" [routerLink]="['/projects']">All Projects</li>
</ul>
<li data-toggle="collapse" data-target="#manage-organisations" class="collapsed">
<a style="cursor:pointer"><i class="fa fa-newspaper-o"></i>Manage Organisations <span class="arrow"></span></a>
</li>
<ul class="sub-menu collapse" id="manage-organisations">
<li [ngClass]="{true:'active'}[currentlySelected=='organisations']" (click)="setActive('organisations')" [routerLink]="['/organisations']">All Organisations</li>
</ul>
<li data-toggle="collapse" data-target="#manage-registries" class="collapsed">
<a style="cursor:pointer"><i class="fa fa-newspaper-o"></i>Manage Registries <span class="arrow"></span></a>
</li>
<ul class="sub-menu collapse" id="manage-registries">
<li [ngClass]="{true:'active'}[currentlySelected=='registries']" (click)="setActive('registries')" [routerLink]="['/registries']">All Registries</li>
</ul>
<li data-toggle="collapse" data-target="#manage-services" class="collapsed">
<a style="cursor:pointer"><i class="fa fa-newspaper-o"></i>Manage Services <span class="arrow"></span></a>
</li>
<ul class="sub-menu collapse" id="manage-services">
<li [ngClass]="{true:'active'}[currentlySelected=='services']" (click)="setActive('services')" [routerLink]="['/services']">All services</li>
</ul>
<li data-toggle="collapse" data-target="#manage-researchers" class="collapsed">
<a style="cursor:pointer"><i class="fa fa-newspaper-o"></i>Manage Researchers <span class="arrow"></span></a>
</li>
<ul class="sub-menu collapse" id="manage-researchers">
<li [ngClass]="{true:'active'}[currentlySelected=='researchers']" (click)="setActive('researchers')" [routerLink]="['/researchers']">All researchers</li>
</ul>
<li data-toggle="collapse" data-target="#manage-users" class="collapsed">
<a style="cursor:pointer"><i class="fa fa-newspaper-o"></i> Users <span class="arrow"></span></a>
</li>

View File

@ -1,33 +0,0 @@
.invisible {
display:none;
}
.visible {
display:block;
}
tr.hover:hover > * {
background-color: #eeeeee;
}
.editor-container{
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
}
.button-150px {
max-width: 150px;
}
.ng-template{
text-align: right;
}
.grayout-empty-table {
opacity: 0.6; /* Real browsers */
filter: alpha(opacity = 60); /* MSIE */
text-align: center;
vertical-align: middle;
}

View File

@ -1,122 +0,0 @@
<div class="editor-container container">
<div [ngClass]="{true:'visible', false:'invisible'}[tableVisible]">
<table class="table table-striped" [mfData]="tableData | datarepoTableFilter : filterQuery" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
<thead>
<tr>
<th colspan="1">
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Filter'/>
</th>
<th>
<button class="btn btn-default" (click)="refreshTable($event)">
<span class="glyphicon glyphicon-refresh"></span>
</button>
</th>
</tr>
<tr>
<th [ngClass]="{true:'visible', false:'invisible'}[showIDs]"><mfDefaultSorter by="id">ID</mfDefaultSorter></th>
<th><mfDefaultSorter by="label">Label</mfDefaultSorter></th>
<th><mfDefaultSorter by="abbreviation">Abbreviation</mfDefaultSorter></th>
<th><mfDefaultSorter by="reference">Reference</mfDefaultSorter></th>
<th><mfDefaultSorter by="uri">Uri</mfDefaultSorter></th>
<th><mfDefaultSorter by="definition">Definition</mfDefaultSorter></th>
</tr>
</thead>
<tbody>
<tr class="grayout-empty-table" *ngIf="!mf.data[0]" [contextMenu]="basicMenu" [contextMenuSubject]="datarepo"> <td colspan="5">No elements</td></tr>
<tr *ngFor="let datarepo of mf.data" class="hover" [contextMenu]="basicMenu" [contextMenuSubject]="datarepo">
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{datarepo.id}}</td>
<td>{{datarepo?.label}}</td>
<td>{{datarepo?.abbreviation}}</td>
<td>{{datarepo?.reference}}</td>
<td>{{datarepo?.uri}}</td>
<td>{{datarepo?.definition}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="5">
<mfBootstrapPaginator [rowsOnPageSet]="[10,20,40]"></mfBootstrapPaginator>
</td>
</tr>
</tfoot>
</table>
</div>
<!-- this is the dmp editor -->
<div [ngClass]="{true:'visible', false:'invisible'}[editorVisible]">
<div> <!-- form container -->
<div style="display:block;">
<button (click)="switchToTable()" class="btn btn-lg btn-success pull-right" style="max-width:120px;">
<span class="glyphicon glyphicon-arrow-left"></span> Go back
</button>
</div>
<form [formGroup]="datarepoEditorForm" novalidate style="display:block;">
<div class="form-group" [ngClass]="{null:'invisible'}[editingDatarepo?.id]">
<label class="center-block">ID: {{editingDatarepo?.id}}
<input class="form-control invisible" formControlName="id" [ngModel]="editingDatarepo?.id">
</label>
</div>
<div class="form-group">
<label class="center-block">Label:
<input class="form-control" formControlName="label" [ngModel]="editingDatarepo?.label" (ngModelChange)="editingDatarepo.label=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Abbreviation:
<input class="form-control" formControlName="abbreviation" [ngModel]="editingDatarepo?.abbreviation" (ngModelChange)="editingDatarepo.abbreviation=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Reference:
<input class="form-control" formControlName="reference" [ngModel]="editingDatarepo?.reference" (ngModelChange)="editingDatarepo.reference$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Uri:
<input class="form-control" formControlName="uri" [ngModel]="editingDatarepo?.uri" (ngModelChange)="editingDatarepo.uri$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Definition:
<input class="form-control" formControlName="definition" [ngModel]="editingDatarepo?.definition" (ngModelChange)="editingDatarepo.definition$event">
</label>
</div>
<div class="form-group" style="width:540px;">
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
</div>
</form>
<!--
<p>Form value: {{ datarepoEditorForm.value | json }}</p>
-->
</div>
</div>
</div>
<context-menu>
<ng-template contextMenuItem [subMenu]="manage">
<span></span>Manage data repositories
</ng-template>
<context-menu #manage>
<ng-template contextMenuItem (execute)="newDatarepo($event?.item)">
<span class="glyphicon glyphicon-plus"></span>Create data repository
</ng-template>
<ng-template contextMenuItem (execute)="editDatarepo($event?.item?.id)">
<span class="glyphicon glyphicon-pencil"></span>Edit this data repository
</ng-template>
<ng-template contextMenuItem (execute)="delete($event?.item?.id)">
<span class="glyphicon glyphicon-trash red"></span> Delete this
</ng-template>
</context-menu>
<ng-template contextMenuItem>
<span></span>Show full tree connections
</ng-template>
</context-menu>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DatareposEditorComponent } from './datarepos-editor.component';
describe('DatareposEditorComponent', () => {
let component: DatareposEditorComponent;
let fixture: ComponentFixture<DatareposEditorComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DatareposEditorComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DatareposEditorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,137 +0,0 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { DatarepoService } from '../../services/datarepo-service';
import { ContextMenuComponent } from 'ngx-contextmenu';
import { ReactiveFormsModule } from '@angular/forms';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import '../../../assets/custom.js';
declare function simple_notifier(type: string, title: string, message:string): any;
@Component({
selector: 'app-datarepos-editor',
templateUrl: './datarepos-editor.component.html',
styleUrls: ['./datarepos-editor.component.css']
})
export class DatareposEditorComponent implements OnInit {
constructor(private datarepoService : DatarepoService, private fb: FormBuilder) {
}
//whole dmp data model
tableData : any[] = new Array();
//datarepos editor data model
editingDatarepo: any = {};
datarepoEditorForm : any;
//required by the table
public filterQuery = "";
public rowsOnPage = 10;
//public sortBy = "email";
public sortOrder = "asc";
//visibility rules for containers
tableVisible: boolean = true;
editorVisible: boolean = false;
// for tableIds
showIDs : boolean = false;
ngOnInit() {
this.getAllDatarepos(false);
this.createDatareposEditorForm();
}
createDatareposEditorForm(){
this.datarepoEditorForm = this.fb.group({
id: null,
label: ['', Validators.required ],
abbreviation: '',
reference: '',
uri: '',
definition: ''
});
}
switchToTable(){
this.tableVisible = true;
this.editorVisible = false;
}
switchToEditor(datarepoID){
this.tableVisible = false;
this.editorVisible = true;
if(datarepoID == null){
this.editingDatarepo = {id: null, label: "", abbreviation: "", reference: "", uri: "", definition: "" };
}
else{
this.editingDatarepo = this.tableData.filter((datarepo) => datarepo.id === datarepoID)[0];
}
}
getAllDatarepos(showNotification : boolean){
this.datarepoService.getAllDatarepos().subscribe( (data) => {
this.tableData = data;
if(showNotification)
simple_notifier("info",null,"Refreshed the table");
});
}
editDatarepo(datarepo){
this.switchToEditor(datarepo);
}
newDatarepo(){
this.switchToEditor(null);
}
save(mouseEvent){
this.datarepoService.create(this.datarepoEditorForm.value).subscribe(
response => {
simple_notifier("success",null,"Saved data repository");
this.getAllDatarepos(false);
this.switchToTable();
},
err => {
simple_notifier("danger",null,"Could not save data repository");
}
);
}
delete(datarepo){
this.datarepoService.delete(datarepo).subscribe(
(response) => {
simple_notifier("success",null,"Deleted data repository");
this.getAllDatarepos(false);
this.switchToTable();
},
(err) => {
simple_notifier("danger",null,"Could not delete data repository");
}
)
}
refreshTable($event){
this.getAllDatarepos(true);
}
@ViewChild(ContextMenuComponent) public basicMenu: ContextMenuComponent;
}

View File

@ -0,0 +1,64 @@
<div class="container-fluid">
<h3>{{titlePrefix}} {{'DATASET-LISTING.TITLE' | translate}}</h3>
<app-datasets-criteria-component></app-datasets-criteria-component>
<mat-card class="mat-card">
<mat-card-header>
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
</mat-card-header>
<mat-table [dataSource]="dataSource" matSort>
<!-- Column Definition: Name -->
<ng-container cdkColumnDef="label">
<mat-header-cell *matHeaderCellDef>Label</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
</ng-container>
<!-- Column Definition: Status -->
<ng-container cdkColumnDef="status">
<mat-header-cell *matHeaderCellDef>Status</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.status}}
</mat-cell>
</ng-container>
<!-- Column Definition: Description -->
<ng-container cdkColumnDef="description">
<mat-header-cell *matHeaderCellDef>Description</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.description}} </mat-cell>
</ng-container>
<!-- Column Definition: Created -->
<ng-container cdkColumnDef="created">
<mat-header-cell *matHeaderCellDef>Created}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell>
</ng-container>
<!-- 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-menu #actionsMenu="matMenu">
<button *ngIf="row.status==0" mat-menu-item (click)="rowClick(row.id)"><mat-icon>mode_edit</mat-icon>{{'DATASET-LISTING.ACTIONS.EDIT' | translate}}</button>
<button *ngIf="row.status==1" mat-menu-item (click)="rowClick(row.id)"><mat-icon>visibility</mat-icon>{{'DATASET-LISTING.ACTIONS.VIEW' | translate}}</button>
<button *ngIf="row.status==1" 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"></mat-row>
<!-- (click)="rowClick(row.id)" -->
</mat-table>
<mat-paginator #paginator [length]="dataSource?.totalCount" [pageSizeOptions]="[10, 25, 100]">
</mat-paginator>
</mat-card>
<button *ngIf="dmpId" mat-fab class="mat-fab-bottom-right" color="primary" [routerLink]="['/datasets/new/'+dmpId] ">
<mat-icon class="mat-24">add</mat-icon>
</button>
</div>

View File

@ -0,0 +1,146 @@
// import { Component, ViewChild, OnInit, AfterViewInit } from "@angular/core";
// //import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
// import { Router, Params, ActivatedRoute } from "@angular/router";
// import { Observable } from "rxjs/Observable";
// @Component({
// selector: 'app-dataset-listing-component',
// templateUrl: 'dataset-listing.component.html',
// styleUrls: ['./dataset-listing.component.scss'],
// providers: [DatasetService, DataManagementPlanService]
// })
// export class DatasetListingComponent implements OnInit {
// @ViewChild(MatPaginator) _paginator: MatPaginator;
// @ViewChild(MatSort) sort: MatSort;
// @ViewChild(DatasetCriteriaComponent) criteria: DatasetCriteriaComponent;
// dataSource: DatasetDataSource | null;
// displayedColumns: String[] = ['label', 'dmp', 'profile', 'dataRepositories', 'registries', 'services', 'description', 'created', 'actions'];
// pageEvent: PageEvent;
// titlePrefix: String;
// dmpId: String;
// statuses = [
// { value: '0', viewValue: 'Active' },
// { value: '1', viewValue: 'Inactive' }
// ];
// constructor(
// private datasetService: DatasetService,
// private router: Router,
// private languageService: TranslateService,
// public snackBar: MatSnackBar,
// public route: ActivatedRoute,
// public dataManagementPlanService: DataManagementPlanService
// ) {
// }
// ngOnInit() {
// this.route.params.subscribe((params: Params) => {
// this.dmpId = params['dmpId'];
// if(this.dmpId != null) this.setDmpTitle(this.dmpId);
// this.criteria.setCriteria(this.getDefaultCriteria(this.dmpId));
// this.refresh();
// this.criteria.setRefreshCallback(() => this.refresh());
// });
// }
// setDmpTitle(dmpId: String) {
// this.dataManagementPlanService.getSingle(dmpId).map(data => data as DataManagementPlanModel)
// .subscribe(data => {
// this.titlePrefix = data.label;
// });
// }
// refresh() {
// this.dataSource = new DatasetDataSource(this.datasetService, this._paginator, this.sort, this.languageService, this.snackBar, this.criteria);
// }
// rowClick(rowId: String) {
// this.router.navigate(['/datasets/edit/' + rowId]);
// }
// getDefaultCriteria(dmpId: String): DatasetCriteria {
// const defaultCriteria = new DatasetCriteria();
// if (dmpId != null) {
// defaultCriteria.dmpIds.push(dmpId);
// }
// return defaultCriteria;
// }
// makeItPublic(id:String){debugger;
// this.datasetService.makeDatasetPublic(id).subscribe();
// }
// }
// export class DatasetDataSource extends DataSource<DatasetListingModel> {
// totalCount = 0;
// isLoadingResults = false;
// constructor(
// private _service: DatasetService,
// private _paginator: MatPaginator,
// private _sort: MatSort,
// private _languageService: TranslateService,
// private _snackBar: MatSnackBar,
// private _criteria: DatasetCriteriaComponent
// ) {
// super();
// }
// connect(): Observable<DatasetListingModel[]> {
// const displayDataChanges = [
// this._paginator.page
// //this._sort.matSortChange
// ];
// return Observable.merge(...displayDataChanges)
// .startWith(null)
// .switchMap(() => {
// setTimeout(() => {
// this.isLoadingResults = true;
// });
// const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
// const request = new DataTableRequest<DatasetCriteria>(startIndex, this._paginator.pageSize);
// request.criteria = this._criteria.criteria;
// return this._service.getPaged(request);
// })
// /*.catch((error: any) => {
// this._snackBar.openFromComponent(SnackBarNotificationComponent, {
// data: { message: 'GENERAL.SNACK-BAR.FORMS-BAD-REQUEST', language: this._languageService },
// duration: 3000,
// extraClasses: ['snackbar-warning']
// });
// //this._criteria.criteria.onCallbackError(error);
// return Observable.of(null);
// })*/
// .map(result => {
// setTimeout(() => {
// this.isLoadingResults = false;
// });
// return result;
// })
// .map(result => {
// if (!result) { return []; }
// if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; }
// return result.data;
// });
// }
// disconnect() {
// // No-op
// }
// }

View File

@ -1,6 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { DatasetProfileService } from '../../services/dataset-profile.service';
import { ContextMenuComponent } from 'ngx-contextmenu';
import { ReactiveFormsModule } from '@angular/forms';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@ -130,6 +129,4 @@ export class DatasetprofileEditorComponent implements OnInit {
}
@ViewChild(ContextMenuComponent) public basicMenu: ContextMenuComponent;
}

View File

@ -1,33 +0,0 @@
.invisible {
display:none;
}
.visible {
display:block;
}
tr.hover:hover > * {
background-color: #eeeeee;
}
.editor-container{
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
}
.button-150px {
max-width: 150px;
}
.ng-template{
text-align: right;
}
.grayout-empty-table {
opacity: 0.6; /* Real browsers */
filter: alpha(opacity = 60); /* MSIE */
text-align: center;
vertical-align: middle;
}

View File

@ -1,134 +0,0 @@
<div class="editor-container container">
<div [ngClass]="{true:'visible', false:'invisible'}[dmpTableVisible]">
<table class="table table-striped" [mfData]="tableData | dmpTableFilter : filterQuery" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
<thead>
<tr>
<th colspan="1">
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Filter'/>
</th>
<th>
<button class="btn btn-default" (click)="refreshTable($event)">
<span class="glyphicon glyphicon-refresh"></span>
</button>
</th>
</tr>
<tr>
<th [ngClass]="{true:'visible', false:'invisible'}[showIDs]"><mfDefaultSorter by="id">ID</mfDefaultSorter></th>
<th [ngClass]="{true:'visible', false:'invisible'}[showIDs]"><mfDefaultSorter by="previous">Previous</mfDefaultSorter></th>
<th><mfDefaultSorter by="label">Label</mfDefaultSorter></th>
<th><mfDefaultSorter by="version">Version</mfDefaultSorter></th>
<th><mfDefaultSorter by="project.label">Project</mfDefaultSorter></th>
<th>ProfileData</th>
<th>Profile</th>
</tr>
</thead>
<tbody>
<tr class="grayout-empty-table" *ngIf="!mf.data[0]" [contextMenu]="basicMenu" [contextMenuSubject]="dmp"> <td colspan="5">No elements</td></tr>
<tr *ngFor="let dmp of mf.data" class="hover" [contextMenu]="basicMenu" [contextMenuSubject]="dmp">
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{dmp.id}}</td>
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{dmp.previous}}</td>
<td>{{dmp?.label}}</td>
<td>{{dmp?.version}}</td>
<td>{{dmp?.project?.label}}</td>
<td>{{dmp?.profileData}}</td>
<td>{{dmp?.profile?.label}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="5">
<mfBootstrapPaginator [rowsOnPageSet]="[10,20,40]"></mfBootstrapPaginator>
</td>
</tr>
</tfoot>
</table>
</div>
<!-- this is the dmp editor -->
<div [ngClass]="{true:'visible', false:'invisible'}[dmpEditorVisible]">
<div> <!-- form container -->
<div style="display:block;">
<button (click)="switchToTable()" class="btn btn-lg btn-success pull-right" style="max-width:120px;">
<span class="glyphicon glyphicon-arrow-left"></span> Go back
</button>
</div>
<form [formGroup]="dmpEditorForm" novalidate style="display:block;">
<div class="form-group" [ngClass]="{null:'invisible'}[editingDmp?.id]">
<label class="center-block">ID: {{editingDmp?.id}}
<input class="form-control invisible" formControlName="id" [ngModel]="editingDmp?.id">
</label>
</div>
<div class="form-group">
<label class="center-block">Previous:
<select class="form-control" name="previous" formControlName="previous" [ngModel]="editingDmp?.previous" (ngModelChange)="setFormPreviousValue($event)">
<option *ngFor="let idLabel of dmpsLabelsIDs" value="{{idLabel.id}}" >{{idLabel.label}}</option>
</select>
</label>
</div>
<div class="form-group">
<label class="center-block">Label:
<input class="form-control" formControlName="label" [ngModel]="editingDmp?.label" (ngModelChange)="editingDmp.label=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Version:
<input class="form-control" type="number" min="1" max="10000" formControlName="version" [ngModel]="editingDmp?.version" (ngModelChange)="editingDmp.version=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Project:
<select class="form-control" name="project" formControlName="project" [ngModel]="editingDmp?.project?.id" (ngModelChange)="setFormProjectValue($event)">
<option *ngFor="let idLabel of projectLabelsIDs" [ngValue]="idLabel.id">{{idLabel.label}}</option>
</select>
</label>
</div>
<div class="form-group">
<label class="center-block">ProfileData:
<input class="form-control" formControlName="profileData" [ngModel]="editingDmp?.profileData" (ngModelChange)="editingDmp.profileData=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Profile:
<select class="form-control" name="profile" formControlName="profile" [ngModel]="editingDmp?.profile?.id" (ngModelChange)="setFormProfileValue($event)">
<option *ngFor="let idLabel of profileLabelsIDs" [ngValue]="idLabel.id">{{idLabel.label}}</option>
</select>
</label>
</div>
<div class="form-group" style="width:540px;">
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
</div>
</form>
<!--
<p>Form value: {{ dmpEditorForm.value | json }}</p>
-->
</div>
</div>
</div>
<context-menu>
<ng-template contextMenuItem [subMenu]="managedmp">
<span></span>Manage DMPs
</ng-template>
<context-menu #managedmp>
<ng-template contextMenuItem (execute)="newDmp($event?.item)">
<span class="glyphicon glyphicon-plus"></span>Create DMP
</ng-template>
<ng-template contextMenuItem (execute)="editDmp($event?.item?.id)">
<span class="glyphicon glyphicon-pencil"></span>Edit this DMP
</ng-template>
<ng-template contextMenuItem (execute)="delete($event?.item?.id)">
<span class="glyphicon glyphicon-trash red"></span> Delete this
</ng-template>
</context-menu>
<ng-template contextMenuItem>
<span></span>Show full tree connections
</ng-template>
</context-menu>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DmpEditorComponent } from './dmp-editor.component';
describe('DmpEditorComponent', () => {
let component: DmpEditorComponent;
let fixture: ComponentFixture<DmpEditorComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DmpEditorComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DmpEditorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,160 +0,0 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { DmpsServiceService } from '../../services/dmps-service.service';
import { ProjectService } from '../../services/project-service';
import { DmpProfileService } from '../../services/dmpprofile-service';
import { ContextMenuComponent } from 'ngx-contextmenu';
import { ReactiveFormsModule } from '@angular/forms';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import '../../../assets/custom.js';
declare function simple_notifier(type: string, title: string, message:string): any;
@Component({
selector: 'app-dmp-editor',
templateUrl: './dmp-editor.component.html',
styleUrls: ['./dmp-editor.component.css']
})
export class DmpEditorComponent implements OnInit {
constructor(private dmpsServiceService : DmpsServiceService, private projectService : ProjectService, private dmpProfileService: DmpProfileService, private fb: FormBuilder) {
}
//whole dmp data model
tableData : any[] = new Array();
//dmp editor data model
editingDmp: any = {};
dmpEditorForm : any;
//required by the table
public filterQuery = "";
public rowsOnPage = 10;
//public sortBy = "email";
public sortOrder = "asc";
//visibility rules for containers
dmpTableVisible: boolean = true;
dmpEditorVisible: boolean = false;
dmpsLabelsIDs: any = new Array();
projectLabelsIDs: any = new Array();
profileLabelsIDs: any = new Array();
// for tableIds
showIDs : boolean = false;
ngOnInit() {
this.getAllDmps(false);
this.createDmpEditorForm();
}
createDmpEditorForm(){
this.dmpEditorForm = this.fb.group({
id: null,
previous: null,
label: ['', Validators.required ],
version: '',
project: '',
profileData: '',
profile: ''
});
}
switchToTable(){
this.dmpTableVisible = true;
this.dmpEditorVisible = false;
}
switchToEditor(dmpID){
this.dmpTableVisible = false;
this.dmpEditorVisible = true;
if(dmpID == null){
this.editingDmp = {id: null, previous: "", label: "", version: "", project: "", profileData: "", profile: "" };
}
else{
this.editingDmp = this.tableData.filter((dmp) => dmp.id === dmpID)[0];
}
this.projectService.getProjectIdsLabels().subscribe((data) => this.projectLabelsIDs = data);
this.dmpProfileService.getDmpProfileIdsLabels().subscribe( (data) => this.profileLabelsIDs = data);
this.dmpsServiceService.getDmpIdsLabels().subscribe ( (data) => this.dmpsLabelsIDs = data);
}
getAllDmps(showNotification : boolean){
this.dmpsServiceService.getAllDmps().subscribe( (data) => {
this.tableData = data;
if(showNotification)
simple_notifier("info",null,"Refreshed the table");
});
}
editDmp(dmp){
this.switchToEditor(dmp);
}
newDmp(){
this.switchToEditor(null);
}
//for setting option selection of form (because it's not supported by angular native functions) (see https://github.com/angular/angular/issues/6573)
setFormPreviousValue($event){
if($event != null && $event.target != null)
this.editingDmp.previous = $event.target.value;
}
setFormProjectValue($event){
if($event != null && $event.target != null)
this.editingDmp.project = $event.target.value;
}
setFormProfileValue($event){
if($event != null && $event.target != null)
this.editingDmp.profile = $event.target.value;
}
save(mouseEvent){
this.dmpsServiceService.create(this.dmpEditorForm.value).subscribe(
response => {
simple_notifier("success",null,"Saved dmp");
this.getAllDmps(false);
this.switchToTable();
},
err => {
simple_notifier("danger",null,"Could not save dmp");
}
);
}
delete(dmp){
console.log(dmp);
this.dmpsServiceService.delete(dmp).subscribe(
(response) => {
simple_notifier("success",null,"Deleted dataset");
this.getAllDmps(false);
this.switchToTable();
},
(err) => {
simple_notifier("danger",null,"Could not delete dmp");
}
)
}
refreshTable($event){
this.getAllDmps(true);
}
@ViewChild(ContextMenuComponent) public basicMenu: ContextMenuComponent;
}

View File

@ -1,6 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { DmpProfileService } from '../../services/dmpprofile-service';
import { ContextMenuComponent } from 'ngx-contextmenu';
import { ReactiveFormsModule } from '@angular/forms';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@ -128,9 +127,6 @@ export class DmpProfileEditorComponent implements OnInit {
}
@ViewChild(ContextMenuComponent) public basicMenu: ContextMenuComponent;
}

View File

@ -1,33 +0,0 @@
.invisible {
display:none;
}
.visible {
display:block;
}
tr.hover:hover > * {
background-color: #eeeeee;
}
.editor-container{
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
}
.button-150px {
max-width: 150px;
}
.ng-template{
text-align: right;
}
.grayout-empty-table {
opacity: 0.6; /* Real browsers */
filter: alpha(opacity = 60); /* MSIE */
text-align: center;
vertical-align: middle;
}

View File

@ -1,122 +0,0 @@
<div class="editor-container container">
<div [ngClass]="{true:'visible', false:'invisible'}[tableVisible]">
<table class="table table-striped" [mfData]="tableData | organisationTableFilter : filterQuery" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
<thead>
<tr>
<th colspan="1">
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Filter'/>
</th>
<th>
<button class="btn btn-default" (click)="refreshTable($event)">
<span class="glyphicon glyphicon-refresh"></span>
</button>
</th>
</tr>
<tr>
<th [ngClass]="{true:'visible', false:'invisible'}[showIDs]"><mfDefaultSorter by="id">ID</mfDefaultSorter></th>
<th><mfDefaultSorter by="label">Label</mfDefaultSorter></th>
<th><mfDefaultSorter by="abbreviation">Abbreviation</mfDefaultSorter></th>
<th><mfDefaultSorter by="reference">Reference</mfDefaultSorter></th>
<th><mfDefaultSorter by="uri">Uri</mfDefaultSorter></th>
<th><mfDefaultSorter by="definition">Definition</mfDefaultSorter></th>
</tr>
</thead>
<tbody>
<tr class="grayout-empty-table" *ngIf="!mf.data[0]" [contextMenu]="basicMenu" [contextMenuSubject]="organisation"> <td colspan="5">No elements</td></tr>
<tr *ngFor="let organisation of mf.data" class="hover" [contextMenu]="basicMenu" [contextMenuSubject]="organisation">
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{organisation.id}}</td>
<td>{{organisation?.label}}</td>
<td>{{organisation?.abbreviation}}</td>
<td>{{organisation?.reference}}</td>
<td>{{organisation?.uri}}</td>
<td>{{organisation?.definition}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="5">
<mfBootstrapPaginator [rowsOnPageSet]="[10,20,40]"></mfBootstrapPaginator>
</td>
</tr>
</tfoot>
</table>
</div>
<!-- this is the dmp editor -->
<div [ngClass]="{true:'visible', false:'invisible'}[editorVisible]">
<div> <!-- form container -->
<div style="display:block;">
<button (click)="switchToTable()" class="btn btn-lg btn-success pull-right" style="max-width:120px;">
<span class="glyphicon glyphicon-arrow-left"></span> Go back
</button>
</div>
<form [formGroup]="organisationEditorForm" novalidate style="display:block;">
<div class="form-group" [ngClass]="{null:'invisible'}[editingOrganisation?.id]">
<label class="center-block">ID: {{editingOrganisation?.id}}
<input class="form-control invisible" formControlName="id" [ngModel]="editingOrganisation?.id">
</label>
</div>
<div class="form-group">
<label class="center-block">Label:
<input class="form-control" formControlName="label" [ngModel]="editingOrganisation?.label" (ngModelChange)="editingOrganisation.label=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Abbreviation:
<input class="form-control" formControlName="abbreviation" [ngModel]="editingOrganisation?.abbreviation" (ngModelChange)="editingOrganisation.abbreviation=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Reference:
<input class="form-control" formControlName="reference" [ngModel]="editingOrganisation?.reference" (ngModelChange)="editingOrganisation.reference$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Uri:
<input class="form-control" formControlName="uri" [ngModel]="editingOrganisation?.uri" (ngModelChange)="editingOrganisation.uri$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Definition:
<input class="form-control" formControlName="definition" [ngModel]="editingOrganisation?.definition" (ngModelChange)="editingOrganisation.definition$event">
</label>
</div>
<div class="form-group" style="width:540px;">
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
</div>
</form>
<!--
<p>Form value: {{ organisationEditorForm.value | json }}</p>
-->
</div>
</div>
</div>
<context-menu>
<ng-template contextMenuItem [subMenu]="manage">
<span></span>Manage organisations
</ng-template>
<context-menu #manage>
<ng-template contextMenuItem (execute)="newOrganisation($event?.item)">
<span class="glyphicon glyphicon-plus"></span>Create organisation
</ng-template>
<ng-template contextMenuItem (execute)="editOrganisation($event?.item?.id)">
<span class="glyphicon glyphicon-pencil"></span>Edit this organisation
</ng-template>
<ng-template contextMenuItem (execute)="delete($event?.item?.id)">
<span class="glyphicon glyphicon-trash red"></span> Delete this
</ng-template>
</context-menu>
<ng-template contextMenuItem>
<span></span>Show full tree connections
</ng-template>
</context-menu>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { OrganisationEditorComponent } from './organisation-editor.component';
describe('OrganisationEditorComponent', () => {
let component: OrganisationEditorComponent;
let fixture: ComponentFixture<OrganisationEditorComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ OrganisationEditorComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(OrganisationEditorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,137 +0,0 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { OrganisationService } from '../../services/organisation-service';
import { ContextMenuComponent } from 'ngx-contextmenu';
import { ReactiveFormsModule } from '@angular/forms';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import '../../../assets/custom.js';
declare function simple_notifier(type: string, title: string, message:string): any;
@Component({
selector: 'app-organisation-editor',
templateUrl: './organisation-editor.component.html',
styleUrls: ['./organisation-editor.component.css']
})
export class OrganisationEditorComponent implements OnInit {
constructor(private organisationService : OrganisationService, private fb: FormBuilder) {
}
//whole dmp data model
tableData : any[] = new Array();
//organisation editor data model
editingOrganisation: any = {};
organisationEditorForm : any;
//required by the table
public filterQuery = "";
public rowsOnPage = 10;
//public sortBy = "email";
public sortOrder = "asc";
//visibility rules for containers
tableVisible: boolean = true;
editorVisible: boolean = false;
// for tableIds
showIDs : boolean = false;
ngOnInit() {
this.getAllOrganisations(false);
this.createOrganisationEditorForm();
}
createOrganisationEditorForm(){
this.organisationEditorForm = this.fb.group({
id: null,
label: ['', Validators.required ],
abbreviation: '',
reference: '',
uri: '',
definition: ''
});
}
switchToTable(){
this.tableVisible = true;
this.editorVisible = false;
}
switchToEditor(organisationID){
this.tableVisible = false;
this.editorVisible = true;
if(organisationID == null){
this.editingOrganisation = {id: null, label: "", abbreviation: "", reference: "", uri: "", definition: "" };
}
else{
this.editingOrganisation = this.tableData.filter((organisation) => organisation.id === organisationID)[0];
}
}
getAllOrganisations(showNotification : boolean){
this.organisationService.getAllOrganisations().subscribe( (data) => {
this.tableData = data;
if(showNotification)
simple_notifier("info",null,"Refreshed the table");
});
}
editOrganisation(organisation){
this.switchToEditor(organisation);
}
newOrganisation(){
this.switchToEditor(null);
}
save(mouseEvent){
this.organisationService.create(this.organisationEditorForm.value).subscribe(
response => {
simple_notifier("success",null,"Saved organisation");
this.getAllOrganisations(false);
this.switchToTable();
},
err => {
simple_notifier("danger",null,"Could not save organisation");
}
);
}
delete(organisation){
this.organisationService.delete(organisation).subscribe(
(response) => {
simple_notifier("success",null,"Deleted organisation");
this.getAllOrganisations(false);
this.switchToTable();
},
(err) => {
simple_notifier("danger",null,"Could not delete organisation");
}
)
}
refreshTable($event){
this.getAllOrganisations(true);
}
@ViewChild(ContextMenuComponent) public basicMenu: ContextMenuComponent;
}

View File

@ -1,33 +0,0 @@
.invisible {
display:none;
}
.visible {
display:block;
}
tr.hover:hover > * {
background-color: #eeeeee;
}
.editor-container{
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
}
.button-150px {
max-width: 150px;
}
.ng-template{
text-align: right;
}
.grayout-empty-table {
opacity: 0.6; /* Real browsers */
filter: alpha(opacity = 60); /* MSIE */
text-align: center;
vertical-align: middle;
}

View File

@ -1,121 +0,0 @@
<div class="editor-container container">
<div [ngClass]="{true:'visible', false:'invisible'}[tableVisible]">
<table class="table table-striped" [mfData]="tableData | projectTableFilter : filterQuery" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
<thead>
<tr>
<th colspan="1">
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Filter'/>
</th>
<th>
<button class="btn btn-default" (click)="refreshTable($event)">
<span class="glyphicon glyphicon-refresh"></span>
</button>
</th>
</tr>
<tr>
<th [ngClass]="{true:'visible', false:'invisible'}[showIDs]"><mfDefaultSorter by="id">ID</mfDefaultSorter></th>
<th><mfDefaultSorter by="label">Label</mfDefaultSorter></th>
<th><mfDefaultSorter by="abbreviation">Abbreviation</mfDefaultSorter></th>
<th><mfDefaultSorter by="reference">Reference</mfDefaultSorter></th>
<th><mfDefaultSorter by="uri">Uri</mfDefaultSorter></th>
<th><mfDefaultSorter by="definition">Definition</mfDefaultSorter></th>
</tr>
</thead>
<tbody>
<tr class="grayout-empty-table" *ngIf="!mf.data[0]" [contextMenu]="basicMenu" [contextMenuSubject]="project"> <td colspan="5">No elements</td></tr>
<tr *ngFor="let project of mf.data" class="hover" [contextMenu]="basicMenu" [contextMenuSubject]="project">
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{project.id}}</td>
<td>{{project?.label}}</td>
<td>{{project?.abbreviation}}</td>
<td>{{project?.reference}}</td>
<td>{{project?.uri}}</td>
<td>{{project?.definition}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="5">
<mfBootstrapPaginator [rowsOnPageSet]="[10,20,40]"></mfBootstrapPaginator>
</td>
</tr>
</tfoot>
</table>
</div>
<!-- this is the form editor -->
<div [ngClass]="{true:'visible', false:'invisible'}[editorVisible]">
<div> <!-- form container -->
<div style="display:block;">
<button (click)="switchToTable()" class="btn btn-lg btn-success pull-right" style="max-width:120px;">
<span class="glyphicon glyphicon-arrow-left"></span> Go back
</button>
</div>
<form [formGroup]="projectEditorForm" novalidate style="display:block;">
<div class="form-group" [ngClass]="{null:'invisible'}[editingProject?.id]">
<label class="center-block">ID: {{editingProject?.id}}
<input class="form-control invisible" formControlName="id" [ngModel]="editingProject?.id">
</label>
</div>
<div class="form-group">
<label class="center-block">Label:
<input class="form-control" formControlName="label" [ngModel]="editingProject?.label" (ngModelChange)="editingProject.label=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Abbreviation:
<input class="form-control" formControlName="abbreviation" [ngModel]="editingProject?.abbreviation" (ngModelChange)="editingProject.abbreviation=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Reference:
<input class="form-control" formControlName="reference" [ngModel]="editingProject?.reference" (ngModelChange)="editingProject.reference$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Uri:
<input class="form-control" formControlName="uri" [ngModel]="editingProject?.uri" (ngModelChange)="editingProject.uri$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Definition:
<input class="form-control" formControlName="definition" [ngModel]="editingProject?.definition" (ngModelChange)="editingProject.definition$event">
</label>
</div>
<div class="form-group" style="width:540px;">
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
</div>
</form>
<!--
<p>Form value: {{ projectEditorForm.value | json }}</p>
-->
</div>
</div>
</div>
<context-menu>
<ng-template contextMenuItem [subMenu]="manage">
<span></span>Manage Projects
</ng-template>
<context-menu #manage>
<ng-template contextMenuItem (execute)="newProject($event?.item)">
<span class="glyphicon glyphicon-plus"></span>Create Project
</ng-template>
<ng-template contextMenuItem (execute)="editProject($event?.item?.id)">
<span class="glyphicon glyphicon-pencil"></span>Edit this Project
</ng-template>
<ng-template contextMenuItem (execute)="delete($event?.item?.id)">
<span class="glyphicon glyphicon-trash red"></span> Delete this
</ng-template>
</context-menu>
<ng-template contextMenuItem>
<span></span>Show full tree connections
</ng-template>
</context-menu>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ProjectEditorComponent } from './project-editor.component';
describe('ProjectEditorComponent', () => {
let component: ProjectEditorComponent;
let fixture: ComponentFixture<ProjectEditorComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ProjectEditorComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ProjectEditorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,138 +0,0 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { DmpsServiceService } from '../../services/dmps-service.service';
import { ProjectService } from '../../services/project-service';
import { DmpProfileService } from '../../services/dmpprofile-service';
import { ContextMenuComponent } from 'ngx-contextmenu';
import { ReactiveFormsModule } from '@angular/forms';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import '../../../assets/custom.js';
declare function simple_notifier(type: string, title: string, message:string): any;
@Component({
selector: 'app-project-editor',
templateUrl: './project-editor.component.html',
styleUrls: ['./project-editor.component.css']
})
export class ProjectEditorComponent implements OnInit {
constructor(private projectService : ProjectService, private fb: FormBuilder) {
}
//whole dmp data model
tableData : any[] = new Array();
//project editor data model
editingProject: any = {};
projectEditorForm : any;
//required by the table
public filterQuery = "";
public rowsOnPage = 10;
//public sortBy = "email";
public sortOrder = "asc";
//visibility rules for containers
tableVisible: boolean = true;
editorVisible: boolean = false;
// for tableIds
showIDs : boolean = false;
ngOnInit() {
this.getAllProjects(false);
this.createProjectEditorForm();
}
createProjectEditorForm(){
this.projectEditorForm = this.fb.group({
id: null,
label: ['', Validators.required ],
abbreviation: '',
reference: '',
uri: '',
definition: ''
});
}
switchToTable(){
this.tableVisible = true;
this.editorVisible = false;
}
switchToEditor(projectID){
this.tableVisible = false;
this.editorVisible = true;
if(projectID == null){
this.editingProject = {id: null, label: "", abbreviation: "", reference: "", uri: "", definition: "" };
}
else{
this.editingProject = this.tableData.filter((project) => project.id === projectID)[0];
}
}
getAllProjects(showNotification : boolean){
this.projectService.getAllProjects().subscribe( (data) => {
this.tableData = data;
if(showNotification)
simple_notifier("info",null,"Refreshed the table");
});
}
editProject(project){
this.switchToEditor(project);
}
newProject(){
this.switchToEditor(null);
}
save(mouseEvent){
this.projectService.create(this.projectEditorForm.value).subscribe(
response => {
simple_notifier("success",null,"Saved project");
this.getAllProjects(false);
this.switchToTable();
},
err => {
simple_notifier("danger",null,"Could not save project");
}
);
}
delete(project){
console.log(project);
this.projectService.delete(project).subscribe(
(response) => {
simple_notifier("success",null,"Deleted project");
this.getAllProjects(false);
this.switchToTable();
},
(err) => {
simple_notifier("danger",null,"Could not delete project");
}
)
}
refreshTable($event){
this.getAllProjects(true);
}
@ViewChild(ContextMenuComponent) public basicMenu: ContextMenuComponent;
}

View File

@ -1,33 +0,0 @@
.invisible {
display:none;
}
.visible {
display:block;
}
tr.hover:hover > * {
background-color: #eeeeee;
}
.editor-container{
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
}
.button-150px {
max-width: 150px;
}
.ng-template{
text-align: right;
}
.grayout-empty-table {
opacity: 0.6; /* Real browsers */
filter: alpha(opacity = 60); /* MSIE */
text-align: center;
vertical-align: middle;
}

View File

@ -1,121 +0,0 @@
<div class="editor-container container">
<div [ngClass]="{true:'visible', false:'invisible'}[tableVisible]">
<table class="table table-striped" [mfData]="tableData | registryTableFilter : filterQuery" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
<thead>
<tr>
<th colspan="1">
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Filter'/>
</th>
<th>
<button class="btn btn-default" (click)="refreshTable($event)">
<span class="glyphicon glyphicon-refresh"></span>
</button>
</th>
</tr>
<tr>
<th [ngClass]="{true:'visible', false:'invisible'}[showIDs]"><mfDefaultSorter by="id">ID</mfDefaultSorter></th>
<th><mfDefaultSorter by="label">Label</mfDefaultSorter></th>
<th><mfDefaultSorter by="abbreviation">Abbreviation</mfDefaultSorter></th>
<th><mfDefaultSorter by="reference">Reference</mfDefaultSorter></th>
<th><mfDefaultSorter by="uri">Uri</mfDefaultSorter></th>
<th><mfDefaultSorter by="definition">Definition</mfDefaultSorter></th>
</tr>
</thead>
<tbody>
<tr class="grayout-empty-table" *ngIf="!mf.data[0]" [contextMenu]="basicMenu" [contextMenuSubject]="registry"> <td colspan="5">No elements</td></tr>
<tr *ngFor="let registry of mf.data" class="hover" [contextMenu]="basicMenu" [contextMenuSubject]="registry">
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{registry.id}}</td>
<td>{{registry?.label}}</td>
<td>{{registry?.abbreviation}}</td>
<td>{{registry?.reference}}</td>
<td>{{registry?.uri}}</td>
<td>{{registry?.definition}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="5">
<mfBootstrapPaginator [rowsOnPageSet]="[10,20,40]"></mfBootstrapPaginator>
</td>
</tr>
</tfoot>
</table>
</div>
<!-- this is the dmp editor -->
<div [ngClass]="{true:'visible', false:'invisible'}[editorVisible]">
<div> <!-- form container -->
<div style="display:block;">
<button (click)="switchToTable()" class="btn btn-lg btn-success pull-right" style="max-width:120px;">
<span class="glyphicon glyphicon-arrow-left"></span> Go back
</button>
</div>
<form [formGroup]="registryEditorForm" novalidate style="display:block;">
<div class="form-group" [ngClass]="{null:'invisible'}[editingRegistry?.id]">
<label class="center-block">ID: {{editingRegistry?.id}}
<input class="form-control invisible" formControlName="id" [ngModel]="editingRegistry?.id">
</label>
</div>
<div class="form-group">
<label class="center-block">Label:
<input class="form-control" formControlName="label" [ngModel]="editingRegistry?.label" (ngModelChange)="editingRegistry.label=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Abbreviation:
<input class="form-control" formControlName="abbreviation" [ngModel]="editingRegistry?.abbreviation" (ngModelChange)="editingRegistry.abbreviation=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Reference:
<input class="form-control" formControlName="reference" [ngModel]="editingRegistry?.reference" (ngModelChange)="editingRegistry.reference$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Uri:
<input class="form-control" formControlName="uri" [ngModel]="editingRegistry?.uri" (ngModelChange)="editingRegistry.uri$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Definition:
<input class="form-control" formControlName="definition" [ngModel]="editingRegistry?.definition" (ngModelChange)="editingRegistry.definition$event">
</label>
</div>
<div class="form-group" style="width:540px;">
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
</div>
</form>
<!--
<p>Form value: {{ registryEditorForm.value | json }}</p>
-->
</div>
</div>
</div>
<context-menu>
<ng-template contextMenuItem [subMenu]="manage">
<span></span>Manage Registries
</ng-template>
<context-menu #manage>
<ng-template contextMenuItem (execute)="newRegistry($event?.item)">
<span class="glyphicon glyphicon-plus"></span>Create Registry
</ng-template>
<ng-template contextMenuItem (execute)="editRegistry($event?.item?.id)">
<span class="glyphicon glyphicon-pencil"></span>Edit this Registry
</ng-template>
<ng-template contextMenuItem (execute)="delete($event?.item?.id)">
<span class="glyphicon glyphicon-trash red"></span> Delete this
</ng-template>
</context-menu>
<ng-template contextMenuItem>
<span></span>Show full tree connections
</ng-template>
</context-menu>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RegistryEditorComponent } from './registry-editor.component';
describe('RegistryEditorComponent', () => {
let component: RegistryEditorComponent;
let fixture: ComponentFixture<RegistryEditorComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RegistryEditorComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(RegistryEditorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,140 +0,0 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { RegistryService } from '../../services/registry-service';
import { ContextMenuComponent } from 'ngx-contextmenu';
import { ReactiveFormsModule } from '@angular/forms';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import '../../../assets/custom.js';
declare function simple_notifier(type: string, title: string, message:string): any;
@Component({
selector: 'app-registry-editor',
templateUrl: './registry-editor.component.html',
styleUrls: ['./registry-editor.component.css']
})
export class RegistryEditorComponent implements OnInit {
//whole dmp data model
tableData : any[] = new Array();
//project editor data model
editingRegistry: any = {};
registryEditorForm : any;
//required by the table
public filterQuery = "";
public rowsOnPage = 10;
//public sortBy = "email";
public sortOrder = "asc";
//visibility rules for containers
tableVisible: boolean = true;
editorVisible: boolean = false;
// for tableIds
showIDs : boolean = false;
constructor(private registryService : RegistryService, private fb: FormBuilder) {
}
ngOnInit() {
this.getAllRegistries(false);
this.createRegistrytEditorForm();
}
createRegistrytEditorForm(){
this.registryEditorForm = this.fb.group({
id: null,
label: ['', Validators.required ],
abbreviation: '',
reference: '',
uri: '',
definition: ''
});
}
switchToTable(){
this.tableVisible = true;
this.editorVisible = false;
}
switchToEditor(registryID){
this.tableVisible = false;
this.editorVisible = true;
if(registryID == null){
this.editingRegistry = {id: null, label: "", abbreviation: "", reference: "", uri: "", definition: "" };
}
else{
this.editingRegistry = this.tableData.filter((registry) => registry.id === registryID)[0];
}
}
getAllRegistries(showNotification : boolean){
this.registryService.getAllRegistries().subscribe( (data) => {
this.tableData = data;
if(showNotification)
simple_notifier("info",null,"Refreshed the table");
});
}
editRegistry(registry){
this.switchToEditor(registry);
}
newProject(){
this.switchToEditor(null);
}
save(mouseEvent){
this.registryService.create(this.registryEditorForm.value).subscribe(
response => {
simple_notifier("success",null,"Saved registry");
this.getAllRegistries(false);
this.switchToTable();
},
err => {
simple_notifier("danger",null,"Could not save registry");
}
);
}
delete(registry){
this.registryService.delete(registry).subscribe(
(response) => {
simple_notifier("success",null,"Deleted registry");
this.getAllRegistries(false);
this.switchToTable();
},
(err) => {
simple_notifier("danger",null,"Could not delete registry");
}
)
}
refreshTable($event){
this.getAllRegistries(true);
}
@ViewChild(ContextMenuComponent) public basicMenu: ContextMenuComponent;
}

View File

@ -1,33 +0,0 @@
.invisible {
display:none;
}
.visible {
display:block;
}
tr.hover:hover > * {
background-color: #eeeeee;
}
.editor-container{
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
}
.button-150px {
max-width: 150px;
}
.ng-template{
text-align: right;
}
.grayout-empty-table {
opacity: 0.6; /* Real browsers */
filter: alpha(opacity = 60); /* MSIE */
text-align: center;
vertical-align: middle;
}

View File

@ -1,122 +0,0 @@
<div class="editor-container container">
<div [ngClass]="{true:'visible', false:'invisible'}[tableVisible]">
<table class="table table-striped" [mfData]="tableData | researcherTableFilter : filterQuery" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
<thead>
<tr>
<th colspan="1">
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Filter'/>
</th>
<th>
<button class="btn btn-default" (click)="refreshTable($event)">
<span class="glyphicon glyphicon-refresh"></span>
</button>
</th>
</tr>
<tr>
<th [ngClass]="{true:'visible', false:'invisible'}[showIDs]"><mfDefaultSorter by="id">ID</mfDefaultSorter></th>
<th><mfDefaultSorter by="label">Label</mfDefaultSorter></th>
<th><mfDefaultSorter by="uri">Uri</mfDefaultSorter></th>
<th><mfDefaultSorter by="primaryEmail">PrimaryEmail</mfDefaultSorter></th>
<th><mfDefaultSorter by="definition">Definition</mfDefaultSorter></th>
<th><mfDefaultSorter by="reference">Reference</mfDefaultSorter></th>
</tr>
</thead>
<tbody>
<tr class="grayout-empty-table" *ngIf="!mf.data[0]" [contextMenu]="basicMenu" [contextMenuSubject]="researcher"> <td colspan="5">No elements</td></tr>
<tr *ngFor="let researcher of mf.data" class="hover" [contextMenu]="basicMenu" [contextMenuSubject]="researcher">
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{researcher.id}}</td>
<td>{{researcher?.label}}</td>
<td>{{researcher?.uri}}</td>
<td>{{researcher?.primaryEmail}}</td>
<td>{{researcher?.definition}}</td>
<td>{{researcher?.reference}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="5">
<mfBootstrapPaginator [rowsOnPageSet]="[10,20,40]"></mfBootstrapPaginator>
</td>
</tr>
</tfoot>
</table>
</div>
<!-- this is the dmp editor -->
<div [ngClass]="{true:'visible', false:'invisible'}[editorVisible]">
<div> <!-- form container -->
<div style="display:block;">
<button (click)="switchToTable()" class="btn btn-lg btn-success pull-right" style="max-width:120px;">
<span class="glyphicon glyphicon-arrow-left"></span> Go back
</button>
</div>
<form [formGroup]="researcherEditorForm" novalidate style="display:block;">
<div class="form-group" [ngClass]="{null:'invisible'}[editingResearcher?.id]">
<label class="center-block">ID: {{editingResearcher?.id}}
<input class="form-control invisible" formControlName="id" [ngModel]="editingResearcher?.id">
</label>
</div>
<div class="form-group">
<label class="center-block">Label:
<input class="form-control" formControlName="label" [ngModel]="editingResearcher?.label" (ngModelChange)="editingResearcher.label=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Uri:
<input class="form-control" formControlName="uri" [ngModel]="editingResearcher?.uri" (ngModelChange)="editingResearcher.uri$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Primary Email:
<input class="form-control" formControlName="primaryEmail" [ngModel]="editingResearcher?.primaryEmail" (ngModelChange)="editingResearcher.primaryEmail=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Definition:
<input class="form-control" formControlName="definition" [ngModel]="editingResearcher?.definition" (ngModelChange)="editingResearcher.definition$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Reference:
<input class="form-control" formControlName="reference" [ngModel]="editingResearcher?.reference" (ngModelChange)="editingResearcher.reference$event">
</label>
</div>
<div class="form-group" style="width:540px;">
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
</div>
</form>
<!--
<p>Form value: {{ researcherEditorForm.value | json }}</p>
-->
</div>
</div>
</div>
<context-menu>
<ng-template contextMenuItem [subMenu]="manage">
<span></span>Manage researchers
</ng-template>
<context-menu #manage>
<ng-template contextMenuItem (execute)="newResearcher($event?.item)">
<span class="glyphicon glyphicon-plus"></span>Create researcher
</ng-template>
<ng-template contextMenuItem (execute)="editResearcher($event?.item?.id)">
<span class="glyphicon glyphicon-pencil"></span>Edit this researcher
</ng-template>
<ng-template contextMenuItem (execute)="delete($event?.item?.id)">
<span class="glyphicon glyphicon-trash red"></span> Delete this
</ng-template>
</context-menu>
<ng-template contextMenuItem>
<span></span>Show full tree connections
</ng-template>
</context-menu>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ResearcherEditorComponent } from './researcher-editor.component';
describe('ResearcherEditorComponent', () => {
let component: ResearcherEditorComponent;
let fixture: ComponentFixture<ResearcherEditorComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ResearcherEditorComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ResearcherEditorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,135 +0,0 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { ResearcherService } from '../../services/researcher-service';
import { ContextMenuComponent } from 'ngx-contextmenu';
import { ReactiveFormsModule } from '@angular/forms';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import '../../../assets/custom.js';
declare function simple_notifier(type: string, title: string, message:string): any;
@Component({
selector: 'app-researcher-editor',
templateUrl: './researcher-editor.component.html',
styleUrls: ['./researcher-editor.component.css']
})
export class ResearcherEditorComponent implements OnInit {
constructor(private researcherService : ResearcherService, private fb: FormBuilder) {
}
//whole dmp data model
tableData : any[] = new Array();
//researcher editor data model
editingResearcher: any = {};
researcherEditorForm : any;
//required by the table
public filterQuery = "";
public rowsOnPage = 10;
//public sortBy = "email";
public sortOrder = "asc";
//visibility rules for containers
tableVisible: boolean = true;
editorVisible: boolean = false;
// for tableIds
showIDs : boolean = false;
ngOnInit() {
this.getAllResearchers(false);
this.createResearcherEditorForm();
}
createResearcherEditorForm(){
this.researcherEditorForm = this.fb.group({
id: null,
label: ['', Validators.required ],
uri: '',
primaryEmail: '',
definition: '',
reference: ''
});
}
switchToTable(){
this.tableVisible = true;
this.editorVisible = false;
}
switchToEditor(researcherID){
this.tableVisible = false;
this.editorVisible = true;
if(researcherID == null){
this.editingResearcher = {id: null, label: "", uri: "", primaryEmail: "", definition: "", reference: "" };
}
else{
this.editingResearcher = this.tableData.filter((researcher) => researcher.id === researcherID)[0];
}
}
getAllResearchers(showNotification : boolean){
this.researcherService.getAllResearchers().subscribe( (data) => {
this.tableData = data;
if(showNotification)
simple_notifier("info",null,"Refreshed the table");
});
}
editResearcher(researcher){
this.switchToEditor(researcher);
}
newResearcher(){
this.switchToEditor(null);
}
save(mouseEvent){
this.researcherService.create(this.researcherEditorForm.value).subscribe(
response => {
simple_notifier("success",null,"Saved resercher");
this.getAllResearchers(false);
this.switchToTable();
},
err => {
simple_notifier("danger",null,"Could not save researcher");
}
);
}
delete(resercher){
this.researcherService.delete(resercher).subscribe(
(response) => {
simple_notifier("success",null,"Deleted researcher");
this.getAllResearchers(false);
this.switchToTable();
},
(err) => {
simple_notifier("danger",null,"Could not delete researcher");
}
)
}
refreshTable($event){
this.getAllResearchers(true);
}
@ViewChild(ContextMenuComponent) public basicMenu: ContextMenuComponent;
}

View File

@ -1,33 +0,0 @@
.invisible {
display:none;
}
.visible {
display:block;
}
tr.hover:hover > * {
background-color: #eeeeee;
}
.editor-container{
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
}
.button-150px {
max-width: 150px;
}
.ng-template{
text-align: right;
}
.grayout-empty-table {
opacity: 0.6; /* Real browsers */
filter: alpha(opacity = 60); /* MSIE */
text-align: center;
vertical-align: middle;
}

View File

@ -1,122 +0,0 @@
<div class="editor-container container">
<div [ngClass]="{true:'visible', false:'invisible'}[tableVisible]">
<table class="table table-striped" [mfData]="tableData | serviceTableFilter : filterQuery" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
<thead>
<tr>
<th colspan="1">
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Filter'/>
</th>
<th>
<button class="btn btn-default" (click)="refreshTable($event)">
<span class="glyphicon glyphicon-refresh"></span>
</button>
</th>
</tr>
<tr>
<th [ngClass]="{true:'visible', false:'invisible'}[showIDs]"><mfDefaultSorter by="id">ID</mfDefaultSorter></th>
<th><mfDefaultSorter by="label">Label</mfDefaultSorter></th>
<th><mfDefaultSorter by="abbreviation">Abbreviation</mfDefaultSorter></th>
<th><mfDefaultSorter by="reference">Reference</mfDefaultSorter></th>
<th><mfDefaultSorter by="uri">Uri</mfDefaultSorter></th>
<th><mfDefaultSorter by="definition">Definition</mfDefaultSorter></th>
</tr>
</thead>
<tbody>
<tr class="grayout-empty-table" *ngIf="!mf.data[0]" [contextMenu]="basicMenu" [contextMenuSubject]="service"> <td colspan="5">No elements</td></tr>
<tr *ngFor="let service of mf.data" class="hover" [contextMenu]="basicMenu" [contextMenuSubject]="service">
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{service?.id}}</td>
<td>{{service?.label}}</td>
<td>{{service?.abbreviation}}</td>
<td>{{service?.reference}}</td>
<td>{{service?.uri}}</td>
<td>{{service?.definition}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="5">
<mfBootstrapPaginator [rowsOnPageSet]="[10,20,40]"></mfBootstrapPaginator>
</td>
</tr>
</tfoot>
</table>
</div>
<!-- this is the dmp editor -->
<div [ngClass]="{true:'visible', false:'invisible'}[editorVisible]">
<div> <!-- form container -->
<div style="display:block;">
<button (click)="switchToTable()" class="btn btn-lg btn-success pull-right" style="max-width:120px;">
<span class="glyphicon glyphicon-arrow-left"></span> Go back
</button>
</div>
<form [formGroup]="serviceEditorForm" novalidate style="display:block;">
<div class="form-group" [ngClass]="{null:'invisible'}[editingService?.id]">
<label class="center-block">ID: {{editingService?.id}}
<input class="form-control invisible" formControlName="id" [ngModel]="editingService?.id">
</label>
</div>
<div class="form-group">
<label class="center-block">Label:
<input class="form-control" formControlName="label" [ngModel]="editingService?.label" (ngModelChange)="editingService.label=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Abbreviation:
<input class="form-control" formControlName="abbreviation" [ngModel]="editingService?.abbreviation" (ngModelChange)="editingService.abbreviation=$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Reference:
<input class="form-control" formControlName="reference" [ngModel]="editingService?.reference" (ngModelChange)="editingService.reference$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Uri:
<input class="form-control" formControlName="uri" [ngModel]="editingService?.uri" (ngModelChange)="editingService.uri$event">
</label>
</div>
<div class="form-group">
<label class="center-block">Definition:
<input class="form-control" formControlName="definition" [ngModel]="editingService?.definition" (ngModelChange)="editingService.definition$event">
</label>
</div>
<div class="form-group" style="width:540px;">
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
</div>
</form>
<!--
<p>Form value: {{ serviceEditorForm.value | json }}</p>
-->
</div>
</div>
</div>
<context-menu>
<ng-template contextMenuItem [subMenu]="manage">
<span></span>Manage Services
</ng-template>
<context-menu #manage>
<ng-template contextMenuItem (execute)="newService($event?.item)">
<span class="glyphicon glyphicon-plus"></span>Create service
</ng-template>
<ng-template contextMenuItem (execute)="editService($event?.item?.id)">
<span class="glyphicon glyphicon-pencil"></span>Edit this service
</ng-template>
<ng-template contextMenuItem (execute)="delete($event?.item?.id)">
<span class="glyphicon glyphicon-trash red"></span> Delete this
</ng-template>
</context-menu>
<ng-template contextMenuItem>
<span></span>Show full tree connections
</ng-template>
</context-menu>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ServiceEditorComponent } from './service-editor.component';
describe('ServiceEditorComponent', () => {
let component: ServiceEditorComponent;
let fixture: ComponentFixture<ServiceEditorComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ServiceEditorComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ServiceEditorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,134 +0,0 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { ServiceService } from '../../services/service-service';
import { ContextMenuComponent } from 'ngx-contextmenu';
import { ReactiveFormsModule } from '@angular/forms';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import '../../../assets/custom.js';
declare function simple_notifier(type: string, title: string, message:string): any;
@Component({
selector: 'app-service-editor',
templateUrl: './service-editor.component.html',
styleUrls: ['./service-editor.component.css']
})
export class ServiceEditorComponent implements OnInit {
constructor(private serviceService : ServiceService, private fb: FormBuilder) {
}
//whole dmp data model
tableData : any[] = new Array();
//project editor data model
editingService: any = {};
serviceEditorForm : any;
//required by the table
public filterQuery = "";
public rowsOnPage = 10;
//public sortBy = "email";
public sortOrder = "asc";
//visibility rules for containers
tableVisible: boolean = true;
editorVisible: boolean = false;
// for tableIds
showIDs : boolean = false;
ngOnInit() {
this.getAllServices(false);
this.createServiceEditorForm();
}
createServiceEditorForm(){
this.serviceEditorForm = this.fb.group({
id: null,
label: ['', Validators.required ],
abbreviation: '',
reference: '',
uri: '',
definition: ''
});
}
switchToTable(){
this.tableVisible = true;
this.editorVisible = false;
}
switchToEditor(serviceID){
this.tableVisible = false;
this.editorVisible = true;
if(serviceID == null){
this.editingService = {id: null, label: "", abbreviation: "", reference: "", uri: "", definition: "" };
}
else{
this.editingService = this.tableData.filter((service) => service.id === serviceID)[0];
}
}
getAllServices(showNotification : boolean){
this.serviceService.getAllServices().subscribe( (data) => {
this.tableData = data;
if(showNotification)
simple_notifier("info",null,"Refreshed the table");
});
}
editService(service){
this.switchToEditor(service);
}
newService(){
this.switchToEditor(null);
}
save(mouseEvent){
this.serviceService.create(this.serviceEditorForm.value).subscribe(
response => {
simple_notifier("success",null,"Saved service");
this.getAllServices(false);
this.switchToTable();
},
err => {
simple_notifier("danger",null,"Could not save service");
}
);
}
delete(service){
this.serviceService.delete(service).subscribe(
(response) => {
simple_notifier("success",null,"Deleted service");
this.getAllServices(false);
this.switchToTable();
},
(err) => {
}
)
}
refreshTable($event){
this.getAllServices(true);
}
@ViewChild(ContextMenuComponent) public basicMenu: ContextMenuComponent;
}

View File

@ -0,0 +1,27 @@
import { NativeDateAdapter } from '@angular/material';
export class LocalizedDateAdapter extends NativeDateAdapter {
parse(value: any): Date | null {
const invalidDate = new Date(NaN);
if (typeof value === 'string') {
if (value === '') { return null; } else {
const splitted = value.split('/');
if (splitted.length !== 3) { return invalidDate; } else {
const day = Number(splitted[0]);
const month = Number(splitted[1]) - 1;
const year = Number(splitted[2]);
if (day < 1 || day > 31 || month < 0 || month > 11 || year < 1 || year > 9999) { return invalidDate; }
return new Date(year, month, day);
}
}
} else {
const dateValue = typeof value === 'number' ? value : Date.parse(value);
return isNaN(dateValue) ? invalidDate : new Date(dateValue);
}
}
}

View File

@ -0,0 +1,97 @@
import { NgModule } from '@angular/core';
import {
MatToolbarModule,
MatIconModule,
MatSidenavModule,
MatButtonModule,
MatTableModule,
MatPaginatorModule,
MatSortModule,
MatDialogModule,
MatDatepickerModule,
MatNativeDateModule,
MatInputModule,
MatFormFieldModule,
MatSnackBarModule,
MatAutocompleteModule,
MatExpansionModule,
MatSelectModule,
MatOptionModule,
MatCardModule,
MatProgressBarModule,
MatProgressSpinnerModule,
DateAdapter,
MatTooltipModule,
MatTabsModule
} from '@angular/material';
import { CdkTableModule } from '@angular/cdk/table';
import { LocalizedDateAdapter } from './date/LocalizedDateAdapter';
import { SnackBarNotificationComponent } from 'app/shared/notification/snack-bar-notification.component';
@NgModule({
imports: [
MatToolbarModule,
MatIconModule,
MatSidenavModule,
MatButtonModule,
MatTableModule,
MatPaginatorModule,
CdkTableModule,
MatSortModule,
MatDialogModule,
MatDatepickerModule,
MatNativeDateModule,
MatInputModule,
MatFormFieldModule,
MatSnackBarModule,
MatAutocompleteModule,
MatExpansionModule,
MatSelectModule,
MatOptionModule,
MatCardModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatTooltipModule,
MatTabsModule
],
exports: [
MatToolbarModule,
MatIconModule,
MatSidenavModule,
MatButtonModule,
MatTableModule,
MatPaginatorModule,
CdkTableModule,
MatSortModule,
MatDialogModule,
MatDatepickerModule,
MatNativeDateModule,
MatInputModule,
MatFormFieldModule,
MatSnackBarModule,
MatAutocompleteModule,
MatExpansionModule,
MatSelectModule,
MatOptionModule,
MatCardModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatTooltipModule,
MatTabsModule
],
providers: [
{ provide: DateAdapter, useClass: LocalizedDateAdapter },
],
entryComponents: [
SnackBarNotificationComponent
]
})
export class MaterialModule {
constructor(dateAdapter: DateAdapter<LocalizedDateAdapter>) {
dateAdapter.setLocale('el-GR');
}
}

View File

@ -22,7 +22,7 @@ export class RadioBoxData extends DataField<RadioBoxData>{
}
fromJSONObject(item:any):RadioBoxData{
this.options = new JsonSerializer<ListingItem>().fromJSONArray(item.options,ListingItem);
this.options = JsonSerializer.fromJSONArray(item.options,ListingItem);
this.label = item.label
return this;
}

View File

@ -25,7 +25,7 @@ export class WordListData extends DataField<WordListData>{
fromJSONObject(item:any):WordListData{
this.type = item.type;
this.options = new JsonSerializer<ListingItem>().fromJSONArray(item.options,ListingItem);
this.options = JsonSerializer.fromJSONArray(item.options,ListingItem);
this.label = item.label;
return this;
}

View File

@ -13,8 +13,8 @@ export class DatasetProfileModel extends BaseModel implements Serializable<Datas
public label: string;
fromJSONObject(item:any):DatasetProfileModel{
this.sections = new JsonSerializer<Section>().fromJSONArray(item.sections, Section);
this.pages = new JsonSerializer<Page>().fromJSONArray(item.pages, Page);
this.sections = JsonSerializer.fromJSONArray(item.sections, Section);
this.pages = JsonSerializer.fromJSONArray(item.pages, Page);
this.label = item.label;
return this;
}
@ -30,10 +30,10 @@ export class DatasetProfileModel extends BaseModel implements Serializable<Datas
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));
let pagesFormArray = new Array<FormGroup>();
// this.pages.forEach(item => {
// let form: FormGroup = item.buildForm();
// pagesFormArray.push(form)
// })
this.pages.forEach(item => {
let form: FormGroup = item.buildForm();
pagesFormArray.push(form)
})
formGroup.addControl('pages', this.formBuilder.array(pagesFormArray));
formGroup.addControl('label', new FormControl(this.label, Validators.required));

View File

@ -34,23 +34,23 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
fromJSONObject(item: any): Field {
this.id = item.id;
this.title = item.title;
this.defaultValue = new JsonSerializer<DefaultValue>().fromJSONObject(item.defaultValue, DefaultValue);
this.defaultValue = JsonSerializer.fromJSONObject(item.defaultValue, DefaultValue);
this.page = item.page;
// this.multiplicity = new JsonSerializer<Multiplicity>().fromJSONObject(item.multiplicity, Multiplicity);
this.ordinal = item.ordinal;
this.validations = item.validations;
this.viewStyle = new JsonSerializer<ViewStyle>().fromJSONObject(item.viewStyle, ViewStyle);
this.visible = new JsonSerializer<Visibility>().fromJSONObject(item.visible, Visibility);
this.viewStyle = JsonSerializer.fromJSONObject(item.viewStyle, ViewStyle);
this.visible = JsonSerializer.fromJSONObject(item.visible, Visibility);
if (item.data) {
if (this.viewStyle.renderStyle === "combobox") {
if (item.data.type === "autocomplete") this.data = new JsonSerializer<AutocompleteData>().fromJSONObject(item.data, AutocompleteData);
if (item.data.type === "wordlist") this.data = new JsonSerializer<WordListData>().fromJSONObject(item.data, WordListData);
if (item.data.type === "autocomplete") this.data = JsonSerializer.fromJSONObject(item.data, AutocompleteData);
if (item.data.type === "wordlist") this.data = JsonSerializer.fromJSONObject(item.data, WordListData);
} else {
if (this.viewStyle.renderStyle === "radiobox") this.data = new JsonSerializer<RadioBoxData>().fromJSONObject(item.data, RadioBoxData);
if (this.viewStyle.renderStyle === "checkBox") this.data = new JsonSerializer<CheckBoxData>().fromJSONObject(item.data, CheckBoxData);
if (this.viewStyle.renderStyle === "textarea") this.data = new JsonSerializer<TextArea>().fromJSONObject(item.data, TextArea);
if (this.viewStyle.renderStyle === "freetext") this.data = new JsonSerializer<FreeTextData>().fromJSONObject(item.data, FreeTextData);
if (this.viewStyle.renderStyle === "booleanDecision") this.data = new JsonSerializer<BooleanDecisionData>().fromJSONObject(item.data, BooleanDecisionData);
if (this.viewStyle.renderStyle === "radiobox") this.data = JsonSerializer.fromJSONObject(item.data, RadioBoxData);
if (this.viewStyle.renderStyle === "checkBox") this.data = JsonSerializer.fromJSONObject(item.data, CheckBoxData);
if (this.viewStyle.renderStyle === "textarea") this.data = JsonSerializer.fromJSONObject(item.data, TextArea);
if (this.viewStyle.renderStyle === "freetext") this.data = JsonSerializer.fromJSONObject(item.data, FreeTextData);
if (this.viewStyle.renderStyle === "booleanDecision") this.data = JsonSerializer.fromJSONObject(item.data, BooleanDecisionData);
}
}
return this;
@ -63,9 +63,10 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
page: [this.page],
ordinal: [this.ordinal]
});
let valid = ValidationTypes.None
if (this.validations && this.validations[0]==1) valid = ValidationTypes.Required
const arr = new FormArray([
new FormControl(ValidationTypes.None)
new FormControl(valid)
]);
//formGroup.addControl("multiplicity", this.multiplicity.buildForm());

View File

@ -29,7 +29,7 @@ export class FieldGroup extends BaseModel implements Serializable<FieldGroup>, F
this.defaultVisibility = item.defaultVisibility;
this.page = item.page;
this.ordinal = item.ordinal;
this.compositeFields = new JsonSerializer<FieldSet>().fromJSONArray(item.compositeFields, FieldSet);
this.compositeFields = JsonSerializer.fromJSONArray(item.compositeFields, FieldSet);
return this;
}

View File

@ -17,8 +17,8 @@ export class FieldSet extends BaseModel implements Serializable<FieldSet> {
fromJSONObject(item:any):FieldSet{
this.fields = new JsonSerializer<Field>().fromJSONArray(item.fields,Field);
this.multiplicity = new JsonSerializer<Multiplicity>().fromJSONObject(item.multiplicity, Multiplicity);
this.fields = JsonSerializer.fromJSONArray(item.fields,Field);
this.multiplicity = JsonSerializer.fromJSONObject(item.multiplicity, Multiplicity);
this.id = item.id;
this.ordinal = item.ordinal;
this.title = item.title;

View File

@ -5,25 +5,28 @@ import { Serializable } from '../interfaces/Serializable';
export class Page extends BaseModel implements Serializable<Page>, FormGenerator<FormGroup>{
public title: string;
public id: number;
public id: string;
public ordinal: number;
constructor(id?: number) {
constructor(ordinal?: number) {
super();
if (isNaN(id)) this.id = 0;
else this.id = id;
if (isNaN(ordinal)) this.ordinal = 0;
else this.ordinal = ordinal;
this.id = "page_" + this.ordinal;
}
fromJSONObject(item: any): Page {
this.title = item.title;
this.id = item.id;
this.ordinal = item.ordinal;
return this;
}
buildForm(): FormGroup {
let formGroup = this.formBuilder.group({
title: [this.title],
id: [this.id]
id: [this.id],
ordinal: [this.ordinal]
});
return formGroup;
}

View File

@ -18,7 +18,7 @@ export class Section extends BaseModel implements Serializable<Section>, FormGen
public fieldSets: Array<FieldSet> = new Array<FieldSet>();
fromJSONObject(item: any): Section {
this.sections = new JsonSerializer<Section>().fromJSONArray(item.sections, Section);
this.sections = JsonSerializer.fromJSONArray(item.sections, Section);
//this.fieldGroups = new JsonSerializer<FieldGroup>().fromJSONArray(item.fieldGroups, FieldGroup);
this.page = item.page;
this.defaultVisibility = item.defaultVisibility;
@ -26,7 +26,7 @@ export class Section extends BaseModel implements Serializable<Section>, FormGen
this.title = item.title;
this.description = item.description;
this.ordinal = item.ordinal;
this.fieldSets = new JsonSerializer<FieldSet>().fromJSONArray(item.fieldSets, FieldSet);
this.fieldSets = JsonSerializer.fromJSONArray(item.fieldSets, FieldSet);
return this;
}

View File

@ -10,7 +10,7 @@ export class Visibility extends BaseModel implements Serializable<Visibility>, F
public style:string;
fromJSONObject(item:any):Visibility{
this.rules = new JsonSerializer<Rule>().fromJSONArray(item.rules, Rule);
this.rules = JsonSerializer.fromJSONArray(item.rules, Rule);
this.style = item.style;
return this;

View File

@ -0,0 +1,3 @@
export interface Serializable<T> {
fromJSONObject(item: Object): T;
}

View File

@ -0,0 +1,4 @@
export class DataTableData<T> {
data = new Array<T>();
totalCount = 0;
}

View File

@ -0,0 +1,12 @@
import { UserCriteria } from '../../core/criteria/UserCriteria';
export class DataTableRequest {
offset = 0;
length = 0;
userCriteria: UserCriteria;
constructor(offset: number, length: number) {
this.length = length;
this.offset = offset;
}
}

View File

@ -0,0 +1,13 @@
/**
* An object used to get page information from the server
*/
export class Page {
// The number of elements in the page
size = 0;
// The total number of elements
totalElements = 0;
// The total number of pages
totalPages = 0;
// The current page number
pageNumber = 0;
}

View File

@ -0,0 +1,9 @@
import { Page } from './page';
/**
* An array of data with an associated page object used for paging
*/
export class PagedData<T> {
data = new Array<T>();
page = new Page();
}

View File

@ -0,0 +1,4 @@
export class Credential {
public username: string;
public secret: string;
}

View File

@ -0,0 +1,12 @@
export enum LoginProviders {
Google = 1,
Facebook = 2,
Twitter = 3,
LinkedIn = 4
}
export class LoginInfo {
public ticket: string;
public provider: LoginProviders;
public data?: any;
}

View File

@ -0,0 +1,26 @@
import { Serializable } from '../Serializable';
export class Principal implements Serializable<Principal> {
id: number;
token: string;
name: string;
expiresAt: Date;
appRoles: Principal.AppRole[];
fromJSONObject(item: any): Principal {
this.id = item.id;
this.token = item.token;
this.name = item.name;
this.expiresAt = item.expiresAt;
this.appRoles = item.appRoles;
return this;
}
}
export namespace Principal {
export enum AppRole {
Admin = 0,
User = 1
}
}

View File

@ -5,89 +5,70 @@ import { Routes, RouterModule } from '@angular/router';
import { GooggleSignInComponent } from './login/googgle-sign-in/googgle-sign-in.component';
import { DatasetsViewerComponent } from './datasets-viewer/datasets-viewer.component';
import { ProfileEditorComponent } from './bootstrap/profile-editor/profile-editor.component';
import { DmpEditorComponent } from './managers/dmp-editor/dmp-editor.component';
import { DmpProfileEditorComponent } from './managers/dmp-profile-editor/dmp-profile-editor.component';
import { ProjectEditorComponent } from './managers/project-editor/project-editor.component';
import { ServiceEditorComponent } from './managers/service-editor/service-editor.component';
import { RegistryEditorComponent } from './managers/registry-editor/registry-editor.component';
import { OrganisationEditorComponent } from './managers/organisation-editor/organisation-editor.component';
import { ResearcherEditorComponent } from './managers/researcher-editor/researcher-editor.component';
import { DatareposEditorComponent } from './managers/datarepos-editor/datarepos-editor.component';
import { DatasetprofileEditorComponent } from './managers/datasetprofile-editor/datasetprofile-editor.component';
import { MainWindowComponent } from './main-window/main-window.component';
import { NgModule } from '@angular/core';
import { AuthGuard } from './guards/auth.guard';
import { AppComponent } from 'app/app.component';
import { MainSignInComponent } from 'app/login/main-sign-in/main-sign-in.component';
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
// Route Configuration
export const routes: Routes = [
const routes: Routes = [
{
path: '',
redirectTo: 'app-root',
redirectTo: '/main',
pathMatch: 'full'
},
{
path: 'app-root',
component: AppComponent,
canActivate: [AuthGuard]
},
{
path: 'datasets',
component: DatasetsViewerComponent
component: DatasetsViewerComponent,
canActivate: [AuthGuard]
},
{
path: 'datasetprofiles',
component: DatasetprofileEditorComponent
},
{
path: 'datarepos',
component: DatareposEditorComponent
component: DatasetprofileEditorComponent,
canActivate: [AuthGuard]
},
{
path: 'datasets/profile',
component: ProfileEditorComponent
component: ProfileEditorComponent,
canActivate: [AuthGuard]
//,data: { title: 'a title' }
},
{
path: 'dmps',
component: DmpEditorComponent
},
{
path: 'dmpprofiles',
component: DmpProfileEditorComponent
},
{
path: 'projects',
component: ProjectEditorComponent
},
{
path: 'services',
component: ServiceEditorComponent
},
{
path: 'organisations',
component: OrganisationEditorComponent
},
{
path: 'registries',
component: RegistryEditorComponent
},
{
path: 'researchers',
component: ResearcherEditorComponent
},
{
path: 'main',
component: MainWindowComponent
component: MainWindowComponent,
canActivate: [AuthGuard]
},
{
path: 'form/:id',
component: FormComponent
},
{
path: 'form',
component: FormComponent
}
{ path: 'form', loadChildren: './dataset-profile-form/dataset-profile.module#DatasetProfileModule', canActivate: [AuthGuard]},
{ path: "unauthorized", loadChildren: './unauthorized/unauthorized.module#UnauthorizedModule' } ,
{ path: "login", component: MainSignInComponent },
{ path: 'user-management', loadChildren: './users/users.module#UsersModule', canActivate: [AuthGuard]}
];
@NgModule({
imports: [
RouterModule.forRoot(
routes
)
],
exports: [
RouterModule
],
providers: [
AuthGuard
]
})
export const AppRouting: ModuleWithProviders = RouterModule.forRoot(routes);
export class AppRouting { }
//export const AppRouting: ModuleWithProviders = RouterModule.forRoot(routes);

View File

@ -0,0 +1,85 @@
import { Injectable } from '@angular/core';
import { HttpHeaders } from '@angular/common/http';
import { HttpClient } from '@angular/common/http';
//import { HostConfiguration } from '../../app.constants';
import { Principal } from '../../models/login/Principal';
//import { Credential } from '../../models/login/Credential';
import { Observable } from 'rxjs/Rx';
//import { MatSnackBar } from '@angular/material';
import { Router } from '@angular/router';
import { JsonSerializer } from '../../utilities/JsonSerializer';
import { LoginInfo } from '../../models/login/LoginInfo';
import { Credential } from 'app/models/login/Credential';
//import { SnackBarNotificationComponent } from '../../shared/components/notificaiton/snack-bar-notification.component';
@Injectable()
export class AuthService {
private actionUrl: string;
private headers: HttpHeaders;
constructor(
private http: HttpClient,
//public snackBar: MatSnackBar,
public router: Router
) {
this.actionUrl = 'http://192.168.32.67:8080/' + 'auth/';
this.headers = new HttpHeaders();
this.headers = this.headers.set('Content-Type', 'application/json');
this.headers = this.headers.set('Accept', 'application/json');
}
private clear(): void {
localStorage.removeItem('principal');
}
public current(principal?: Principal): Principal {
if (principal) {
localStorage.setItem('principal', JSON.stringify(principal));
return principal;
}
const principalJson = localStorage.getItem('principal');
if (!principalJson) { return null; }
const principalObj = JSON.parse(principalJson) as Principal;
return principalObj;
}
public me(): Observable<Principal> {
const url = this.actionUrl + '/me';
const principal = this.current();
if (!principal) {
this.clear();
return Observable.of<Principal>();
}
let headers = this.headers;
headers = headers.set('AuthToken', principal.token)
return this.http.post(url, null, { headers: headers })
.map((res: any) => {
const princ = this.current(JsonSerializer.fromJSONObject(res.payload, Principal));
return princ;
})
.catch((error: any) => {
console.warn('could not retrieve me info:\n', error);
this.clear();
const princ = this.current();
this.router.navigate(['/login']);
return Observable.of<Principal>(princ);
});
}
public nativeLogin(credentials: Credential): Observable<Principal> { debugger;
const url = this.actionUrl + 'nativelogin';
return this.http.post(url, credentials, { headers: this.headers })
.map((res: any) => {
const principal = this.current(JsonSerializer.fromJSONObject(res.payload, Principal));
//this.loginContextSubject.next(true);
return principal;
})
.catch((error: any) => {
//this.loginContextSubject.next(false);
return Observable.throw(error);
});
}
}

View File

@ -1,6 +1,5 @@
import { Injectable, Inject} from '@angular/core';
import { Observable } from 'rxjs';
import {LocalStorageService} from 'ngx-webstorage';
import 'rxjs/add/operator/map';
import { DOCUMENT } from '@angular/platform-browser';
@ -13,59 +12,59 @@ declare function sign_out_google(): any;
export class TokenService {
constructor (private storage : LocalStorageService, @Inject(DOCUMENT) private document) {
constructor (@Inject(DOCUMENT) private document) {
var csrfToken : string = jQuery(document).find('meta[name="csrf-token"]').attr('content');
this.setCSRFToken(csrfToken);
}
getCSRFToken() : string{
return this.storage.retrieve('csrf-token');
return localStorage.retrieve('csrf-token');
}
setCSRFToken(csrfToken : string){
this.storage.store('csrf-token',csrfToken);
localStorage.store('csrf-token',csrfToken);
}
getProvider() : TokenProvider {
return this.storage.retrieve('provider');
return localStorage.retrieve('provider');
}
setProvider(provider : TokenProvider){
this.storage.store('provider',provider);
localStorage.store('provider',provider);
}
getToken() : string{
return this.storage.retrieve('token');
return localStorage.retrieve('token');
}
setToken(token : string){
this.storage.store('token',token);
localStorage.store('token',token);
}
isLoggedIn(){
return this.storage.retrieve('loggedIn');
return localStorage.retrieve('loggedIn');
}
setLoggedIn(boolStatus){
this.storage.store('loggedIn',boolStatus);
localStorage.store('loggedIn',boolStatus);
}
getEmail(){
return this.storage.retrieve('email');
return localStorage.retrieve('email');
}
setEmail(email){
this.storage.store('email',email);
localStorage.store('email',email);
}
getUsername(){
return this.storage.retrieve('username');
return localStorage.retrieve('username');
}
setUsername(username){
this.storage.store('username',username);
localStorage.store('username',username);
}

View File

@ -18,7 +18,8 @@ export class RestBase {
/*
*/
protocol: string = "http";
hostname: string = "dl043.madgik.di.uoa.gr";
//hostname: string = "localhost";
hostname: string = "192.168.32.64";
port: number = 8080;
webappname: string = "";
restpath: string = "";

View File

@ -0,0 +1,102 @@
import { CriteriaErrorModel } from '../models/errormodel/criteriaErrorModel';
import { Component, OnInit, Input } from '@angular/core';
import { FormControl, FormGroup, NgForm, FormArray, AbstractControl } from '@angular/forms';
@Component({
selector: 'base-criteria-component',
template: '',
providers: [
]
})
export class BaseCriteriaComponent implements OnInit {
public refreshCallback: Function = null;
public formGroup: FormGroup = null;
constructor(
public baseErrorModel?: CriteriaErrorModel,
) {
}
ngOnInit() {
if (this.baseErrorModel == null) { this.baseErrorModel = new CriteriaErrorModel(); }
}
controlModified(): void {
this.clearErrorModel();
if (!this.isFormValid()) { return; }
if (this.refreshCallback != null) { this.refreshCallback(); }
}
public isFormValid(): boolean {
this.touchAllFormFields(this.formGroup);
this.validateAllFormFields(this.formGroup);
return this.formGroup.valid;
}
public getFormData(): any {
return this.formGroup.value;
}
public getFormControl(controlName: string): AbstractControl {
return this.formGroup.get(controlName);
}
public disableFormFields(formControl: AbstractControl) {
formControl.disable();
}
public validateAllFormFields(formControl: AbstractControl) {
if (formControl instanceof FormControl) {
formControl.updateValueAndValidity({ emitEvent: false })
} else if (formControl instanceof FormGroup) {
Object.keys(formControl.controls).forEach(item => {
const control = formControl.get(item);
this.validateAllFormFields(control);
})
} else if (formControl instanceof FormArray) {
formControl.controls.forEach(item => {
this.validateAllFormFields(item);
})
}
}
public touchAllFormFields(formControl: AbstractControl) {
if (formControl instanceof FormControl) {
formControl.markAsTouched();
} else if (formControl instanceof FormGroup) {
Object.keys(formControl.controls).forEach(item => {
const control = formControl.get(item);
this.touchAllFormFields(control);
})
} else if (formControl instanceof FormArray) {
formControl.controls.forEach(item => {
this.touchAllFormFields(item);
})
}
}
setRefreshCallback(callback: Function): void {
this.refreshCallback = callback;
}
onCallbackError(error: any) {
this.setErrorModel(error.error);
this.validateAllFormFields(this.formGroup);
}
public setErrorModel(errorModel: CriteriaErrorModel) {
Object.keys(errorModel).forEach(item => {
(<any>this.baseErrorModel)[item] = (<any>errorModel)[item];
})
}
public clearErrorModel() {
Object.keys(this.baseErrorModel).forEach(item => {
(<any>this.baseErrorModel)[item] = '';
})
}
}

View File

@ -0,0 +1,3 @@
export class BaseErrorModel {
}

View File

@ -0,0 +1,5 @@
import { BaseErrorModel } from './BaseErrorModel';
export class CriteriaErrorModel extends BaseErrorModel {
public Like: String;
}

View File

@ -0,0 +1,6 @@
import { CriteriaErrorModel } from '../criteriaErrorModel';
export class UserCriteriaErrorModel extends CriteriaErrorModel {
public Label: String;
public Roles: String;
}

View File

@ -0,0 +1,6 @@
import { BaseErrorModel } from "app/shared/components/criteria/models/errormodel/BaseErrorModel";
export class UserErrorModel extends BaseErrorModel {
public Roles: String;
}

View File

@ -0,0 +1,16 @@
import { Serializable } from '../../../../../../models/interfaces/Serializable';
import { TranslateService } from '@ngx-translate/core';
import { Principal } from 'app/models/login/Principal';
export class UserListingModel implements Serializable<UserListingModel> {
public id: String;
public label: String;
public roles: Principal.AppRole[];
fromJSONObject(item: any): UserListingModel {
this.id = item.id;
this.label = item.label;
this.roles = item.roles;
return this;
}
}

View File

@ -0,0 +1,24 @@
<form class="user-roles-criteria" [formGroup]="formGroup">
<mat-card class="mat-card">
<div class="row">
<div class="col-sm-6 col-md-8">
<mat-form-field>
<input matInput
placeholder="{{'CRITERIA.USERS.LABEL'| translate}}"
formControlName="label"
(ngModelChange)="controlModified()">
</mat-form-field>
</div>
<div class="col-sm-6 col-md-4">
<mat-form-field>
<mat-select placeholder="{{'CRITERIA.USERS.ROLE' | translate}}"
formControlName="roles"
(change)="controlModified()"
multiple>
<mat-option *ngFor="let role of getPrincipalAppRoleValues()" [value]="role">{{getPrincipalAppRoleWithLanguage(role)}}</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</mat-card>
</form>

View File

@ -0,0 +1,10 @@
.user-roles-criteria {
mat-form-field {
padding-bottom: 5px;
width: 100%;
}
mat-card {
padding-bottom: 0px;
}
}

View File

@ -0,0 +1,82 @@
import { TranslateService } from '@ngx-translate/core';
import { Validation, ValidationContext } from '../../../../utilities/validators/ValidationContext';
import { UserCriteria } from '../../../../core/criteria/UserCriteria';
import { Component, OnInit } from '@angular/core';
import { BaseCriteriaComponent } from '../base/base-criteria.component';
import { Principal } from '../../../../models/login/Principal';
import { FormBuilder, FormGroup } from '@angular/forms';
import { UserCriteriaErrorModel } from 'app/shared/components/criteria/models/errormodel/users/userCriteriaErrorModel';
@Component({
selector: 'users-criteria-component',
templateUrl: './users-criteria.component.html',
styleUrls: ['./users-criteria.component.scss'],
})
export class UsersCriteriaComponent extends BaseCriteriaComponent implements OnInit {
public role: Principal.AppRole;
public criteria: UserCriteria = new UserCriteria();
constructor(
public language: TranslateService,
public errorModel: UserCriteriaErrorModel,
public formBuilder: FormBuilder
) {
super(errorModel);
}
ngOnInit() {
super.ngOnInit();
if (this.criteria == null) { this.criteria = new UserCriteria(); }
if (this.formGroup == null) { this.formGroup = this.buildForm(); }
}
setCriteria(criteria: UserCriteria): void {
this.criteria = criteria;
this.formGroup = this.buildForm();
}
public fromJSONObject(item: any): UserCriteria {
this.criteria = new UserCriteria();
this.criteria.Label = item.Label;
this.criteria.Roles = item.Roles;
return this.criteria;
}
buildForm(): FormGroup {
const context: ValidationContext = this.createValidationContext();
return this.formBuilder.group({
label: [this.criteria.Label, context.getValidation('label').validators],
roles: [this.criteria.Roles, context.getValidation('roles').validators],
});
}
createValidationContext(): ValidationContext {
const validationContext: ValidationContext = new ValidationContext();
const validationArray: Validation[] = new Array<Validation>();
validationArray.push({ key: 'label' });
validationArray.push({ key: 'roles' });
validationContext.validation = validationArray;
return validationContext;
}
getPrincipalAppRoleValues(): Number[] {
let keys: string[] = Object.keys(Principal.AppRole);
keys = keys.slice(0, keys.length / 2);
const values: Number[] = keys.map(Number);
return values;
}
getPrincipalAppRoleWithLanguage(role: Principal.AppRole): string {
let result = '';
// this.language.get(new Utilities().convertFromPrincipalAppRole(role)).subscribe((value: string) => {
// result = value;
// });
return result;
}
}

View File

@ -0,0 +1,20 @@
import { TranslateService } from '@ngx-translate/core';
import { Component, Inject } from '@angular/core';
import { MAT_SNACK_BAR_DATA } from '@angular/material';
@Component({
selector: 'snack-bar-notification',
templateUrl: 'snack-bar-notification.html'
})
export class SnackBarNotificationComponent {
message: string;
constructor( @Inject(MAT_SNACK_BAR_DATA) public data: any) {
this.parseMessage(data.message, data.language);
}
parseMessage(message: any, language: TranslateService): void {
language.get(message).subscribe((value: string) => {
this.message = value;
});
}
}

View File

@ -0,0 +1 @@
{{message}}

View File

@ -0,0 +1,35 @@
import { SnackBarNotificationComponent } from './notification/snack-bar-notification.component';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { MaterialModule } from '../material/material.module';
import { TranslateModule } from '@ngx-translate/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CoreModule } from '../core/core.module';
@NgModule({
imports: [
CommonModule,
RouterModule,
MaterialModule,
CoreModule,
FormsModule,
ReactiveFormsModule,
TranslateModule,
],
declarations: [
SnackBarNotificationComponent,
],
exports: [
SnackBarNotificationComponent,
TranslateModule,
FormsModule,
ReactiveFormsModule,
],
entryComponents: [
]
})
export class SharedModule { }

View File

@ -1,243 +0,0 @@
export const TestModel = {
"sections": [
{
"id": "sumData",
"defaultVisibility": "true",
"page": "1",
"title": "1 Data Summary",
"description": " Fill in the fields to describe your data model ",
"sections": [],
"fieldGroups":
[
{
"id": "dataSummaryGroup",
"defaultVisibility": "true",
"page": "1",
"title": "Data Summary",
"description": "",
"extendedDescription": "",
"compositeFields": [
{
"multiplicity":{
"min":0,
"max":3
},
"fields":
[
{
"id": "dataSummary",
"defaultVisibility": "true",
"title": "",
"description": "",
"extendedDescription": "",
"viewStyle": "checkBox",
"rules":[
{
"ruleType":"fieldValue",
"target":"metadataStandarsA211",
"ruleStyle":"boolean",
"value":"true",
"valueType":"boolean"
},
{
"ruleType":"fieldValue",
"target":"freeOfChargeGroupCommentA213",
"ruleStyle":"boolean",
"value":"true",
"valueType":"boolean"
},
{
"ruleType":"fieldValue",
"target":"standardisedVocabulariesA212",
"ruleStyle":"boolean",
"value":"true",
"valueType":"boolean"
}
],
"multiplicity":{
"min":0,
"max":1
}
}
]
}
]
}
]
},
{
"id": "fairData",
"ordinal": "2",
"defaultVisibility": "true",
"page": "1",
"title": "2 Fair Data",
"sections": [
{
"id": "dataMetadata",
"defaultVisibility": "true",
"page": "1",
"title": "2.1 Making data findable, including provisions for metadata",
"sections": [],
"fieldGroups": [
{
"id": "FindDataMetadataGroup",
"section": "dataMetadata",
"defaultVisibility": "true",
"page": "1",
"title": "Making data findable, including provisions for metadata",
"description": "Making data findable, including provisions for metadata",
"extendedDescription": "FieldGroup Description",
"compositeFields": [
{
"fields":
[
{
"id": "useMetadataQ211",
"defaultVisibility": "true",
"title": "Q2.1.1 Will you use metadata to describe the data?",
"description": "User can select from a list of metadata standards. If they cannot find the standard in the list provided then they should choose \"not listed\". Selecting this will result in a field in which the user can insert the URL to the description of the metadata scheme used. A \"comments\" box should exist to allow users to add comments. They may select more than one metadata standard. They may specify more than one URL when selecting \"not listed\". They are also presented with a field in which to specify the location of the metadata service. Users can select the \"no metadata\" button to specify no metadata will be used to describe the data.",
"extendedDescription": "FieldGroup Description",
"viewStyle": "booleanDesicion",
"rules":[
{
"ruleType":"fieldValue",
"target":"noMetadata",
"ruleStyle":"boolean",
"value":"true",
"valueType":"boolean"
}
],
"multiplicity":{
"min":0,
"max":1
}
}
]
},
{
"fields":
[
{
"id": "metadataStandarsA211",
"defaultVisibility": "false",
"title": "Metadata standards",
"description": "The data will be described by metadata that follows the metadata standards described in <url1>, <url2>, ? The data will be described by metadata that follows the metadata schema described in <not-listed-url1>, <not-listed-url2>. The metadata will be stored in the service located at <metadata-repo-url>",
"extendedDescription": "",
"viewStyle": "combobox",
"rules":[],
"multiplicity":{
"min":0,
"max":1
}
}]
},
{
"fields":
[
{
"id": "notlistedA211",
"defaultVisibility": "false",
"title": "Not listed",
"description": "",
"extendedDescription": "",
"viewStyle": "checkBox",
"rules":[
{
"ruleType":"fieldValue",
"target":"",
"ruleStyle":"boolean",
"value":"",
"valueType":"boolean"
}
],
"multiplicity":{
"min":0,
"max":1
}
}]
},
{
"fields":
[
{
"id": "notlistedUrlA211",
"defaultVisibility": "false",
"title": "Url",
"description": "URL to the description of the metadata scheme used",
"extendedDescription": "",
"viewStyle": "freetext",
"rules":[
{
"ruleType":"fieldValue",
"target":"",
"ruleStyle":"boolean",
"value":"",
"valueType":"boolean"
}
],
"multiplicity":{
"min":0,
"max":1
}
}]
},
{
"fields":
[
{
"id": "notlistedCommentA211",
"defaultVisibility": "false",
"title": "Comments",
"description": "",
"extendedDescription": "",
"viewStyle": "freetext",
"rules":[
{
"ruleType":"fieldValue",
"target":"",
"ruleStyle":"boolean",
"value":"",
"valueType":"boolean"
}
],
"multiplicity":{
"min":0,
"max":1
}
}]
},
{
"fields":
[
{
"id": "noMetadata",
"defaultVisibility": "false",
"title": "The data will not be described by any metadata.",
"description": "",
"extendedDescription": "",
"viewStyle": "checkBox",
"rules":[
{
"ruleType":"fieldValue",
"target":"",
"ruleStyle":"boolean",
"value":"",
"valueType":"boolean"
}
],
"multiplicity":{
"min":0,
"max":1
}
}
]
}
]
}
]
}
]
}
]
}

View File

@ -0,0 +1 @@
<h2>{{message}}</h2>

View File

@ -0,0 +1 @@
{"version":3,"file":"unauthorized.component.js","sourceRoot":"","sources":["unauthorized.component.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAMzD,IAAa,qBAAqB;IAG9B,+BACY,WAAwB,EACxB,KAAqB,EACrB,MAAc;QAFd,gBAAW,GAAX,WAAW,CAAa;QACxB,UAAK,GAAL,KAAK,CAAgB;QACrB,WAAM,GAAN,MAAM,CAAQ;IACtB,CAAC;IAEL,+CAAe,GAAf;QAAA,iBAaC;QAZG,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC;QACpE,IAAI,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC3C,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;QAChF,CAAC;QACD,IAAI,CAAC,CAAC;YACF,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,SAAS,CAC3B,UAAA,SAAS;gBACL,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;oBAAC,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;YAChG,CAAC,EACD,UAAA,GAAG,IAAI,OAAA,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,GAAG,CAAC,EAAvC,CAAuC,CAAC,CAAC;QACxD,CAAC;IACL,CAAC;IACL,4BAAC;AAAD,CAAC,AAvBD,IAuBC;AArBG;IADC,KAAK,EAAE;;sDACe;AAFd,qBAAqB;IAJjC,SAAS,CAAC;QACP,QAAQ,EAAE,wBAAwB;QAClC,WAAW,EAAE,+BAA+B;KAC/C,CAAC;qCAK2B,WAAW;QACjB,cAAc;QACb,MAAM;GANjB,qBAAqB,CAuBjC;SAvBY,qBAAqB"}

View File

@ -0,0 +1,33 @@
import { AuthService } from '../services/auth/auth.service';
import { Component, Input } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
@Component({
selector: 'unauthorized-component',
templateUrl: './unauthorized.component.html'
})
export class UnauthorizedComponent {
@Input()
public message: string;
constructor(
private authService: AuthService,
private route: ActivatedRoute,
private router: Router
) { }
ngAfterViewInit() {
let returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
let principal = this.authService.current();
if (!principal) {
this.router.navigate(['/login'], { queryParams: { returnUrl: returnUrl } });
}
else {
this.authService.me().subscribe(
principal => {
if (!principal) this.router.navigate(['/login'], { queryParams: { returnUrl: returnUrl } });
else this.router.navigate(["/"])
},
err => console.error('An error occurred', err));
}
}
}

View File

@ -0,0 +1 @@
{"version":3,"file":"unauthorized.module.js","sourceRoot":"","sources":["unauthorized.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAmBtD,IAAa,kBAAkB;IAA/B;IAAkC,CAAC;IAAD,yBAAC;AAAD,CAAC,AAAnC,IAAmC;AAAtB,kBAAkB;IAlB9B,QAAQ,CAAC;QACN,OAAO,EAAE;YACL,YAAY;YACZ,WAAW;YACX,gBAAgB;YAChB,kBAAkB;YAClB,YAAY;SACf;QAED,YAAY,EAAE;YACV,qBAAqB;SACxB;QAED,OAAO,EAAE;YACL,qBAAqB;SACxB;KACJ,CAAC;GAEW,kBAAkB,CAAI;SAAtB,kBAAkB"}

View File

@ -0,0 +1,29 @@
import { CommonModule } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { UnauthorizedComponent } from './unauthorized.component';
import { UnauthorizedRoutes } from './unauthorized.routes';
//import { SharedModule } from '../shared/shared.module'
@NgModule({
imports: [
CommonModule,
FormsModule,
HttpClientModule,
UnauthorizedRoutes
// SharedModule
],
declarations: [
UnauthorizedComponent
],
exports: [
UnauthorizedComponent
]
})
export class UnauthorizedModule { }

View File

@ -0,0 +1 @@
{"version":3,"file":"unauthorized.routes.js","sourceRoot":"","sources":["unauthorized.routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAU,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,IAAM,MAAM,GAAW;IACnB,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE;CACjD,CAAC;AAEF,MAAM,CAAC,IAAM,kBAAkB,GAAG,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC"}

View File

@ -0,0 +1,9 @@
import { RouterModule, Routes } from '@angular/router';
import { UnauthorizedComponent } from './unauthorized.component';
const routes: Routes = [
{ path: '', component: UnauthorizedComponent }
];
export const UnauthorizedRoutes = RouterModule.forChild(routes);

Some files were not shown because too many files have changed in this diff Show More