no message
This commit is contained in:
parent
376ceb5cb8
commit
3b5b2ee4c6
|
@ -1,60 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
||||||
"project": {
|
|
||||||
"name": "dmp-admin"
|
|
||||||
},
|
|
||||||
"apps": [
|
|
||||||
{
|
|
||||||
"root": "src",
|
|
||||||
"outDir": "dist",
|
|
||||||
"assets": [
|
|
||||||
"assets",
|
|
||||||
"favicon.ico"
|
|
||||||
],
|
|
||||||
"index": "index.html",
|
|
||||||
"main": "main.ts",
|
|
||||||
"polyfills": "polyfills.ts",
|
|
||||||
"test": "test.ts",
|
|
||||||
"tsconfig": "tsconfig.app.json",
|
|
||||||
"testTsconfig": "tsconfig.spec.json",
|
|
||||||
"prefix": "app",
|
|
||||||
"styles": [
|
|
||||||
"styles.css"
|
|
||||||
],
|
|
||||||
"scripts": [],
|
|
||||||
"environmentSource": "environments/environment.ts",
|
|
||||||
"environments": {
|
|
||||||
"dev": "environments/environment.ts",
|
|
||||||
"prod": "environments/environment.prod.ts"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"e2e": {
|
|
||||||
"protractor": {
|
|
||||||
"config": "./protractor.conf.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lint": [
|
|
||||||
{
|
|
||||||
"project": "src/tsconfig.app.json",
|
|
||||||
"exclude": "**/node_modules/**"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"project": "src/tsconfig.spec.json",
|
|
||||||
"exclude": "**/node_modules/**"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"project": "e2e/tsconfig.e2e.json",
|
|
||||||
"exclude": "**/node_modules/**"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"test": {
|
|
||||||
"karma": {
|
|
||||||
"config": "./karma.conf.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaults": {
|
|
||||||
"styleExt": "css",
|
|
||||||
"component": {}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
# Editor configuration, see http://editorconfig.org
|
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
|
|
||||||
[*.md]
|
|
||||||
max_line_length = off
|
|
||||||
trim_trailing_whitespace = false
|
|
|
@ -1,43 +0,0 @@
|
||||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# compiled output
|
|
||||||
/dist
|
|
||||||
/tmp
|
|
||||||
/out-tsc
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
/node_modules
|
|
||||||
|
|
||||||
# IDEs and editors
|
|
||||||
/.idea
|
|
||||||
.project
|
|
||||||
.classpath
|
|
||||||
.c9/
|
|
||||||
*.launch
|
|
||||||
.settings/
|
|
||||||
*.sublime-workspace
|
|
||||||
|
|
||||||
# IDE - VSCode
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
|
|
||||||
# misc
|
|
||||||
/.sass-cache
|
|
||||||
/connect.lock
|
|
||||||
/coverage
|
|
||||||
/libpeerconnection.log
|
|
||||||
npm-debug.log
|
|
||||||
testem.log
|
|
||||||
/typings
|
|
||||||
yarn-error.log
|
|
||||||
|
|
||||||
# e2e
|
|
||||||
/e2e/*.js
|
|
||||||
/e2e/*.map
|
|
||||||
|
|
||||||
# System Files
|
|
||||||
.DS_Store
|
|
||||||
Thumbs.db
|
|
|
@ -1,28 +0,0 @@
|
||||||
# DmpAdmin
|
|
||||||
|
|
||||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.3.1.
|
|
||||||
|
|
||||||
## Development server
|
|
||||||
|
|
||||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
|
||||||
|
|
||||||
## Code scaffolding
|
|
||||||
|
|
||||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
|
||||||
|
|
||||||
## Build
|
|
||||||
|
|
||||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
|
|
||||||
|
|
||||||
## Running unit tests
|
|
||||||
|
|
||||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
||||||
|
|
||||||
## Running end-to-end tests
|
|
||||||
|
|
||||||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
|
||||||
Before running the tests make sure you are serving the app via `ng serve`.
|
|
||||||
|
|
||||||
## Further help
|
|
||||||
|
|
||||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
|
|
@ -1,14 +0,0 @@
|
||||||
import { AppPage } from './app.po';
|
|
||||||
|
|
||||||
describe('dmp-admin App', () => {
|
|
||||||
let page: AppPage;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
page = new AppPage();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should display welcome message', () => {
|
|
||||||
page.navigateTo();
|
|
||||||
expect(page.getParagraphText()).toEqual('Welcome to app!');
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,11 +0,0 @@
|
||||||
import { browser, by, element } from 'protractor';
|
|
||||||
|
|
||||||
export class AppPage {
|
|
||||||
navigateTo() {
|
|
||||||
return browser.get('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
getParagraphText() {
|
|
||||||
return element(by.css('app-root h1')).getText();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "../tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "../out-tsc/e2e",
|
|
||||||
"baseUrl": "./",
|
|
||||||
"module": "commonjs",
|
|
||||||
"target": "es5",
|
|
||||||
"types": [
|
|
||||||
"jasmine",
|
|
||||||
"jasminewd2",
|
|
||||||
"node"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
// Karma configuration file, see link for more information
|
|
||||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
||||||
|
|
||||||
module.exports = function (config) {
|
|
||||||
config.set({
|
|
||||||
basePath: '',
|
|
||||||
frameworks: ['jasmine', '@angular/cli'],
|
|
||||||
plugins: [
|
|
||||||
require('karma-jasmine'),
|
|
||||||
require('karma-chrome-launcher'),
|
|
||||||
require('karma-jasmine-html-reporter'),
|
|
||||||
require('karma-coverage-istanbul-reporter'),
|
|
||||||
require('@angular/cli/plugins/karma')
|
|
||||||
],
|
|
||||||
client:{
|
|
||||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
||||||
},
|
|
||||||
coverageIstanbulReporter: {
|
|
||||||
reports: [ 'html', 'lcovonly' ],
|
|
||||||
fixWebpackSourcePaths: true
|
|
||||||
},
|
|
||||||
angularCli: {
|
|
||||||
environment: 'dev'
|
|
||||||
},
|
|
||||||
reporters: ['progress', 'kjhtml'],
|
|
||||||
port: 9876,
|
|
||||||
colors: true,
|
|
||||||
logLevel: config.LOG_INFO,
|
|
||||||
autoWatch: true,
|
|
||||||
browsers: ['Chrome'],
|
|
||||||
singleRun: false
|
|
||||||
});
|
|
||||||
};
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,63 +0,0 @@
|
||||||
{
|
|
||||||
"name": "dmp-admin",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"license": "MIT",
|
|
||||||
"scripts": {
|
|
||||||
"ng": "ng",
|
|
||||||
"start": "ng serve",
|
|
||||||
"build": "ng build",
|
|
||||||
"test": "ng test",
|
|
||||||
"lint": "ng lint",
|
|
||||||
"e2e": "ng e2e"
|
|
||||||
},
|
|
||||||
"private": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@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",
|
|
||||||
"angular2-localstorage": "^0.4.0",
|
|
||||||
"bootstrap": "^3.3.7",
|
|
||||||
"bootstrap-menu": "^1.0.14",
|
|
||||||
"core-js": "^2.4.1",
|
|
||||||
"jquery": "^3.2.1",
|
|
||||||
"ng2-bootstrap-modal": "^1.0.1",
|
|
||||||
"ng2-simple-global": "^1.2.5",
|
|
||||||
"rxjs": "^5.4.2",
|
|
||||||
"zone.js": "^0.8.14",
|
|
||||||
"@ngx-translate/core": "^9.0.1",
|
|
||||||
"@ngx-translate/http-loader": "^2.0.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@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",
|
|
||||||
"@types/node": "~6.0.60",
|
|
||||||
"codelyzer": "~3.1.1",
|
|
||||||
"jasmine-core": "~2.6.2",
|
|
||||||
"jasmine-spec-reporter": "~4.1.0",
|
|
||||||
"karma": "~1.7.0",
|
|
||||||
"karma-chrome-launcher": "~2.1.1",
|
|
||||||
"karma-cli": "~1.0.1",
|
|
||||||
"karma-coverage-istanbul-reporter": "^1.2.1",
|
|
||||||
"karma-jasmine": "~1.1.0",
|
|
||||||
"karma-jasmine-html-reporter": "^0.2.2",
|
|
||||||
"protractor": "~5.1.2",
|
|
||||||
"ts-node": "~3.2.0",
|
|
||||||
"tslint": "~5.3.2",
|
|
||||||
"typescript": "2.4.2"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
// Protractor configuration file, see link for more information
|
|
||||||
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
|
||||||
|
|
||||||
const { SpecReporter } = require('jasmine-spec-reporter');
|
|
||||||
|
|
||||||
exports.config = {
|
|
||||||
allScriptsTimeout: 11000,
|
|
||||||
specs: [
|
|
||||||
'./e2e/**/*.e2e-spec.ts'
|
|
||||||
],
|
|
||||||
capabilities: {
|
|
||||||
'browserName': 'chrome'
|
|
||||||
},
|
|
||||||
directConnect: true,
|
|
||||||
baseUrl: 'http://localhost:4200/',
|
|
||||||
framework: 'jasmine',
|
|
||||||
jasmineNodeOpts: {
|
|
||||||
showColors: true,
|
|
||||||
defaultTimeoutInterval: 30000,
|
|
||||||
print: function() {}
|
|
||||||
},
|
|
||||||
onPrepare() {
|
|
||||||
require('ts-node').register({
|
|
||||||
project: 'e2e/tsconfig.e2e.json'
|
|
||||||
});
|
|
||||||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -1,28 +0,0 @@
|
||||||
.navbar-center {
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
left: 0;
|
|
||||||
text-align: center;
|
|
||||||
vertical-align: middle;
|
|
||||||
margin:0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.invisible {
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.visible {
|
|
||||||
display:block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cursor{
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hide{
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.show {
|
|
||||||
display:block;
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
|
|
||||||
<div>
|
|
||||||
|
|
||||||
|
|
||||||
<nav class="navbar navbar-default">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<!-- Brand and toggle get grouped for better mobile display -->
|
|
||||||
<div class="navbar-header">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
|
||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
|
||||||
<div class="nav navbar-nav">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="navbar-left">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="navbar-center">
|
|
||||||
<h3>Digital Management Plans Backend Administration</h3>
|
|
||||||
</div>
|
|
||||||
<ul class="nav navbar-nav navbar-right">
|
|
||||||
<li class="dropdown" [ngClass]="{true:'invisible'}[loggedInAs == null]">
|
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Quick links <span class="caret"></span></a>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<li><a href="#">Action</a></li>
|
|
||||||
<li><a href="#">Another action</a></li>
|
|
||||||
<li><a href="#">Something else here</a></li>
|
|
||||||
<li role="separator" class="divider"></li>
|
|
||||||
<li><a href="#">Separated link</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li [ngClass]="{false:'invisible'}[tokenService.isLoggedIn() == true]"><a>{{tokenService.getEmail()}}</a></li>
|
|
||||||
<li class="cursor" [ngClass]="{false:'invisible'}[tokenService.isLoggedIn() == true]" (click)="logout()"><a>Logout</a></li>
|
|
||||||
<li class="cursor" [ngClass]="{true:'invisible'}[tokenService.isLoggedIn() == true]" (click)="login()" ><a>Login</a></li>
|
|
||||||
</ul>
|
|
||||||
</div><!-- /.navbar-collapse -->
|
|
||||||
</div><!-- /.container-fluid -->
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<!-- <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> -->
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
|
@ -1,32 +0,0 @@
|
||||||
import { TestBed, async } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
|
||||||
|
|
||||||
describe('AppComponent', () => {
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [
|
|
||||||
AppComponent
|
|
||||||
],
|
|
||||||
}).compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should create the app', async(() => {
|
|
||||||
const fixture = TestBed.createComponent(AppComponent);
|
|
||||||
const app = fixture.debugElement.componentInstance;
|
|
||||||
expect(app).toBeTruthy();
|
|
||||||
}));
|
|
||||||
|
|
||||||
it(`should have as title 'app'`, async(() => {
|
|
||||||
const fixture = TestBed.createComponent(AppComponent);
|
|
||||||
const app = fixture.debugElement.componentInstance;
|
|
||||||
expect(app.title).toEqual('app');
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should render title in a h1 tag', async(() => {
|
|
||||||
const fixture = TestBed.createComponent(AppComponent);
|
|
||||||
fixture.detectChanges();
|
|
||||||
const compiled = fixture.debugElement.nativeElement;
|
|
||||||
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
|
|
||||||
}));
|
|
||||||
});
|
|
|
@ -1,39 +0,0 @@
|
||||||
import { Component } from '@angular/core';
|
|
||||||
import { TokenService, TokenProvider } from './services/login/token.service';
|
|
||||||
import {Router} from '@angular/router';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-root',
|
|
||||||
templateUrl: './app.component.html',
|
|
||||||
styleUrls: ['./app.component.css']
|
|
||||||
})
|
|
||||||
|
|
||||||
export class AppComponent {
|
|
||||||
|
|
||||||
|
|
||||||
constructor(private tokenService : TokenService, private router: Router) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//loggedInAs : string = null;
|
|
||||||
|
|
||||||
showLogin : boolean = false;
|
|
||||||
|
|
||||||
|
|
||||||
login(){
|
|
||||||
//redirect to login page
|
|
||||||
}
|
|
||||||
|
|
||||||
logout(){
|
|
||||||
this.tokenService.logout();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
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'
|
|
||||||
}
|
|
|
@ -1,143 +0,0 @@
|
||||||
// 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';
|
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
||||||
import { HttpModule } from '@angular/http';
|
|
||||||
import { DataTableModule } from "angular2-datatable";
|
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
|
||||||
import { DialogService } from "ng2-bootstrap-modal";
|
|
||||||
import { ReactiveFormsModule } from '@angular/forms';
|
|
||||||
|
|
||||||
import { RestBase } from './services/rest-base';
|
|
||||||
import { TokenService } from './services/login/token.service';
|
|
||||||
import { NativeLoginService } from './services/login/native-login.service';
|
|
||||||
import { DatasetsServiceService } from './services/datasets-service.service';
|
|
||||||
import { DatasetProfileService } from './services/dataset-profile.service';
|
|
||||||
import { DmpsServiceService } from './services/dmps-service.service';
|
|
||||||
import { ProjectService } from './services/project-service';
|
|
||||||
import { ServiceService } from './services/service-service';
|
|
||||||
import { ResearcherService } from './services/researcher-service';
|
|
||||||
import { OrganisationService } from './services/organisation-service';
|
|
||||||
import { DmpProfileService } from './services/dmpprofile-service';
|
|
||||||
import { RegistryService } from './services/registry-service';
|
|
||||||
import { DatarepoService } from './services/datarepo-service';
|
|
||||||
import { GlobalInterceptor } from './services/interceptor';
|
|
||||||
import { Toolbox } from './services/toolbox';
|
|
||||||
|
|
||||||
import { DataFilterPipe } from './pipes/data-filter.pipe';
|
|
||||||
import { DatasetProfileTableFilterPipe } from './pipes/datasetprofile-table-filter.pipe';
|
|
||||||
import { DmpTableFilterPipe } from './pipes/dmp-table-filter.pipe';
|
|
||||||
import { ServiceTableFilterPipe } from './pipes/service-table-filter.pipe';
|
|
||||||
import { DmpProfileTableFilterPipe } from './pipes/dmp-profile-table-filter.pipe';
|
|
||||||
import { ProjectTableFilterPipe } from './pipes/project-table-filter.pipe';
|
|
||||||
import { RegistryTableFilterPipe } from './pipes/registry-table-filter.pipe';
|
|
||||||
import { OrganisationTableFilterPipe } from './pipes/organisation-table-filter.pipe';
|
|
||||||
import { ResearcherTableFilterPipe } from './pipes/researcher-table-filter.pipe';
|
|
||||||
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 { DatasetsViewerComponent } from './datasets-viewer/datasets-viewer.component';
|
|
||||||
import { AppComponent } from './app.component';
|
|
||||||
import { FormsModule } from '@angular/forms';
|
|
||||||
import { ProfileEditorComponent } from './bootstrap/profile-editor/profile-editor.component';
|
|
||||||
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 { MainWindowComponent } from './main-window/main-window.component';
|
|
||||||
import { AppRouting } from './routes';
|
|
||||||
import { DmpProfileEditorComponent } from './managers/dmp-profile-editor/dmp-profile-editor.component';
|
|
||||||
import { DatasetprofileEditorComponent } from './managers/datasetprofile-editor/datasetprofile-editor.component';
|
|
||||||
import { DatasetProfileGUIEditorComponent } from './dataset-profile-gui-editor/dataset-profile-gui-editor.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';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
declarations: [
|
|
||||||
DataFilterPipe,
|
|
||||||
DmpTableFilterPipe,
|
|
||||||
DmpProfileTableFilterPipe,
|
|
||||||
DatasetProfileTableFilterPipe,
|
|
||||||
ProjectTableFilterPipe,
|
|
||||||
OrganisationTableFilterPipe,
|
|
||||||
RegistryTableFilterPipe,
|
|
||||||
ServiceTableFilterPipe,
|
|
||||||
ResearcherTableFilterPipe,
|
|
||||||
DatarepoTableFilterPipe,
|
|
||||||
|
|
||||||
AppComponent,
|
|
||||||
GooggleSignInComponent,
|
|
||||||
// FieldFormComponent,
|
|
||||||
// FormComponent,
|
|
||||||
// GroupFieldFormComponent,
|
|
||||||
// RuleFormComponent,
|
|
||||||
// SectionFormComponent,
|
|
||||||
// PageFormComponent,
|
|
||||||
// CompositeFieldFormComponent,
|
|
||||||
// ComboboxComponent,
|
|
||||||
// AutocompleteComponent,
|
|
||||||
// WordlistComponent,
|
|
||||||
// RadioBoxComponent,
|
|
||||||
DatasetsViewerComponent,
|
|
||||||
ProfileEditorComponent,
|
|
||||||
PropertiesEditorComponent,
|
|
||||||
NewDatasetComponent,
|
|
||||||
ConfirmationComponent,
|
|
||||||
MainWindowComponent,
|
|
||||||
DmpProfileEditorComponent,
|
|
||||||
MainSignInComponent,
|
|
||||||
DatasetprofileEditorComponent,
|
|
||||||
DatasetProfileGUIEditorComponent,
|
|
||||||
// TextAreaComponent,
|
|
||||||
// CheckBoxComponent,
|
|
||||||
// BooleanDecisionComponent,
|
|
||||||
// FreeTextComponent
|
|
||||||
],
|
|
||||||
imports: [
|
|
||||||
BrowserModule,
|
|
||||||
HttpClientModule,
|
|
||||||
HttpModule,
|
|
||||||
DataTableModule,
|
|
||||||
FormsModule,
|
|
||||||
ReactiveFormsModule,
|
|
||||||
NgbModule.forRoot(),
|
|
||||||
AppRouting
|
|
||||||
],
|
|
||||||
providers: [AuthService,
|
|
||||||
{
|
|
||||||
provide: HTTP_INTERCEPTORS,
|
|
||||||
useClass: GlobalInterceptor,
|
|
||||||
multi: true,
|
|
||||||
},
|
|
||||||
DatasetsServiceService, TokenService, DmpsServiceService, ResearcherService,
|
|
||||||
DialogService, DatasetProfileService, ProjectService, OrganisationService, DatarepoService,
|
|
||||||
DmpProfileService, RegistryService, ServiceService, NativeLoginService, HttpModule, Toolbox, HttpClient, RestBase],
|
|
||||||
bootstrap: [AppComponent]
|
|
||||||
})
|
|
||||||
export class AppModule { }
|
|
|
@ -1,11 +0,0 @@
|
||||||
.modal-header {
|
|
||||||
padding:9px 15px;
|
|
||||||
border-bottom:1px solid #eee;
|
|
||||||
background-color: #0480be;
|
|
||||||
-webkit-border-top-left-radius: 5px;
|
|
||||||
-webkit-border-top-right-radius: 5px;
|
|
||||||
-moz-border-radius-topleft: 5px;
|
|
||||||
-moz-border-radius-topright: 5px;
|
|
||||||
border-top-left-radius: 5px;
|
|
||||||
border-top-right-radius: 5px;
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
<!-- Modal -->
|
|
||||||
<div class="modal fade" id="confirmation-modal" role="dialog">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
|
|
||||||
<!-- Modal content-->
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
||||||
<h4 class="modal-title">{{confirmationTitle}}</h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<p>{{confirmationDescr}}</p>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal" (click)=saidYes()>Yes</button>
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal" (click)=saidNo()>NO</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { ConfirmationComponent } from './confirmation.component';
|
|
||||||
|
|
||||||
describe('ConfirmationComponent', () => {
|
|
||||||
let component: ConfirmationComponent;
|
|
||||||
let fixture: ComponentFixture<ConfirmationComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ ConfirmationComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(ConfirmationComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,34 +0,0 @@
|
||||||
import { Component, OnInit, Input,Output,EventEmitter } from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'confirmation',
|
|
||||||
templateUrl: './confirmation.component.html',
|
|
||||||
styleUrls: ['./confirmation.component.css']
|
|
||||||
})
|
|
||||||
export class ConfirmationComponent implements OnInit {
|
|
||||||
|
|
||||||
@Input() confirmationTitle : string;
|
|
||||||
@Input() confirmationDescr : string;
|
|
||||||
@Input() subjectObj : any;
|
|
||||||
|
|
||||||
@Output() responseSender: EventEmitter<any> = new EventEmitter<any>();
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
saidNo(){
|
|
||||||
this.responseSender.emit(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
saidYes(){
|
|
||||||
this.responseSender.emit(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
.form-control {
|
|
||||||
width: 540px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-control.props{
|
|
||||||
height: 240px;
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
<!-- Modal -->
|
|
||||||
<div class="modal fade" id="newdataset-modal-container" role="dialog">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
|
|
||||||
<!-- Modal content-->
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
||||||
<h4 class="modal-title"> Create a new dataset</h4>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-body">
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
|
|
||||||
<form [formGroup]="newdatasetform" novalidate>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="center-block">Label:
|
|
||||||
<input class="form-control" formControlName="label">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="center-block">DMP:
|
|
||||||
<input class="form-control" formControlName="dmp">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="center-block">Uri:
|
|
||||||
<input class="form-control" formControlName="uri">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="center-block">Properties:
|
|
||||||
<textarea class="form-control props" formControlName="properties"></textarea>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="center-block">Profile:
|
|
||||||
<input class="form-control" formControlName="profile">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div style="width:540px;">
|
|
||||||
<button style="float:right;" type="submit" class="btn btn-success" (click)="store()">Submit</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<p>Form value: {{ newdatasetform.value | json }}</p>
|
|
||||||
-->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { NewDatasetComponent } from './new-dataset.component';
|
|
||||||
|
|
||||||
describe('NewDatasetComponent', () => {
|
|
||||||
let component: NewDatasetComponent;
|
|
||||||
let fixture: ComponentFixture<NewDatasetComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ NewDatasetComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(NewDatasetComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,53 +0,0 @@
|
||||||
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
|
|
||||||
import { ReactiveFormsModule } from '@angular/forms';
|
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
||||||
import { DatasetsServiceService } from '../../services/datasets-service.service';
|
|
||||||
|
|
||||||
declare var jQuery:any;
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'new-dataset',
|
|
||||||
templateUrl: './new-dataset.component.html',
|
|
||||||
styleUrls: ['./new-dataset.component.css']
|
|
||||||
})
|
|
||||||
export class NewDatasetComponent implements OnInit {
|
|
||||||
|
|
||||||
|
|
||||||
newdatasetform: FormGroup;
|
|
||||||
|
|
||||||
@Output() idSender: EventEmitter<any> = new EventEmitter<any>();
|
|
||||||
|
|
||||||
constructor(private datasetsService : DatasetsServiceService, private fb: FormBuilder) {
|
|
||||||
|
|
||||||
this.newdatasetform = this.fb.group({
|
|
||||||
label: ['', Validators.required ],
|
|
||||||
dmp: '',
|
|
||||||
uri: '',
|
|
||||||
properties: '',
|
|
||||||
profile: ''
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
|
|
||||||
//minimum dataset -> {"label": ""}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
store(){
|
|
||||||
for(var key in this.newdatasetform.value) {
|
|
||||||
if(this.newdatasetform.value[key]=="")
|
|
||||||
this.newdatasetform.value[key] = null;
|
|
||||||
}
|
|
||||||
this.datasetsService.setDataset(this.newdatasetform.value).subscribe(
|
|
||||||
(data) => {
|
|
||||||
jQuery("#newdataset-modal-container").modal("hide");
|
|
||||||
this.idSender.emit(data.json().objID);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
.margin10{
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
margin-right: 10px;
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* The ones below are for fields*/
|
|
||||||
.custom-table {
|
|
||||||
display: table; }
|
|
||||||
|
|
||||||
label {
|
|
||||||
display: table-header-group;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
display: table-row-group;
|
|
||||||
}
|
|
||||||
|
|
||||||
input:focus + label {
|
|
||||||
color:black;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
<div>
|
|
||||||
<!--{{profile| json}}-->
|
|
||||||
<div class="panel panel-default margin10">
|
|
||||||
<div class="panel-heading"><h4>Editing profile: {{profileID}}</h4></div>
|
|
||||||
<div class="panel-body">
|
|
||||||
|
|
||||||
<ul class="nav nav-tabs content-tabs" id="maincontent" role="tablist">
|
|
||||||
<li class="active"><a href="#profile" role="tab" data-toggle="tab">Profile</a></li>
|
|
||||||
<li class=""><a href="#viewstyle" role="tab" data-toggle="tab">Profile's viewstyle</a></li>
|
|
||||||
<li class=""><a href="#ruleset" role="tab" data-toggle="tab">Profile's ruleset</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="tab-content">
|
|
||||||
|
|
||||||
<div class="tab-pane fade active in" id="profile">
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<input name="profile-label" type="text" placeholder="Enter profile label" [(ngModel)]="profile.label" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOut($event)" (keydown)="preventDefaults($event)">
|
|
||||||
<label for="profile-label">Label</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<textarea class="form-control custom" rows="10" cols="65" name="profile-definition" [(ngModel)]="profile.definition" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOut($event)" (keydown)="preventDefaults($event)" placeholder="Enter profile definition"></textarea>
|
|
||||||
<label for="profile-definition">Definition</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-pane fade" id="viewstyle">
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<input name="viewstyle-label" type="text" placeholder="Enter viewstyle label" [(ngModel)]="profile.viewstyle.label" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOut($event)" (keydown)="preventDefaults($event)">
|
|
||||||
<label for="viewstyle-label">Label</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<textarea class="form-control custom" rows="10" cols="65" name="viewstyle-definition" [(ngModel)]="profile.viewstyle.definition" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOut($event)" (keydown)="preventDefaults($event)"></textarea>
|
|
||||||
<label for="viewstyle-definition">Definition</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-pane fade" id="ruleset">
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<input name="ruleset-label" type="text" placeholder="Enter ruleset label" [(ngModel)]="profile.ruleset.label" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOut($event)" (keydown)="preventDefaults($event)">
|
|
||||||
<label for="ruleset-label">Label</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<textarea class="form-control custom" rows="10" cols="65" name="ruleset-definition" [(ngModel)]="profile.ruleset.definition" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOut($event)" (keydown)="preventDefaults($event)"></textarea>
|
|
||||||
<label for="ruleset-definition">Definition</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { ProfileEditorComponent } from './profile-editor.component';
|
|
||||||
|
|
||||||
describe('ProfileEditorComponent', () => {
|
|
||||||
let component: ProfileEditorComponent;
|
|
||||||
let fixture: ComponentFixture<ProfileEditorComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ ProfileEditorComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(ProfileEditorComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,93 +0,0 @@
|
||||||
import { Component, OnInit, SimpleChanges, Input} from '@angular/core';
|
|
||||||
import {DatasetProfileService} from '../../services/dataset-profile.service';
|
|
||||||
import {ActivatedRoute} from '@angular/router';
|
|
||||||
|
|
||||||
import '../../../assets/custom.js';
|
|
||||||
declare function simple_notifier(type: string, title: string, message:string): any;
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'profile-editor',
|
|
||||||
templateUrl: './profile-editor.component.html',
|
|
||||||
styleUrls: ['./profile-editor.component.css']
|
|
||||||
})
|
|
||||||
export class ProfileEditorComponent implements OnInit {
|
|
||||||
|
|
||||||
public profileID: string = null;
|
|
||||||
|
|
||||||
profile : any = new Array();
|
|
||||||
|
|
||||||
//for update sensing...
|
|
||||||
private haveChanges : boolean = false;
|
|
||||||
|
|
||||||
constructor(private datasetProfileService: DatasetProfileService, private route: ActivatedRoute) {
|
|
||||||
this.profileID = route.snapshot.params['profileID'];
|
|
||||||
//console.log(route.snapshot.params['profileID'])
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
|
||||||
/*
|
|
||||||
if(this.profileID==null)
|
|
||||||
return;
|
|
||||||
if(changes.profileID != null){
|
|
||||||
this.datasetProfileService.getDatasetProfileById(this.profileID).subscribe((data) => {
|
|
||||||
this.profile = data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
this.datasetProfileService.getDatasetProfileById(this.profileID).subscribe((data) => {
|
|
||||||
this.profile = data;
|
|
||||||
//console.log(data)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onFocusIn($event){
|
|
||||||
console.log("on-focus-in");
|
|
||||||
this.haveChanges = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
onValueChanged($event){
|
|
||||||
console.log("on-text-changed");
|
|
||||||
this.haveChanges = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
onFocusOut($event, value:string){
|
|
||||||
console.log("on-focus-out");
|
|
||||||
if(this.haveChanges){
|
|
||||||
var fieldName = $event.target.name;
|
|
||||||
this.datasetProfileService.getDatasetProfileById(this.profileID).subscribe((data) => {
|
|
||||||
var database_profile : any = data;
|
|
||||||
//update appropriate field
|
|
||||||
if(fieldName == 'profile-label') database_profile.label = this.profile.label;
|
|
||||||
if(fieldName == 'profile-definition') database_profile.definition = this.profile.definition;
|
|
||||||
if(fieldName == 'viewstyle-label') database_profile.viewstyle.label = this.profile.viewstyle.label;
|
|
||||||
if(fieldName == 'viewstyle-definition') database_profile.viewstyle.definition = this.profile.viewstyle.definition;
|
|
||||||
if(fieldName == 'ruleset-label') database_profile.ruleset.label = this.profile.ruleset.label;
|
|
||||||
if(fieldName == 'ruleset-definition') database_profile.ruleset.definition = this.profile.ruleset.definition;
|
|
||||||
//save back
|
|
||||||
this.datasetProfileService.updateDatasetProfile(database_profile);
|
|
||||||
simple_notifier("success",null,"Updated value of field");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
preventDefaults($event){
|
|
||||||
if($event.code == 'Tab') {
|
|
||||||
$event.preventDefault();
|
|
||||||
//AND NOW HACK THE TAB KEY WITHIN THE TEXT EDITOR
|
|
||||||
var start = $event.srcElement.selectionStart;
|
|
||||||
var end = $event.srcElement.selectionEnd;
|
|
||||||
// set textarea value to: text before caret + tab + text after caret
|
|
||||||
$event.target.value = $event.target.value.substring(0, start)+"\t"+$event.target.value.substring(end);
|
|
||||||
// put caret at right position again
|
|
||||||
$event.srcElement.selectionStart =
|
|
||||||
$event.srcElement.selectionEnd = start + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
textarea.custom{
|
|
||||||
border-style: dotted;
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
|
|
||||||
<!-- Modal -->
|
|
||||||
<div class="modal fade" id="edit-properties-modal-container" role="dialog">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
|
|
||||||
<!-- Modal content-->
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
||||||
<h4 class="modal-title"> Edit properties data of {{datasetID}}</h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<textarea class="form-control custom" rows="10" cols="65" [(ngModel)]="propstext" (focusin)="onFocusIn($event)" (ngModelChange)="onTextChanged($event)" (focusout)="onFocusOut($event)" (keydown)="preventDefaults($event)">
|
|
||||||
</textarea>
|
|
||||||
</div>
|
|
||||||
<!--
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { PropertiesEditorComponent } from './properties-editor.component';
|
|
||||||
|
|
||||||
describe('PropertiesEditorComponent', () => {
|
|
||||||
let component: PropertiesEditorComponent;
|
|
||||||
let fixture: ComponentFixture<PropertiesEditorComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ PropertiesEditorComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(PropertiesEditorComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,82 +0,0 @@
|
||||||
import { Component, OnInit, Input, SimpleChanges } from '@angular/core';
|
|
||||||
import { DatasetsServiceService } from '../../services/datasets-service.service';
|
|
||||||
|
|
||||||
import '../../../assets/custom.js';
|
|
||||||
declare function simple_notifier(type: string, title: string, message:string): any;
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'properties-editor',
|
|
||||||
templateUrl: './properties-editor.component.html',
|
|
||||||
styleUrls: ['./properties-editor.component.css']
|
|
||||||
})
|
|
||||||
export class PropertiesEditorComponent implements OnInit {
|
|
||||||
|
|
||||||
@Input('datasetID') datasetID : string;
|
|
||||||
private propstext : string;
|
|
||||||
|
|
||||||
//for update sensing...
|
|
||||||
private haveChanges : boolean = false;
|
|
||||||
|
|
||||||
|
|
||||||
constructor(private datasetsService : DatasetsServiceService) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
|
||||||
|
|
||||||
if(this.datasetID==null)
|
|
||||||
return;
|
|
||||||
if(changes.datasetID != null){
|
|
||||||
this.datasetsService.getDatasetById(this.datasetID).subscribe((data) => {
|
|
||||||
this.propstext = data.properties;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
onFocusIn($event){
|
|
||||||
this.haveChanges = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
onTextChanged($event){
|
|
||||||
this.haveChanges = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
onFocusOut($event){
|
|
||||||
if(this.haveChanges){
|
|
||||||
//console.log("Updating the value of properties to: "+$event.target.value+" on row with id: "+this.datasetID);
|
|
||||||
this.datasetsService.getDatasetById(this.datasetID).subscribe( (data) => {
|
|
||||||
data.properties = $event.target.value;
|
|
||||||
this.datasetsService.setDataset(data).subscribe( (data) => {
|
|
||||||
if(data.status == 201){
|
|
||||||
simple_notifier("success",null,"Updated value of properties field");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
simple_notifier("danger",null,"Could not update value of properties field");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
preventDefaults($event){
|
|
||||||
if($event.code == 'Tab') {
|
|
||||||
$event.preventDefault();
|
|
||||||
//AND NOW HACK THE TAB KEY WITHIN THE TEXT EDITOR
|
|
||||||
var start = $event.srcElement.selectionStart;
|
|
||||||
var end = $event.srcElement.selectionEnd;
|
|
||||||
// set textarea value to: text before caret + tab + text after caret
|
|
||||||
$event.target.value = $event.target.value.substring(0, start)+"\t"+$event.target.value.substring(end);
|
|
||||||
// put caret at right position again
|
|
||||||
$event.srcElement.selectionStart =
|
|
||||||
$event.srcElement.selectionEnd = start + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
export enum ValidationTypes {
|
|
||||||
None = 0,
|
|
||||||
Required = 1
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
<div [formGroup]="form">
|
|
||||||
<div formGroupName="data" class="form-row">
|
|
||||||
<div class="form-group col-md-12" >
|
|
||||||
<label>Label</label>
|
|
||||||
<input type="string" class="form-control" formControlName="label">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12" >
|
|
||||||
<label>Url</label>
|
|
||||||
<input type="string" class="form-control" formControlName="url">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
|
@ -1,23 +0,0 @@
|
||||||
import { AutocompleteData } from '../../models/DataField/AutocompleteData';
|
|
||||||
import { Field } from '../../models/DataSetProfile/Field';
|
|
||||||
import { FormGroup } from '@angular/forms';
|
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
|
||||||
import { FormArray } from '@angular/forms/src/model';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'autocomplete-component',
|
|
||||||
templateUrl: './autocomplete-component.html'
|
|
||||||
})
|
|
||||||
export class AutocompleteComponent implements OnInit{
|
|
||||||
@Input() dataModel: Field;
|
|
||||||
@Input() form: FormGroup;
|
|
||||||
private data:AutocompleteData = new AutocompleteData();
|
|
||||||
|
|
||||||
ngOnInit(){
|
|
||||||
this.data.type= "autocomplete";
|
|
||||||
let autocomplete: AutocompleteData = new AutocompleteData();
|
|
||||||
//this.dataModel.data = new JsonSerializer<AutocompleteData>().fromJSONObject(this.data,AutocompleteData);
|
|
||||||
//(<FormArray>this.form.get("data")).push(autocomplete.buildForm());
|
|
||||||
this.form.addControl("data", this.data.buildForm());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
<div [formGroup]="form">
|
|
||||||
<div formGroupName="data" class="form-row">
|
|
||||||
<div class="form-group col-md-12" >
|
|
||||||
<label>Label</label>
|
|
||||||
<input type="string" class="form-control" formControlName="label">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
|
@ -1,19 +0,0 @@
|
||||||
import { Field } from '../../models/DataSetProfile/Field';
|
|
||||||
import { BooleanDecisionData } from '../../models/DataField/BooleanDecisionData';
|
|
||||||
import { FormGroup } from '@angular/forms';
|
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
|
||||||
import { FormArray } from '@angular/forms/src/model';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'booleanDecision-component',
|
|
||||||
templateUrl: './booleanDecision-component.html'
|
|
||||||
})
|
|
||||||
export class BooleanDecisionComponent implements OnInit{
|
|
||||||
@Input() dataModel: Field;
|
|
||||||
@Input() form: FormGroup;
|
|
||||||
private data:BooleanDecisionData = new BooleanDecisionData();
|
|
||||||
|
|
||||||
ngOnInit(){
|
|
||||||
this.form.addControl("data", this.data.buildForm());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
<div [formGroup]="form">
|
|
||||||
<div formGroupName="data" class="form-row">
|
|
||||||
<div class="form-group col-md-12" >
|
|
||||||
<label>Label</label>
|
|
||||||
<input type="string" class="form-control" formControlName="label">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
|
@ -1,20 +0,0 @@
|
||||||
import { Field } from '../../models/DataSetProfile/Field';
|
|
||||||
import { CheckBoxData } from '../../models/DataField/CheckBoxData';
|
|
||||||
import { BooleanDecisionData } from '../../models/DataField/BooleanDecisionData';
|
|
||||||
import { FormGroup } from '@angular/forms';
|
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
|
||||||
import { FormArray } from '@angular/forms/src/model';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'checkbox-component',
|
|
||||||
templateUrl: './checkbox-component.html'
|
|
||||||
})
|
|
||||||
export class CheckBoxComponent implements OnInit{
|
|
||||||
@Input() dataModel: Field;
|
|
||||||
@Input() form: FormGroup;
|
|
||||||
private data:CheckBoxData = new CheckBoxData();
|
|
||||||
|
|
||||||
ngOnInit(){
|
|
||||||
this.form.addControl("data", this.data.buildForm());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label>Type of Combobox</label>
|
|
||||||
<select class="form-control" [(ngModel)]="type" (change)= "onchangeCombo($event)">
|
|
||||||
<option *ngFor="let option of options" [value]="option.value">{{option.value}}</option>
|
|
||||||
</select>
|
|
||||||
<div class="form-row" [ngSwitch]="type">
|
|
||||||
<div *ngSwitchCase="'autocomplete'">
|
|
||||||
<autocomplete-component [form]="form" [dataModel]="dataModel"></autocomplete-component>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-row" [ngSwitch]="type">
|
|
||||||
<div *ngSwitchCase="'wordlist'">
|
|
||||||
<wordlist-component [form]="form" [dataModel]="dataModel"></wordlist-component>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { Field } from '../../models/DataSetProfile/Field';
|
|
||||||
import { FormGroup } from '@angular/forms';
|
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'combobox-component',
|
|
||||||
templateUrl: './combobox-component.html'
|
|
||||||
})
|
|
||||||
export class ComboboxComponent implements OnInit{
|
|
||||||
@Input() dataModel: Field;
|
|
||||||
@Input() form: FormGroup;
|
|
||||||
type: string;
|
|
||||||
options = [{id:"autocomplete", value: "autocomplete"}, {id:"wordlist", value: "wordlist"}];
|
|
||||||
|
|
||||||
ngOnInit(){
|
|
||||||
if (this.dataModel.data && this.form.get("data")){
|
|
||||||
this.type = this.form.get("data").get("type").value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
onchangeCombo(){
|
|
||||||
if (this.form.get("data")) this.form.removeControl("data");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
<div [formGroup]="form">
|
|
||||||
<div formGroupName="data" class="form-row">
|
|
||||||
<div class="form-group col-md-12" >
|
|
||||||
<label>Label</label>
|
|
||||||
<input type="string" class="form-control" formControlName="label">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
|
@ -1,21 +0,0 @@
|
||||||
import { Field } from '../../models/DataSetProfile/Field';
|
|
||||||
import { FreeTextData } from '../../models/DataField/FreeTextData';
|
|
||||||
import { CheckBoxData } from '../../models/DataField/CheckBoxData';
|
|
||||||
import { BooleanDecisionData } from '../../models/DataField/BooleanDecisionData';
|
|
||||||
import { FormGroup } from '@angular/forms';
|
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
|
||||||
import { FormArray } from '@angular/forms/src/model';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'freetext-component',
|
|
||||||
templateUrl: './freetext-component.html'
|
|
||||||
})
|
|
||||||
export class FreeTextComponent implements OnInit{
|
|
||||||
@Input() dataModel: Field;
|
|
||||||
@Input() form: FormGroup;
|
|
||||||
private data:FreeTextData = new FreeTextData();
|
|
||||||
|
|
||||||
ngOnInit(){
|
|
||||||
this.form.addControl("data", this.data.buildForm());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
<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 formArrayName="options">
|
|
||||||
<div *ngFor="let option of form.get('data').get('options').controls index as i">
|
|
||||||
<div [formGroupName]="i">
|
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<label>Label</label>
|
|
||||||
<input type="text" class="form-control" formControlName="label">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<label>Value</label>
|
|
||||||
<input type="text" class="form-control" formControlName="value">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<a (click)="addNewRow(form)" style="cursor: pointer">
|
|
||||||
Add +
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
|
@ -1,33 +0,0 @@
|
||||||
import { FormGroup } from '@angular/forms';
|
|
||||||
import { Field } from '../../models/DataSetProfile/Field';
|
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
|
||||||
import { RadioBoxData } from '../../models/DataField/RadioBoxData';
|
|
||||||
import { FormArray } from '@angular/forms/src/model';
|
|
||||||
import { ListingItem } from '../../models/Commons/ListingItem';
|
|
||||||
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'radiobox-component',
|
|
||||||
templateUrl: './radiobox-component.html'
|
|
||||||
})
|
|
||||||
export class RadioBoxComponent implements OnInit{
|
|
||||||
@Input() dataModel: Field;
|
|
||||||
@Input() form: FormGroup;
|
|
||||||
private data: RadioBoxData = new RadioBoxData();
|
|
||||||
private options = new Array<ListingItem>();
|
|
||||||
|
|
||||||
ngOnInit(){
|
|
||||||
//if (this.form.get("data")) this.form.removeControl("data");
|
|
||||||
if (!this.form.get("data"))
|
|
||||||
this.form.addControl("data", this.data.buildForm());
|
|
||||||
if(!this.dataModel.data) this.addNewRow();
|
|
||||||
}
|
|
||||||
|
|
||||||
addNewRow(){
|
|
||||||
let radioListOptions:ListingItem = new ListingItem();
|
|
||||||
(<FormArray>this.form.get("data").get("options")).push(radioListOptions.buildForm());
|
|
||||||
this.data.options = [];
|
|
||||||
this.data.options.push(radioListOptions);
|
|
||||||
this.dataModel.data = JsonSerializer.fromJSONObject(this.data,RadioBoxData);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
<div [formGroup]="form">
|
|
||||||
<div formGroupName="data" class="form-row">
|
|
||||||
<div class="form-group col-md-12" >
|
|
||||||
<label>Label</label>
|
|
||||||
<input type="string" class="form-control" formControlName="label">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
|
@ -1,22 +0,0 @@
|
||||||
import { Field } from '../../models/DataSetProfile/Field';
|
|
||||||
import { TextArea } from '../../models/DataField/TextArea';
|
|
||||||
import { FreeTextData } from '../../models/DataField/FreeTextData';
|
|
||||||
import { CheckBoxData } from '../../models/DataField/CheckBoxData';
|
|
||||||
import { BooleanDecisionData } from '../../models/DataField/BooleanDecisionData';
|
|
||||||
import { FormGroup } from '@angular/forms';
|
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
|
||||||
import { FormArray } from '@angular/forms/src/model';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'textarea-component',
|
|
||||||
templateUrl: './textarea-component.html'
|
|
||||||
})
|
|
||||||
export class TextAreaComponent implements OnInit{
|
|
||||||
@Input() dataModel: Field;
|
|
||||||
@Input() form: FormGroup;
|
|
||||||
private data:TextArea = new TextArea();
|
|
||||||
|
|
||||||
ngOnInit(){
|
|
||||||
this.form.addControl("data", this.data.buildForm());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
<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 formArrayName="options">
|
|
||||||
<div *ngFor="let option of form.get('data').get('options').controls index as i">
|
|
||||||
<div [formGroupName]="i">
|
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<label>Label</label>
|
|
||||||
<input type="text" class="form-control" formControlName="label">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<label>Value</label>
|
|
||||||
<input type="text" class="form-control" formControlName="value">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<a (click)="addNewRow(form)" style="cursor: pointer">
|
|
||||||
Add +
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
|
@ -1,34 +0,0 @@
|
||||||
import { FormGroup } from '@angular/forms';
|
|
||||||
import { Field } from '../../models/DataSetProfile/Field';
|
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
|
||||||
import { WordListData } from '../../models/DataField/WordListData';
|
|
||||||
import { FormArray } from '@angular/forms/src/model';
|
|
||||||
import { ListingItem } from '../../models/Commons/ListingItem';
|
|
||||||
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'wordlist-component',
|
|
||||||
templateUrl: './wordlist-component.html'
|
|
||||||
})
|
|
||||||
export class WordlistComponent implements OnInit{
|
|
||||||
@Input() dataModel: Field;
|
|
||||||
@Input() form: FormGroup;
|
|
||||||
private data: WordListData = new WordListData();
|
|
||||||
private options = new Array<ListingItem>();
|
|
||||||
|
|
||||||
ngOnInit(){
|
|
||||||
this.data.type = "wordlist";
|
|
||||||
// if (this.form.get("data")) this.form.removeControl("data");
|
|
||||||
this.form.addControl("data", this.data.buildForm());
|
|
||||||
if(!this.dataModel.data)
|
|
||||||
this.addNewRow();
|
|
||||||
}
|
|
||||||
|
|
||||||
addNewRow(){
|
|
||||||
let wordListOptions:ListingItem = new ListingItem();
|
|
||||||
(<FormArray>this.form.get("data").get("options")).push(wordListOptions.buildForm());
|
|
||||||
this.data.options = [];
|
|
||||||
this.data.options.push(wordListOptions);
|
|
||||||
this.dataModel.data = JsonSerializer.fromJSONObject(this.data,WordListData);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
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: [
|
|
||||||
]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
export class Criteria {
|
|
||||||
public Like: string;
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
import { Criteria } from './Criteria';
|
|
||||||
import { Principal } from '../../models/login/Principal';
|
|
||||||
|
|
||||||
export class UserCriteria extends Criteria {
|
|
||||||
public Label: String;
|
|
||||||
public Roles: Principal.AppRole[];
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
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 });
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,83 +0,0 @@
|
||||||
<div>
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" [(ngModel)]="isComposite" (ngModelChange)="onIsCompositeChange(isComposite)" /> Composite Field</label>
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" [(ngModel)]="isMultiplicityEnabled" (ngModelChange)="onIsMultiplicityEnabledChange(isMultiplicityEnabled)"
|
|
||||||
/> Multiplicity</label>
|
|
||||||
<div [formGroup]="form">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" formControlName="hasCommentField" /> Comment</label>
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<label>FieldSet Label</label>
|
|
||||||
<input data-toggle="tooltip" title="tooltip on second input!" type="text" class="form-control" formControlName="title">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-4">
|
|
||||||
<label>Description</label>
|
|
||||||
<input type="text" class="form-control" formControlName="description">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-4">
|
|
||||||
<label>ExtendedDescription</label>
|
|
||||||
<input type="text" class="form-control" formControlName="extendedDescription">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="isMultiplicityEnabled" formGroupName="multiplicity">
|
|
||||||
<div>
|
|
||||||
<h5 style="margin-left:15px; font-weight:bold;">Multiplicity</h5>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<label>Min</label>
|
|
||||||
<input type="number" class="form-control" formControlName="min">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-2">
|
|
||||||
<label>Max</label>
|
|
||||||
<input type="number" class="form-control" formControlName="max">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="isComposite" class="col-md-4">
|
|
||||||
<label>Ordinal</label>
|
|
||||||
<input type="number" class="form-control" formControlName="ordinal">
|
|
||||||
</div>
|
|
||||||
<div *ngIf="isComposite" class="col-md-4">
|
|
||||||
<label>Id</label>
|
|
||||||
<input type="string" class="form-control" formControlName="id">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<field-form *ngIf="!isComposite" [form]="form.get('fields').get(''+0)" [dataModel]="dataModel.fields[0]" [showMultiplicity]="false"
|
|
||||||
[indexPath]="indexPath + 'f' + 0"></field-form>
|
|
||||||
|
|
||||||
<div *ngIf="isComposite" class="panel-group" style="margin-top:10px;">
|
|
||||||
<div *ngFor="let field of dataModel.fields let i=index;" class="panel panel-default">
|
|
||||||
<div class="panel-heading clearfix">
|
|
||||||
<a *ngIf="form.get('fields').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 'f' + i}}" class="panel-title pull-left"
|
|
||||||
style="padding-top: 7.5px;">{{i + 1}}. {{form.get('fields').get(''+i).get('title').value}}</a>
|
|
||||||
<a *ngIf="!form.get('fields').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 'f' + i}}" class="panel-title pull-left"
|
|
||||||
style="padding-top: 7.5px;">{{i + 1}}. Child Field {{i + 1}}</a>
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteField(i);">
|
|
||||||
<span class="glyphicon glyphicon-erase"></span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="{{indexPath + 'f' + i}}" class="panel-collapse collapse in">
|
|
||||||
<div class="panel-body">
|
|
||||||
<field-form [form]="form.get('fields').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'f' + i"></field-form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div *ngIf="isComposite">
|
|
||||||
<a (click)="addNewField()" style="cursor: pointer">
|
|
||||||
Add Child Field +
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
|
@ -1,57 +0,0 @@
|
||||||
import { Component, Input } from '@angular/core';
|
|
||||||
import { FormGroup } from '@angular/forms';
|
|
||||||
import { FieldSet } from 'app/models/DataSetProfile/FieldSet';
|
|
||||||
import { Field } from 'app/models/DataSetProfile/Field';
|
|
||||||
import { FormArray, FormControl } from '@angular/forms/src/model';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'compositefield-form',
|
|
||||||
templateUrl: './compositefield-form.component.html',
|
|
||||||
styleUrls: []
|
|
||||||
})
|
|
||||||
|
|
||||||
export class CompositeFieldFormComponent {
|
|
||||||
@Input() form: FormGroup;
|
|
||||||
@Input() dataModel: FieldSet;
|
|
||||||
@Input() indexPath: string;
|
|
||||||
|
|
||||||
isComposite: boolean = false;
|
|
||||||
isMultiplicityEnabled: boolean = false;
|
|
||||||
|
|
||||||
constructon() { }
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
//this.addNewField();
|
|
||||||
if(this.form.get("multiplicity"))
|
|
||||||
if (this.form.get("multiplicity").value.min >1 || this.form.get("multiplicity").value.max >1 )
|
|
||||||
this.isMultiplicityEnabled= true;
|
|
||||||
this.isComposite = this.dataModel.fields.length > 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
onIsCompositeChange(isComposite: boolean) {
|
|
||||||
if (!isComposite && (<FormArray>this.form.get("fields")).length > 1) {
|
|
||||||
for(let i = 0; i < (<FormArray>this.form.get("fields")).length - 1; i++) {
|
|
||||||
(<FormArray>this.form.get("fields")).removeAt(1);
|
|
||||||
}
|
|
||||||
this.dataModel.fields.splice(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {
|
|
||||||
if (!isMultiplicityEnabled) {
|
|
||||||
(<FormControl>this.form.get('multiplicity').get("min")).setValue(0);
|
|
||||||
(<FormControl>this.form.get('multiplicity').get("max")).setValue(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addNewField() {
|
|
||||||
let field: Field = new Field();
|
|
||||||
this.dataModel.fields.push(field);
|
|
||||||
(<FormArray>this.form.get("fields")).push(field.buildForm());
|
|
||||||
}
|
|
||||||
|
|
||||||
DeleteField(index) {
|
|
||||||
this.dataModel.fields.splice(index, 1);
|
|
||||||
(<FormArray>this.form.get("fields")).removeAt(index);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
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 { }
|
|
|
@ -1,15 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
];
|
|
|
@ -1,120 +0,0 @@
|
||||||
<div>
|
|
||||||
<div [formGroup]="form">
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<label>Id</label>
|
|
||||||
<input type="text" class="form-control" formControlName="id">
|
|
||||||
</div>
|
|
||||||
<div class="form-row col-md-6">
|
|
||||||
<div formGroupName="viewStyle">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>View style</label>
|
|
||||||
<select class="form-control" formControlName="renderStyle" (change)= "onchangeCombo($event)">
|
|
||||||
<option value="textarea">textarea</option>
|
|
||||||
<option value="booleanDecision">booleanDecision</option>
|
|
||||||
<option value='combobox'>combobox</option>
|
|
||||||
<option value="checkBox">checkBox</option>
|
|
||||||
<option value="freetext">freetext</option>
|
|
||||||
<option value="radiobox">radiobox</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form" [ngSwitch]="form.get('viewStyle').get('renderStyle').value">
|
|
||||||
<div *ngSwitchCase="'combobox'">
|
|
||||||
<combobox-component [form]="form" [dataModel]="dataModel"></combobox-component>
|
|
||||||
</div>
|
|
||||||
<div *ngSwitchCase="'radiobox'">
|
|
||||||
<radiobox-component [form]="form" [dataModel]="dataModel"></radiobox-component>
|
|
||||||
</div>
|
|
||||||
<div *ngSwitchCase="'freetext'">
|
|
||||||
<freetext-component [form]="form" [dataModel]="dataModel"></freetext-component>
|
|
||||||
</div>
|
|
||||||
<div *ngSwitchCase="'textarea'">
|
|
||||||
<textarea-component [form]="form" [dataModel]="dataModel"></textarea-component>
|
|
||||||
</div>
|
|
||||||
<div *ngSwitchCase="'booleanDecision'">
|
|
||||||
<booleanDecision-component [form]="form" [dataModel]="dataModel"></booleanDecision-component>
|
|
||||||
</div>
|
|
||||||
<div *ngSwitchCase="'checkBox'">
|
|
||||||
<checkbox-component [form]="form" [dataModel]="dataModel"></checkbox-component>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <div class="row">
|
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<label>description</label>
|
|
||||||
<input type="text" class="form-control" formControlName="description">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<label>extendedDescription</label>
|
|
||||||
<input type="text" class="form-control" formControlName="extendedDescription">
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
<div class="row">
|
|
||||||
<div *ngIf="isFieldMultiplicityEnabled" formGroupName="multiplicity">
|
|
||||||
<div class="form-group">
|
|
||||||
<h5 style="margin-left:15px; font-weight:bold;">Multiplicity</h5>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<label>Min</label>
|
|
||||||
<input type="number" class="form-control" formControlName="min">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-2">
|
|
||||||
<label>Max</label>
|
|
||||||
<input type="number" class="form-control" formControlName="max">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label>Ordinal</label>
|
|
||||||
<input type="number" class="form-control" formControlName="ordinal">
|
|
||||||
</div>
|
|
||||||
<div formGroupName="defaultValue">
|
|
||||||
<div class="form-group col-md-5">
|
|
||||||
<label>Default Value</label>
|
|
||||||
<input type="text" class="form-control" formControlName="value">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-5">
|
|
||||||
<label>Validation</label>
|
|
||||||
<div formArrayName="validations">
|
|
||||||
<div *ngFor="let validation of form.controls.validations.controls; let i=index">
|
|
||||||
<select class="form-control" [formControlName]="i">
|
|
||||||
<option *ngFor= "let option of validationsOptions" [value]="option.key">{{option.value}}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<label *ngIf="showMultiplicity">
|
|
||||||
<input type="checkbox" [(ngModel)]="isFieldMultiplicityEnabled" (ngModelChange)="onIsFieldMultiplicityEnabledChange(isFieldMultiplicityEnabled)"
|
|
||||||
/> Multiplicity</label>
|
|
||||||
|
|
||||||
<div class="panel-group" style="margin-top:10px;">
|
|
||||||
<div *ngFor="let rule of dataModel.visible.rules let i=index;" class="panel panel-default">
|
|
||||||
<div class="panel-heading clearfix">
|
|
||||||
<a data-toggle="collapse" href="#{{indexPath + 'r' + i}}" class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. Rule {{i + 1}}</a>
|
|
||||||
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteRule(i);">
|
|
||||||
<span class="glyphicon glyphicon-erase"></span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="{{indexPath + 'r' + i}}" class="panel-collapse collapse in">
|
|
||||||
<div class="panel-body">
|
|
||||||
<rule-form [form]="form.get('visible').get('rules').get(''+i)" [dataModel]="rule"></rule-form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<a (click)="addNewRule()" style="cursor: pointer">
|
|
||||||
Add Rule +
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
|
@ -1,53 +0,0 @@
|
||||||
import { Field } from '../../models/DataSetProfile/Field';
|
|
||||||
import { Rule } from '../../models/DataSetProfile/Rule';
|
|
||||||
import { Component, Input } from '@angular/core';
|
|
||||||
import { FormGroup, FormControl, FormArray } from '@angular/forms';
|
|
||||||
import { ValidationTypes } from 'app/common/validationTypes';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'field-form',
|
|
||||||
templateUrl: './field-form.component.html',
|
|
||||||
styleUrls: []
|
|
||||||
})
|
|
||||||
|
|
||||||
export class FieldFormComponent {
|
|
||||||
@Input() form: FormGroup;
|
|
||||||
@Input() dataModel: Field;
|
|
||||||
@Input() showMultiplicity: boolean = true;
|
|
||||||
@Input() indexPath: string;
|
|
||||||
validationsOptions: Array<any>;
|
|
||||||
isFieldMultiplicityEnabled: boolean = false;
|
|
||||||
|
|
||||||
constructon() {
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
if (this.form.get("multiplicity"))
|
|
||||||
if (this.form.get("multiplicity").value.min > 1 || this.form.get("multiplicity").value.max > 1)
|
|
||||||
this.isFieldMultiplicityEnabled = true;
|
|
||||||
this.validationsOptions = [{ key: 0, value: ValidationTypes[0] }, { key: 1, value: ValidationTypes[1] }]
|
|
||||||
// this.addNewRule();
|
|
||||||
}
|
|
||||||
|
|
||||||
onIsFieldMultiplicityEnabledChange(isFieldMultiplicityEnabled: boolean) {
|
|
||||||
if (!isFieldMultiplicityEnabled) {
|
|
||||||
(<FormControl>this.form.get('multiplicity').get("min")).setValue(0);
|
|
||||||
(<FormControl>this.form.get('multiplicity').get("max")).setValue(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addNewRule() {
|
|
||||||
let rule: Rule = new Rule();
|
|
||||||
this.dataModel.visible.rules.push(rule);
|
|
||||||
(<FormArray>this.form.get("visible").get("rules")).push(rule.buildForm());
|
|
||||||
}
|
|
||||||
|
|
||||||
DeleteRule(index) {
|
|
||||||
this.dataModel.visible.rules.splice(index, 1);
|
|
||||||
(<FormArray>this.form.get("visible").get("rules")).removeAt(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
onchangeCombo() {
|
|
||||||
if (this.form.get("data")) this.form.removeControl("data");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,73 +0,0 @@
|
||||||
<div class="container">
|
|
||||||
<div style="background-color: #f5f5f5;border: 1px solid #e3e3e3;padding: 24px;">
|
|
||||||
<form *ngIf="form" novalidate [formGroup]="form" (ngSubmit)="onSubmit()">
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label>Label</label>
|
|
||||||
<input type="text" class="form-control" formControlName="label">
|
|
||||||
<div *ngIf="form.get('label').invalid && (form.get('label').dirty || form.get('label').touched)">
|
|
||||||
<div *ngIf="form.get('label').errors.required" class="alert alert-danger">
|
|
||||||
Label is required.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="panel-group" style="margin-top:10px;">
|
|
||||||
<div *ngFor="let section of dataModel.sections; let i=index;" class="panel panel-default">
|
|
||||||
<div class="panel-heading clearfix">
|
|
||||||
<a *ngIf="form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{'s' + i}}" class="panel-title pull-left"
|
|
||||||
style="padding-top: 7.5px;">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</a>
|
|
||||||
<a *ngIf="!form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{'s' + i}}" class="panel-title pull-left"
|
|
||||||
style="padding-top: 7.5px;">{{i + 1}}. Section {{i + 1}}</a>
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSection(i);">
|
|
||||||
<span class="glyphicon glyphicon-erase"></span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="{{'s' + i}}" class="panel-collapse collapse in">
|
|
||||||
<div class="panel-body">
|
|
||||||
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="'s' + i"></section-form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="panel-group" style="margin-top:10px;">
|
|
||||||
<div *ngFor="let page of dataModel.pages; let i=index;" class="panel panel-default">
|
|
||||||
<div class="panel-heading clearfix">
|
|
||||||
<a *ngIf="form.get('pages').at(i).get('title').value" data-toggle="collapse" href="#{{'p' + i}}" class="panel-title pull-left"
|
|
||||||
style="padding-top: 7.5px;">{{i + 1}}.{{form.get('pages').at(i).get('title').value}}</a>
|
|
||||||
<a *ngIf="!form.get('pages').at(i).get('title').value" data-toggle="collapse" href="#{{'p' + i}}" class="panel-title pull-left"
|
|
||||||
style="padding-top: 7.5px;">{{i + 1}}. Page{{i + 1}}</a>
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeletePage(i);">
|
|
||||||
<span class="glyphicon glyphicon-erase"></span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="{{'p' + i}}" class="panel-collapse collapse in">
|
|
||||||
<div class="panel-body">
|
|
||||||
<page-form [form]="form.get('pages').at(i)" [dataModel]="page"></page-form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="margin-top:20px; padding-left: 15px;" class="row">
|
|
||||||
<a (click)="addSection()" style="cursor: pointer">
|
|
||||||
Add Section +
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="margin-top:20px; padding-left: 15px;" class="row">
|
|
||||||
<a (click)="addPage()" style="cursor: pointer">
|
|
||||||
Add Page +
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button class="btn btn-primary" style="margin-top:20px;" type="submit" [disabled]="!form.valid">Save</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,88 +0,0 @@
|
||||||
import { Section } from '../../models/DataSetProfile/Section';
|
|
||||||
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
|
||||||
import { DatasetProfileService } from '../../services/dataset-profile.service';
|
|
||||||
import { RestBase } from '../../services/rest-base';
|
|
||||||
import { DatasetProfileModel } from '../../models/DataSetProfile/DatasetProfileModel';
|
|
||||||
import { Page } from '../../models/DataSetProfile/Page';
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
|
||||||
import { FormGroup, FormControl } from '@angular/forms';
|
|
||||||
import { SectionFormComponent } from '../section-form/section-form.component';
|
|
||||||
import { FormArray } from '@angular/forms/src/model';
|
|
||||||
import { Router, ActivatedRoute, ParamMap, Params } from '@angular/router';
|
|
||||||
import { PageFormComponent } from '../page-form/page-component'
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'form-comp',
|
|
||||||
templateUrl: './form.component.html',
|
|
||||||
styleUrls: []
|
|
||||||
})
|
|
||||||
|
|
||||||
export class FormComponent {
|
|
||||||
|
|
||||||
dataModel: DatasetProfileModel;
|
|
||||||
form: FormGroup;
|
|
||||||
private profileID: string;
|
|
||||||
|
|
||||||
constructor(public restBase: RestBase, private datasetProfileService: DatasetProfileService, private route: ActivatedRoute) {
|
|
||||||
this.profileID = route.snapshot.params['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
|
|
||||||
this.dataModel = JsonSerializer.fromJSONObject(new DatasetProfileModel(), DatasetProfileModel);
|
|
||||||
this.form = this.dataModel.buildForm();
|
|
||||||
if (this.profileID) {
|
|
||||||
this.datasetProfileService.getDatasetProfileById(this.profileID).subscribe((data) => {
|
|
||||||
this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModel);
|
|
||||||
this.form = this.dataModel.buildForm();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.addSection();
|
|
||||||
this.addPage(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {
|
|
||||||
if (!isMultiplicityEnabled) {
|
|
||||||
(<FormControl>this.form.get('multiplicity').get("min")).setValue(0);
|
|
||||||
(<FormControl>this.form.get('multiplicity').get("max")).setValue(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addSection() {
|
|
||||||
let section: Section = new Section();
|
|
||||||
this.dataModel.sections.push(section);
|
|
||||||
(<FormArray>this.form.get("sections")).push(section.buildForm());
|
|
||||||
}
|
|
||||||
|
|
||||||
addPage(number) {
|
|
||||||
let page: Page = new Page(this.dataModel.pages.length);
|
|
||||||
this.dataModel.pages.push(page);
|
|
||||||
(<FormArray>this.form.get("pages")).push(page.buildForm());
|
|
||||||
}
|
|
||||||
|
|
||||||
DeleteSection(index) {
|
|
||||||
this.dataModel.sections.splice(index, 1);
|
|
||||||
(<FormArray>this.form.get("sections")).removeAt(index)
|
|
||||||
}
|
|
||||||
|
|
||||||
DeletePage(index) {
|
|
||||||
this.dataModel.pages.splice(index, 1);
|
|
||||||
(<FormArray>this.form.get("pages")).removeAt(index)
|
|
||||||
}
|
|
||||||
|
|
||||||
createForm(data) {
|
|
||||||
return this.restBase.post("/admin/addDmp", data);
|
|
||||||
}
|
|
||||||
updateForm(id, data) {
|
|
||||||
return this.restBase.post("/admin/addDmp/" + id, data);
|
|
||||||
}
|
|
||||||
onSubmit() {
|
|
||||||
let data = this.form.value;
|
|
||||||
|
|
||||||
if (this.profileID) this.updateForm(this.profileID, data).subscribe();
|
|
||||||
else this.createForm(data).subscribe();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,66 +0,0 @@
|
||||||
<div>
|
|
||||||
<!-- <div [formGroup]="form">
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-md-5">
|
|
||||||
<label>Title</label>
|
|
||||||
<input type="text" class="form-control" formControlName="title">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label>Id</label>
|
|
||||||
<input type="text" class="form-control" formControlName="id">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label>Ordinal</label>
|
|
||||||
<input type="text" class="form-control" formControlName="ordinal">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label class="radio control-label">Default Visibility</label>
|
|
||||||
<label class="radio-inline">
|
|
||||||
<input type="radio" [value]="true" formControlName="defaultVisibility"> true
|
|
||||||
</label>
|
|
||||||
<label class="radio-inline">
|
|
||||||
<input type="radio" [value]="false" formControlName="defaultVisibility"> false
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<label>Description</label>
|
|
||||||
<input type="text" class="form-control" formControlName="description">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<label>ExtendedDescription</label>
|
|
||||||
<input type="text" class="form-control" formControlName="extendedDescription">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div class="panel-group" style="margin-top:10px;">
|
|
||||||
<div *ngFor="let field of dataModel.compositeFields let i=index;" class="panel panel-default">
|
|
||||||
<div class="panel-heading clearfix">
|
|
||||||
<!-- <a *ngIf="form.get('compositeFields').get(''+i).get('title').value" data-toggle="collapse" href="#{{'compositeFieldCollapse' + i}}"
|
|
||||||
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. {{form.get('compositeFields').get(''+i).get('title').value}}</a>
|
|
||||||
<a *ngIf="!form.get('compositeFields').get(''+i).get('title').value" data-toggle="collapse" href="#{{'compositeFieldCollapse' + i}}"
|
|
||||||
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. Field {{i + 1}}</a> -->
|
|
||||||
<a data-toggle="collapse" href="#{{indexPath + 'cf' + i}}"
|
|
||||||
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. Field {{i + 1}}</a>
|
|
||||||
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteFieldSet(i);">
|
|
||||||
<span class="glyphicon glyphicon-erase"></span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="{{indexPath + 'cf' + i}}" class="panel-collapse collapse in">
|
|
||||||
<div class="panel-body">
|
|
||||||
<compositefield-form [form]="form.get('compositeFields').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'cf' + i"></compositefield-form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <div>
|
|
||||||
<a (click)="addNewFieldSet()" style="cursor: pointer">
|
|
||||||
Add Field +
|
|
||||||
</a>
|
|
||||||
</div> -->
|
|
||||||
</div>
|
|
|
@ -1,43 +0,0 @@
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
|
||||||
import { FormGroup } from '@angular/forms';
|
|
||||||
import { FieldGroup } from 'app/models/DataSetProfile/FieldGroup';
|
|
||||||
import { FieldSet } from 'app/models/DataSetProfile/FieldSet';
|
|
||||||
import { FormArray } from '@angular/forms/src/model';
|
|
||||||
import { Field } from 'app/models/DataSetProfile/Field';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'groupfield-form',
|
|
||||||
templateUrl: './groupfield-form.component.html',
|
|
||||||
styleUrls: []
|
|
||||||
})
|
|
||||||
|
|
||||||
export class GroupFieldFormComponent {
|
|
||||||
@Input() form: FormGroup;
|
|
||||||
@Input() dataModel: FieldGroup;
|
|
||||||
@Input() indexPath: string;
|
|
||||||
|
|
||||||
constructor(){}
|
|
||||||
|
|
||||||
ngOnInit(){
|
|
||||||
//this.addNewField();
|
|
||||||
}
|
|
||||||
|
|
||||||
addNewFieldSet(){
|
|
||||||
let compositeField: FieldSet = new FieldSet();
|
|
||||||
|
|
||||||
let field: Field = new Field(); //create field at the same time
|
|
||||||
compositeField.fields.push(field);
|
|
||||||
//(<FormArray>this.form.get("compositeFields").get("fields")).push(field.buildForm());
|
|
||||||
|
|
||||||
|
|
||||||
this.dataModel.compositeFields.push(compositeField);
|
|
||||||
(<FormArray>this.form.get("compositeFields")).push(compositeField.buildForm());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
DeleteFieldSet(index){
|
|
||||||
this.dataModel.compositeFields.splice(index, 1);
|
|
||||||
(<FormArray>this.form.get("compositeFields")).removeAt(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
<div>
|
|
||||||
<div [formGroup]="form" class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<label>Title</label>
|
|
||||||
<input type="text" class="form-control" formControlName="title">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,18 +0,0 @@
|
||||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
||||||
import { FormGroup } from '@angular/forms'
|
|
||||||
import { Page } from 'app/models/DataSetProfile/Page'
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'page-form',
|
|
||||||
templateUrl: './page-component.html',
|
|
||||||
styleUrls: []
|
|
||||||
})
|
|
||||||
|
|
||||||
export class PageFormComponent {
|
|
||||||
@Input() form: FormGroup;
|
|
||||||
@Input() dataModel: Page;
|
|
||||||
|
|
||||||
TargetValidation() {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
<div>
|
|
||||||
<div [formGroup]="form">
|
|
||||||
<div class="form-row">
|
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<label>Rule Type</label>
|
|
||||||
<select class="form-control" formControlName="ruleType">
|
|
||||||
<option>field value</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<label>Target</label>
|
|
||||||
<input type="text" class="form-control" placeholder="field id" formControlName="target" (change)="TargetValidation()">
|
|
||||||
</div>
|
|
||||||
<!-- <div class="form-group col-md-4">
|
|
||||||
<label>Rule style</label>
|
|
||||||
<select class="form-control">
|
|
||||||
<option>boolean</option>
|
|
||||||
<option>checked</option>
|
|
||||||
<option>unchecked</option>
|
|
||||||
<option>dropdown value</option>
|
|
||||||
</select>
|
|
||||||
</div> -->
|
|
||||||
<!-- <div class="form-group col-md-6">
|
|
||||||
<label>Value Type</label>
|
|
||||||
<input type="text" class="form-control" formControlName="valueType">
|
|
||||||
</div> -->
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label>Value</label>
|
|
||||||
<input type="text" class="form-control" formControlName="value">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,18 +0,0 @@
|
||||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
||||||
import { FormGroup } from '@angular/forms'
|
|
||||||
import { Rule } from 'app/models/DataSetProfile/Rule'
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'rule-form',
|
|
||||||
templateUrl: './rule.component.html',
|
|
||||||
styleUrls: []
|
|
||||||
})
|
|
||||||
|
|
||||||
export class RuleFormComponent {
|
|
||||||
@Input() form: FormGroup;
|
|
||||||
@Input() dataModel: FormGroup;
|
|
||||||
|
|
||||||
TargetValidation(){
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
.section-container {
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
border: 1px solid #e3e3e3;
|
|
||||||
padding: 24px;
|
|
||||||
}
|
|
|
@ -1,124 +0,0 @@
|
||||||
<div class="section-container">
|
|
||||||
<div class="row" [formGroup]="form">
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-md-4">
|
|
||||||
<label>Title</label>
|
|
||||||
<input type="text" class="form-control" formControlName="title">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label>Id</label>
|
|
||||||
<input type="text" class="form-control" formControlName="id">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label>Ordinal</label>
|
|
||||||
<input type="number" class="form-control" formControlName="ordinal">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label>Page</label>
|
|
||||||
<select class="form-control" formControlName="page">
|
|
||||||
<option *ngFor="let pageGroup of form.root.get('pages').controls;" [value]="pageGroup.get('id').value">{{pageGroup.get('title').value}}</option>
|
|
||||||
</select>
|
|
||||||
<div *ngIf="form.get('page').invalid && (form.get('page').dirty || form.get('page').touched)" class="alert alert-danger">Page is required</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label class="radio control-label">Default Visibility</label>
|
|
||||||
<label class="radio-inline">
|
|
||||||
<input type="radio" [value]="true" formControlName="defaultVisibility"> true
|
|
||||||
</label>
|
|
||||||
<label class="radio-inline">
|
|
||||||
<input type="radio" [value]="false" formControlName="defaultVisibility"> false
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div *ngIf="dataModel.sections.length > 0" class="panel-group" style="margin-top:10px;">
|
|
||||||
<div *ngFor="let section of dataModel.sections; let i=index;" class="panel panel-default">
|
|
||||||
<div class="panel-heading clearfix">
|
|
||||||
<a *ngIf="form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 's' + i}}" class="panel-title pull-left"
|
|
||||||
style="padding-top: 7.5px;">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</a>
|
|
||||||
<a *ngIf="!form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 's' + i}}" class="panel-title pull-left"
|
|
||||||
style="padding-top: 7.5px;">{{i + 1}}. Section {{i + 1}}</a>
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSectionInSection(i);">
|
|
||||||
<span class="glyphicon glyphicon-erase"></span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="{{indexPath + 's' + i}}" class="panel-collapse collapse in">
|
|
||||||
<div class="panel-body">
|
|
||||||
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="indexPath + 's' + i"></section-form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <div *ngFor="let fieldGroup of dataModel.fieldGroups let i=index;">
|
|
||||||
<groupfield-form [form]="form.get('fieldGroups').get(''+i)" [dataModel]="fieldGroup" [indexPath]="indexPath + 'g' + i"></groupfield-form>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div class="panel-group" style="margin-top:10px;">
|
|
||||||
<div *ngFor="let field of dataModel.fieldSets let i=index;" class="panel panel-default">
|
|
||||||
<div class="panel-heading clearfix">
|
|
||||||
<!-- <a *ngIf="form.get('compositeFields').get(''+i).get('title').value" data-toggle="collapse" href="#{{'compositeFieldCollapse' + i}}"
|
|
||||||
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. {{form.get('compositeFields').get(''+i).get('title').value}}</a>
|
|
||||||
<a *ngIf="!form.get('compositeFields').get(''+i).get('title').value" data-toggle="collapse" href="#{{'compositeFieldCollapse' + i}}"
|
|
||||||
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. Field {{i + 1}}</a> -->
|
|
||||||
<a data-toggle="collapse" href="#{{indexPath + 'cf' + i}}"
|
|
||||||
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. Field {{i + 1}}</a>
|
|
||||||
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteFieldSet(i);">
|
|
||||||
<span class="glyphicon glyphicon-erase"></span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="{{indexPath + 'cf' + i}}" class="panel-collapse collapse in">
|
|
||||||
<div class="panel-body">
|
|
||||||
<compositefield-form [form]="form.get('fieldSets').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'cf' + i"></compositefield-form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<div *ngIf="dataModel.fieldGroups" class="panel-group" style="margin-top:10px;">
|
|
||||||
<div *ngFor="let fieldGroup of dataModel.fieldGroups let i=index;" class="panel panel-default">
|
|
||||||
<div class="panel-heading clearfix">
|
|
||||||
<a *ngIf="form.get('fieldGroups').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 'g' + i}}" class="panel-title pull-left"
|
|
||||||
style="padding-top: 7.5px;">{{i + 1}}. {{form.get('fieldGroups').get(''+i).get('title').value}}</a>
|
|
||||||
<a *ngIf="!form.get('fieldGroups').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 'g' + i}}" class="panel-title pull-left"
|
|
||||||
style="padding-top: 7.5px;">{{i + 1}}. Group {{i + 1}}</a>
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteFieldGroup(i);">
|
|
||||||
<span class="glyphicon glyphicon-erase"></span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="{{indexPath + 'g' + i}}" class="panel-collapse collapse in">
|
|
||||||
<div class="panel-body">
|
|
||||||
<groupfield-form [form]="form.get('fieldGroups').get(''+i)" [dataModel]="fieldGroup" [indexPath]="indexPath + 'g' + i"></groupfield-form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
<!-- <div>
|
|
||||||
<a (click)="addGroupField()" style="cursor: pointer">
|
|
||||||
Add Group +
|
|
||||||
</a>
|
|
||||||
</div> -->
|
|
||||||
<div>
|
|
||||||
<a (click)="addField()" style="cursor: pointer">
|
|
||||||
Add Field +
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<a (click)="addSectioninSection()" style="cursor: pointer">
|
|
||||||
Add Section +
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,64 +0,0 @@
|
||||||
import { Component, OnInit, Input, ViewEncapsulation } from '@angular/core';
|
|
||||||
import { FormGroup } from '@angular/forms';
|
|
||||||
import { Section } from 'app/models/DataSetProfile/Section';
|
|
||||||
import { FieldGroup } from 'app/models/DataSetProfile/FieldGroup';
|
|
||||||
import { FormArray } from '@angular/forms/src/model';
|
|
||||||
import { DatasetProfileModel } from 'app/models/DataSetProfile/DatasetProfileModel';
|
|
||||||
import { FieldSet } from 'app/models/DataSetProfile/FieldSet';
|
|
||||||
import { Field } from 'app/models/DataSetProfile/Field';
|
|
||||||
import { Page } from 'app/models/DataSetProfile/Page';
|
|
||||||
import { JsonSerializer } from 'app/utilities/JsonSerializer';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'section-form',
|
|
||||||
templateUrl: './section-form.component.html',
|
|
||||||
styleUrls: ['./section-form.component.css'],
|
|
||||||
encapsulation: ViewEncapsulation.None
|
|
||||||
})
|
|
||||||
|
|
||||||
export class SectionFormComponent {
|
|
||||||
@Input() form: FormGroup;
|
|
||||||
@Input() dataModel: Section;
|
|
||||||
@Input() indexPath: string;
|
|
||||||
|
|
||||||
constructor() { }
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
var self = this;
|
|
||||||
this.form.root.get("pages").valueChanges.subscribe(function (value) {
|
|
||||||
self.keepPageSelectionValid(value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
addField() {
|
|
||||||
let fieldSet: FieldSet = new FieldSet();
|
|
||||||
let field: Field = new Field();
|
|
||||||
fieldSet.fields.push(field);
|
|
||||||
if (this.dataModel.fieldSets)
|
|
||||||
this.dataModel.fieldSets.push(fieldSet);
|
|
||||||
(<FormArray>this.form.get("fieldSets")).push(fieldSet.buildForm());
|
|
||||||
}
|
|
||||||
|
|
||||||
addSectioninSection() {
|
|
||||||
let section: Section = new Section();
|
|
||||||
this.dataModel.sections.push(section);
|
|
||||||
(<FormArray>this.form.get("sections")).push(section.buildForm());
|
|
||||||
}
|
|
||||||
|
|
||||||
DeleteSectionInSection(index) {
|
|
||||||
this.dataModel.sections.splice(index);
|
|
||||||
(<FormArray>this.form.get("sections")).removeAt(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
DeleteFieldSet(index) {
|
|
||||||
this.dataModel.fieldSets.splice(index, 1);
|
|
||||||
(<FormArray>this.form.get("fieldSets")).removeAt(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
keepPageSelectionValid(pagesJson: Array<any>) {
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,68 +0,0 @@
|
||||||
<div class="panel panel-default margin10">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col col-xs-6">
|
|
||||||
<h3 class="panel-title">Editing profile: {{profile?.label}}</h3>
|
|
||||||
</div>
|
|
||||||
<div class="col col-xs-6 text-right">
|
|
||||||
<button type="button" class="btn btn-sm btn-primary btn-create" (click)="goToMain()" > <span class="glyphicon glyphicon-arrow-left"></span> Go back</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
|
|
||||||
<ul class="nav nav-tabs content-tabs" id="maincontent" role="tablist">
|
|
||||||
<li class="active"><a href="#profile" role="tab" data-toggle="tab">Profile</a></li>
|
|
||||||
<li class=""><a href="#viewstyle" role="tab" data-toggle="tab">Profile's viewstyle</a></li>
|
|
||||||
<li class=""><a href="#ruleset" role="tab" data-toggle="tab">Profile's ruleset</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="tab-content">
|
|
||||||
|
|
||||||
<div class="tab-pane fade active in" id="profile">
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<input name="profile-label" type="text" placeholder="Enter profile label" [ngModel]="profile?.label" (ngModelChange)="profile.label=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)">
|
|
||||||
<label for="profile-label">Label</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<textarea class="form-control custom" rows="10" cols="65" name="profile-definition" [ngModel]="profile?.definition" (ngModelChange)="profile.definition=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)" placeholder="Enter profile definition"></textarea>
|
|
||||||
<label for="profile-definition">Definition</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-pane fade" id="viewstyle">
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<input name="viewstyle-label" type="text" placeholder="Enter viewstyle label" [ngModel]="profile?.viewstyle?.label" (ngModelChange)="profile.viewstyle.label=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)">
|
|
||||||
<label for="viewstyle-label">Label</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<textarea class="form-control custom" rows="10" cols="65" name="viewstyle-definition" [ngModel]="profile?.viewstyle?.definition" (ngModelChange)="profile.viewstyle.definition=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)"></textarea>
|
|
||||||
<label for="viewstyle-definition">Definition</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-pane fade" id="ruleset">
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<input name="ruleset-label" type="text" placeholder="Enter ruleset label" [ngModel]="profile?.ruleset?.label" (ngModelChange)="profile.ruleset.label=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)">
|
|
||||||
<label for="ruleset-label">Label</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<textarea class="form-control custom" rows="10" cols="65" name="ruleset-definition" [ngModel]="profile?.ruleset?.definition" (ngModelChange)="profile.ruleset.definition=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)"></textarea>
|
|
||||||
<label for="ruleset-definition">Definition</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { DatasetProfileGUIEditorComponent } from './dataset-profile-gui-editor.component';
|
|
||||||
|
|
||||||
describe('DatasetProfileEditorComponent', () => {
|
|
||||||
let component: DatasetProfileGUIEditorComponent;
|
|
||||||
let fixture: ComponentFixture<DatasetProfileGUIEditorComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ DatasetProfileGUIEditorComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(DatasetProfileGUIEditorComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,24 +0,0 @@
|
||||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'dataset-profile-gui-editor',
|
|
||||||
templateUrl: './dataset-profile-gui-editor.component.html',
|
|
||||||
styleUrls: ['./dataset-profile-gui-editor.component.css']
|
|
||||||
})
|
|
||||||
export class DatasetProfileGUIEditorComponent implements OnInit {
|
|
||||||
|
|
||||||
constructor() { }
|
|
||||||
|
|
||||||
@Input() profile: any;
|
|
||||||
@Output() notifyClick: EventEmitter<any> = new EventEmitter<any>();
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
goToMain(){
|
|
||||||
this.notifyClick.emit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
div.container{
|
|
||||||
margin-top: 30px;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
margin-right: 30px;
|
|
||||||
margin-left: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-menu {
|
|
||||||
height: auto;
|
|
||||||
max-height: 180px;
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.margined {
|
|
||||||
margin-left: 5px;
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-menu::-webkit-scrollbar {
|
|
||||||
-webkit-appearance: none;
|
|
||||||
width: 4px;
|
|
||||||
}
|
|
||||||
.dropdown-menu::-webkit-scrollbar-thumb {
|
|
||||||
border-radius: 3px;
|
|
||||||
background-color: lightgray;
|
|
||||||
-webkit-box-shadow: 0 0 1px rgba(255,255,255,.75);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
.dropdown-list-elem {
|
|
||||||
margin-left: 5px;
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tr:hover {
|
|
||||||
background-color: #56615D;
|
|
||||||
}
|
|
||||||
td:hover {
|
|
||||||
background-color: #56615D;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tr.hover:hover > * {
|
|
||||||
background-color: #eeeeee;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.red{
|
|
||||||
color:red;
|
|
||||||
}
|
|
||||||
|
|
||||||
.noborder{
|
|
||||||
border-style: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.invisible {
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.visible {
|
|
||||||
display:block;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.dmp-btn-width{
|
|
||||||
min-width: 140px;
|
|
||||||
max-width: 180px;
|
|
||||||
}
|
|
|
@ -1,194 +0,0 @@
|
||||||
<!-- This is the dataset viewer -->
|
|
||||||
<div [ngClass]="{true:'visible', false:'invisible'}[viewingComponent==1]">
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
<div class="">
|
|
||||||
|
|
||||||
<div class="panel panel-default panel-table">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col col-xs-6">
|
|
||||||
<h3 class="panel-title">Manage Datasets</h3>
|
|
||||||
</div>
|
|
||||||
<div class="col col-xs-6 text-right">
|
|
||||||
<button type="button" class="btn btn-sm btn-primary btn-create" data-toggle="modal" data-target="#newdataset-modal-container" >Create New</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<table class="table table-striped" [mfData]="data | dataFilter : filterQuery" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
|
|
||||||
<!--<table class="table table-striped" [mfData]="data" #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>DMP</th>
|
|
||||||
<th><mfDefaultSorter by="uri">Uri</mfDefaultSorter></th>
|
|
||||||
<th>Properties</th>
|
|
||||||
<th>Profile</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr *ngFor="let dataset of mf.data" class="hover">
|
|
||||||
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{dataset?.id}}</td>
|
|
||||||
<td><input class="noborder" type="text" [(ngModel)]="dataset.label" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutLabel($event)"></td>
|
|
||||||
<td>
|
|
||||||
<div class="dropdown">
|
|
||||||
<button class="btn btn-primary dropdown-toggle dmp-btn-width" type="button" data-toggle="dropdown">{{dataset?.dmp?.label}}
|
|
||||||
<span class="caret"></span>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu" >
|
|
||||||
<li class="margined" *ngFor="let idLabel of dmpsIDLabels" (click)="assignDMPToDataset($event, idLabel.id)"><a style="cursor:pointer;">{{idLabel?.label}}</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td><input class="noborder" type="text" [(ngModel)]="dataset.uri" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutURI($event)"></td>
|
|
||||||
<td>
|
|
||||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#edit-properties-modal-container" (click)="onShowingPropertiesModal($event)">
|
|
||||||
<span class="glyphicon glyphicon-pencil"></span>
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<button type="button" class="btn btn-default" (click)="gotoProfileEditor($event, dataset.profile?.id)">
|
|
||||||
<span [ngClass]="{true:'glyphicon glyphicon-plus', false:'glyphicon glyphicon-pencil'}[dataset?.profile?.id==null]"></span>
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
<td style='float: left;'>
|
|
||||||
|
|
||||||
<button class="btn btn-default" data-toggle="modal" data-target="#confirmation-modal" (click)="setClickedDatasetID($event)">
|
|
||||||
<span class="glyphicon glyphicon-trash red"></span>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<td colspan="7">
|
|
||||||
<mfBootstrapPaginator [rowsOnPageSet]="[10,20,40]"></mfBootstrapPaginator>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<new-dataset (idSender)="notifyNewDatasetID($event)"></new-dataset>
|
|
||||||
<properties-editor [datasetID]=clickedDatasetID></properties-editor>
|
|
||||||
<confirmation [confirmationTitle]="'Caution'" [confirmationDescr]="'This action will delete the dataset. Are you sure you want to delete this dataset ? This is not revertable !'" (responseSender)="applyConfirmation($event)"></confirmation>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- END of DatasetViewer -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- new profile editor -->
|
|
||||||
<!--
|
|
||||||
<div [ngClass]="{true:'visible', false:'invisible'}[viewingComponent==2]">
|
|
||||||
<dataset-profile-gui-editor [profile]=profile (notifyClick)="goToMain()" ></dataset-profile-gui-editor>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
<!-- end of new profile editor -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- OLD Profile Editor -->
|
|
||||||
|
|
||||||
|
|
||||||
<div [ngClass]="{true:'visible', false:'invisible'}[viewingComponent==2]">
|
|
||||||
<div class="panel panel-default margin10">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col col-xs-6">
|
|
||||||
<h3 class="panel-title">Editing profile: {{profile?.label}}</h3>
|
|
||||||
</div>
|
|
||||||
<div class="col col-xs-6 text-right">
|
|
||||||
<button type="button" class="btn btn-sm btn-primary btn-create" (click)="goToMain()" > <span class="glyphicon glyphicon-arrow-left"></span> Go back</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
|
|
||||||
<ul class="nav nav-tabs content-tabs" id="maincontent" role="tablist">
|
|
||||||
<li class="active"><a href="#profile" role="tab" data-toggle="tab">Profile</a></li>
|
|
||||||
<li class=""><a href="#viewstyle" role="tab" data-toggle="tab">Profile's viewstyle</a></li>
|
|
||||||
<li class=""><a href="#ruleset" role="tab" data-toggle="tab">Profile's ruleset</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="tab-content">
|
|
||||||
|
|
||||||
<div class="tab-pane fade active in" id="profile">
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<input name="profile-label" type="text" placeholder="Enter profile label" [ngModel]="profile?.label" (ngModelChange)="profile.label=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)">
|
|
||||||
<label for="profile-label">Label</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<textarea class="form-control custom" rows="10" cols="65" name="profile-definition" [ngModel]="profile?.definition" (ngModelChange)="profile.definition=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)" placeholder="Enter profile definition"></textarea>
|
|
||||||
<label for="profile-definition">Definition</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-pane fade" id="viewstyle">
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<input name="viewstyle-label" type="text" placeholder="Enter viewstyle label" [ngModel]="profile?.viewstyle?.label" (ngModelChange)="profile.viewstyle.label=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)">
|
|
||||||
<label for="viewstyle-label">Label</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<textarea class="form-control custom" rows="10" cols="65" name="viewstyle-definition" [ngModel]="profile?.viewstyle?.definition" (ngModelChange)="profile.viewstyle.definition=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)"></textarea>
|
|
||||||
<label for="viewstyle-definition">Definition</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-pane fade" id="ruleset">
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<input name="ruleset-label" type="text" placeholder="Enter ruleset label" [ngModel]="profile?.ruleset?.label" (ngModelChange)="profile.ruleset.label=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)">
|
|
||||||
<label for="ruleset-label">Label</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div class="custom-table">
|
|
||||||
<textarea class="form-control custom" rows="10" cols="65" name="ruleset-definition" [ngModel]="profile?.ruleset?.definition" (ngModelChange)="profile.ruleset.definition=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)"></textarea>
|
|
||||||
<label for="ruleset-definition">Definition</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- End of OLD Profile Editor -->
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { DatasetsViewerComponent } from './datasets-viewer.component';
|
|
||||||
|
|
||||||
describe('DatasetsViewerComponent', () => {
|
|
||||||
let component: DatasetsViewerComponent;
|
|
||||||
let fixture: ComponentFixture<DatasetsViewerComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ DatasetsViewerComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(DatasetsViewerComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,366 +0,0 @@
|
||||||
import { Component, Input, OnInit, AfterViewInit, ElementRef} from '@angular/core';
|
|
||||||
import { DialogService } from "ng2-bootstrap-modal";
|
|
||||||
import { Router } from '@angular/router';
|
|
||||||
import { DatasetsServiceService } from '../services/datasets-service.service';
|
|
||||||
import { DatasetProfileService } from '../services/dataset-profile.service';
|
|
||||||
import { DmpsServiceService } from '../services/dmps-service.service';
|
|
||||||
import { DatasetProfileGUIEditorComponent } from '../dataset-profile-gui-editor/dataset-profile-gui-editor.component';
|
|
||||||
|
|
||||||
import '../../assets/custom.js';
|
|
||||||
declare function simple_notifier(type: string, title: string, message:string): any;
|
|
||||||
|
|
||||||
import {Headers, Http, Response} from '@angular/http';
|
|
||||||
import {Observable} from 'rxjs/Observable';
|
|
||||||
import * as jQuery from 'jquery';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-datasets-viewer',
|
|
||||||
templateUrl: './datasets-viewer.component.html',
|
|
||||||
styleUrls: ['./datasets-viewer.component.css']
|
|
||||||
})
|
|
||||||
export class DatasetsViewerComponent implements OnInit, AfterViewInit {
|
|
||||||
|
|
||||||
//This is the table data
|
|
||||||
public data: any[] = new Array();
|
|
||||||
public filterQuery = "";
|
|
||||||
public rowsOnPage = 10;
|
|
||||||
public sortBy = "email";
|
|
||||||
public sortOrder = "asc";
|
|
||||||
|
|
||||||
//this is for viewing or not ids
|
|
||||||
private showIDs: boolean = false;
|
|
||||||
|
|
||||||
//this is for switching between components
|
|
||||||
private viewingComponent: number = 1;
|
|
||||||
|
|
||||||
public dmpsIDLabels : any = null;
|
|
||||||
|
|
||||||
//for update sensing...
|
|
||||||
private haveChanges : boolean = false;
|
|
||||||
|
|
||||||
//for popups
|
|
||||||
private clickedDatasetID: string;
|
|
||||||
|
|
||||||
//this is the profile under edit
|
|
||||||
private profile : any;
|
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private el: ElementRef,
|
|
||||||
private datasetsService : DatasetsServiceService,
|
|
||||||
private datasetProfileService: DatasetProfileService,
|
|
||||||
private http : Http,
|
|
||||||
private dmpsService: DmpsServiceService,
|
|
||||||
private dialogService:DialogService,
|
|
||||||
private router: Router
|
|
||||||
) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() : void {
|
|
||||||
//this.getDatasetIDs();
|
|
||||||
this.getTabularDatasets(false);
|
|
||||||
this.dmpsIDLabels = this.dmpsService.getDmpIdsLabels().subscribe((data)=> {this.dmpsIDLabels = data;} );
|
|
||||||
}
|
|
||||||
|
|
||||||
ngAfterViewInit() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
onFocusIn($event){
|
|
||||||
this.nullSafeProfile();
|
|
||||||
this.haveChanges = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
onValueChanged($event){
|
|
||||||
this.nullSafeProfile();
|
|
||||||
this.haveChanges = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
onFocusOutLabel($event){
|
|
||||||
if(this.haveChanges){
|
|
||||||
let datasetID = $event.srcElement.parentElement.parentElement.children[0].textContent;
|
|
||||||
console.log("Updating the value of label to: "+$event.target.value+" on row with id: "+datasetID);
|
|
||||||
this.datasetsService.getDatasetById(datasetID).subscribe( (data) => {
|
|
||||||
data.label = $event.target.value;
|
|
||||||
this.datasetsService.setDataset(data).subscribe( (data) => {
|
|
||||||
//console.log(data);
|
|
||||||
});
|
|
||||||
simple_notifier("success",null,"Updated value of label to '"+data.label+"'");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
onFocusOutURI($event){
|
|
||||||
if(this.haveChanges){
|
|
||||||
let datasetID = $event.srcElement.parentElement.parentElement.children[0].textContent;
|
|
||||||
console.log("Updating the value of uri to: "+$event.target.value+" on row with id: "+datasetID);
|
|
||||||
this.datasetsService.getDatasetById(datasetID).subscribe(
|
|
||||||
(data) => {
|
|
||||||
data.uri = $event.target.value;
|
|
||||||
this.datasetsService.setDataset(data).subscribe( (data) => {
|
|
||||||
//console.log(data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
simple_notifier("success",null,"Updated value of Uri to '"+data.uri+"'");
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onFocusOutProfileWin($event, value:string) {
|
|
||||||
this.nullSafeProfile();
|
|
||||||
if(this.haveChanges){
|
|
||||||
|
|
||||||
//delete this.profile.id;
|
|
||||||
//delete this.profile.ruleset.id;
|
|
||||||
//delete this.profile.viewstyle.id;
|
|
||||||
|
|
||||||
delete this.profile.dataset;
|
|
||||||
delete this.profile.ruleset.datasetProfile;
|
|
||||||
delete this.profile.viewstyle.datasetProfile;
|
|
||||||
|
|
||||||
console.log("Saving profile: "+JSON.stringify(this.profile));
|
|
||||||
|
|
||||||
//save back
|
|
||||||
this.datasetProfileService.createDatasetProfile(this.profile).subscribe(
|
|
||||||
response => {
|
|
||||||
simple_notifier("success",null,"Saved Dataset Profile");
|
|
||||||
console.log(response);
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
simple_notifier("danger",null,"Could not save Dataset Profile");
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
|
||||||
//save back
|
|
||||||
if(this.profile.id == null){ //if profile is new
|
|
||||||
//create profile and a) assign it on data[] and on current profile b) assign it to dataset
|
|
||||||
this.datasetProfileService.createDatasetProfile(this.profile).subscribe((resp) => {
|
|
||||||
|
|
||||||
this.datasetsService.getDatasetById(this.clickedDatasetID).subscribe( (dataset) => {
|
|
||||||
|
|
||||||
if(dataset.profile != null){
|
|
||||||
this.profile.id = dataset.profile.id;
|
|
||||||
|
|
||||||
}
|
|
||||||
dataset.profile = this.profile;
|
|
||||||
|
|
||||||
console.log("SAVING DATASET: "+JSON.stringify(dataset));
|
|
||||||
|
|
||||||
this.datasetsService.setDataset(dataset).subscribe( (resp) => {
|
|
||||||
|
|
||||||
//console.log(resp);
|
|
||||||
simple_notifier("success",null,"Updated profile element");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
simple_notifier("success",null,"Updated profile element");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
//this.getDatasetFromDataArray()
|
|
||||||
|
|
||||||
console.log("this.profile")
|
|
||||||
console.log(this.profile)
|
|
||||||
|
|
||||||
//this.profile.dataset = {"id": this.profile.dataset};
|
|
||||||
|
|
||||||
|
|
||||||
this.datasetProfileService.updateDatasetProfile(this.profile).subscribe(
|
|
||||||
response => {
|
|
||||||
simple_notifier("success",null,"Saved DMP Profile");
|
|
||||||
console.log(response);
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
simple_notifier("danger",null,"Could not save DMP Profile");
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nullSafeProfile(){
|
|
||||||
if(this.profile==null){
|
|
||||||
console.log("BEFORE:");
|
|
||||||
console.log(this.profile);
|
|
||||||
this.profile = {'label':null, 'definition':null, 'viewstyle':{'label':null, 'definition':null}, 'ruleset':{'label':null, 'definition':null}};
|
|
||||||
console.log("AFTER:");
|
|
||||||
console.log(this.profile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
preventDefaults($event){
|
|
||||||
if($event.code == 'Tab') {
|
|
||||||
$event.preventDefault();
|
|
||||||
//AND NOW HACK THE TAB KEY WITHIN THE TEXT EDITOR
|
|
||||||
var start = $event.srcElement.selectionStart;
|
|
||||||
var end = $event.srcElement.selectionEnd;
|
|
||||||
// set textarea value to: text before caret + tab + text after caret
|
|
||||||
$event.target.value = $event.target.value.substring(0, start)+"\t"+$event.target.value.substring(end);
|
|
||||||
// put caret at right position again
|
|
||||||
$event.srcElement.selectionStart =
|
|
||||||
$event.srcElement.selectionEnd = start + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getTabularDatasets(notifyAlso){
|
|
||||||
|
|
||||||
this.datasetsService.fetchAllDatasets()
|
|
||||||
.map((elems) => {
|
|
||||||
let tmpData = new Array();
|
|
||||||
for (let elem of elems) {
|
|
||||||
let row = {
|
|
||||||
"id": elem.id,
|
|
||||||
"label":elem.label,
|
|
||||||
"dmp": elem.dmp,
|
|
||||||
"uri": elem.uri,
|
|
||||||
"properties": elem.properties,
|
|
||||||
"profile": elem.profile
|
|
||||||
};
|
|
||||||
tmpData.push(row);
|
|
||||||
}
|
|
||||||
return tmpData;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.subscribe((data)=> {
|
|
||||||
this.data = data;
|
|
||||||
if(notifyAlso)
|
|
||||||
simple_notifier("info",null,"Refreshed table");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
onShowingPropertiesModal($event){
|
|
||||||
var trElem = $event.target;
|
|
||||||
while(trElem.nodeName != "TR")
|
|
||||||
trElem = trElem.parentElement;
|
|
||||||
this.clickedDatasetID = trElem.children[0].textContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gotoProfileEditor($event) {
|
|
||||||
var trElem = $event.target;
|
|
||||||
while(trElem.nodeName != "TR")
|
|
||||||
trElem = trElem.parentElement;
|
|
||||||
this.clickedDatasetID = trElem.children[0].textContent;
|
|
||||||
|
|
||||||
if(this.clickedDatasetID == null) console.log("Could not retrieve the id of the clicked dataset");
|
|
||||||
|
|
||||||
var dataset = this.getDatasetFromDataArray(this.clickedDatasetID);
|
|
||||||
if(dataset != null){
|
|
||||||
this.profile = dataset.profile;
|
|
||||||
this.goToEditor();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
getDatasetFromDataArray(datasetID){
|
|
||||||
for(var dataRow of this.data){
|
|
||||||
if(datasetID == dataRow.id)
|
|
||||||
return dataRow;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
deleteDataset(dataset){
|
|
||||||
this.datasetsService.deleteDataset(dataset).subscribe(
|
|
||||||
resp =>{
|
|
||||||
console.log(status);
|
|
||||||
this.refreshTable(null);
|
|
||||||
simple_notifier("success",null,"Dataset was deleted");
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
simple_notifier("danger",null,"Dataset could not be deleted");
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
goToEditor(){
|
|
||||||
this.viewingComponent = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
goToMain(){
|
|
||||||
this.viewingComponent = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
setDmpLabelValueOfDatasetID(datasetID, newVal){
|
|
||||||
for(var i=0;i<this.data.length;i++){
|
|
||||||
var row = this.data[i];
|
|
||||||
if(row.id == datasetID){
|
|
||||||
if(row["dmp"] != null && row["dmp"].label != null)
|
|
||||||
row["dmp"].label = newVal;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setClickedDatasetID($event){
|
|
||||||
var trElem = $event.srcElement;
|
|
||||||
while(trElem.nodeName != "TR")
|
|
||||||
trElem = trElem.parentElement;
|
|
||||||
this.clickedDatasetID = trElem.children[0].textContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
applyConfirmation($event){
|
|
||||||
if($event==true){
|
|
||||||
console.log("will delete dataset: "+ this.clickedDatasetID);
|
|
||||||
//method 1
|
|
||||||
var dataset = {};
|
|
||||||
dataset["id"] = this.clickedDatasetID;
|
|
||||||
dataset["label"] = " ";
|
|
||||||
this.deleteDataset(dataset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
notifyNewDatasetID($event){
|
|
||||||
this.filterQuery = $event;
|
|
||||||
this.refreshTable($event);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
refreshTable($event){
|
|
||||||
this.getTabularDatasets(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
assignDMPToDataset($event, dmpID){
|
|
||||||
var trElem = $event.srcElement;
|
|
||||||
while(trElem.nodeName != "TR")
|
|
||||||
trElem = trElem.parentElement;
|
|
||||||
var datasetID = trElem.children[0].textContent;
|
|
||||||
|
|
||||||
this.datasetsService.assignDMPToDataset(datasetID, dmpID).subscribe(
|
|
||||||
(resp) => {
|
|
||||||
this.setDmpLabelValueOfDatasetID(datasetID, $event.target.text);
|
|
||||||
simple_notifier("success",null,"Assigned the dmp on dataset");
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
simple_notifier("danger",null,"Could not assign the dmp on dataset");
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
.nomargin{
|
|
||||||
margin-top: 0px;
|
|
||||||
margin-bottom: 0px;
|
|
||||||
margin-left: 0px;
|
|
||||||
margin-right: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.width-range {
|
|
||||||
max-width: 500px;
|
|
||||||
min-width: 300px;
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
|
|
||||||
<table class="table">
|
|
||||||
<tbody>
|
|
||||||
<tr align="center">
|
|
||||||
<div class="g-signin2" id="googleBtn"></div>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { GooggleSignInComponent } from './googgle-sign-in.component';
|
|
||||||
|
|
||||||
describe('GooggleSignInComponent', () => {
|
|
||||||
let component: GooggleSignInComponent;
|
|
||||||
let fixture: ComponentFixture<GooggleSignInComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ GooggleSignInComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(GooggleSignInComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,82 +0,0 @@
|
||||||
import { Component, OnInit, ElementRef, AfterViewInit, VERSION } from '@angular/core';
|
|
||||||
import { TokenService, TokenProvider } from '../../services/login/token.service';
|
|
||||||
import {Router} from '@angular/router';
|
|
||||||
|
|
||||||
declare const gapi: any;
|
|
||||||
|
|
||||||
import '../../../assets/custom.js';
|
|
||||||
declare function simple_notifier(type: string, title: string, message:string): any;
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'googgle-sign-in',
|
|
||||||
templateUrl: './googgle-sign-in.component.html',
|
|
||||||
styleUrls: ['./googgle-sign-in.component.css']
|
|
||||||
})
|
|
||||||
export class GooggleSignInComponent implements OnInit, AfterViewInit {
|
|
||||||
|
|
||||||
//token:any;
|
|
||||||
|
|
||||||
constructor(private element: ElementRef, private tokenService : TokenService, private router : Router) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
}
|
|
||||||
|
|
||||||
private clientId:string = '524432312250-sc9qsmtmbvlv05r44onl6l93ia3k9deo.apps.googleusercontent.com';
|
|
||||||
|
|
||||||
private scope = [
|
|
||||||
'profile',
|
|
||||||
'email'
|
|
||||||
//,
|
|
||||||
//'https://www.googleapis.com/auth/plus.me',
|
|
||||||
//'https://www.googleapis.com/auth/contacts.readonly',
|
|
||||||
//'https://www.googleapis.com/auth/admin.directory.user.readonly'
|
|
||||||
].join(' ');
|
|
||||||
|
|
||||||
public auth2: any;
|
|
||||||
|
|
||||||
public googleInit() {
|
|
||||||
|
|
||||||
gapi.load('auth2', () => {
|
|
||||||
this.auth2 = gapi.auth2.init({
|
|
||||||
client_id: this.clientId,
|
|
||||||
cookiepolicy: 'single_host_origin',
|
|
||||||
scope: this.scope
|
|
||||||
});
|
|
||||||
var buttonElement = this.element.nativeElement.querySelector('#googleBtn');
|
|
||||||
this.attachSignin(buttonElement);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public attachSignin(element) {
|
|
||||||
this.auth2.attachClickHandler(element, {},
|
|
||||||
(googleUser) => {
|
|
||||||
simple_notifier("success",null,"Successful login");
|
|
||||||
let profile = googleUser.getBasicProfile();
|
|
||||||
this.tokenService.login(googleUser.getAuthResponse().id_token, TokenProvider.google, profile.getName(), profile.getEmail());
|
|
||||||
}, function (error) {
|
|
||||||
simple_notifier("danger",null,"Failed to login");
|
|
||||||
console.log(JSON.stringify(error, undefined, 2));
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ngAfterViewInit() {
|
|
||||||
this.googleInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
signOut() {
|
|
||||||
var auth2 = gapi.auth2.getAuthInstance();
|
|
||||||
auth2.signOut().then(function () {
|
|
||||||
console.log('User signed out.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
.form-signin
|
|
||||||
{
|
|
||||||
max-width: 330px;
|
|
||||||
padding: 15px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
.form-signin .form-signin-heading, .form-signin .checkbox
|
|
||||||
{
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
.form-signin .checkbox
|
|
||||||
{
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
.form-signin .form-control
|
|
||||||
{
|
|
||||||
position: relative;
|
|
||||||
font-size: 16px;
|
|
||||||
height: auto;
|
|
||||||
padding: 10px;
|
|
||||||
-webkit-box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.form-signin .form-control:focus
|
|
||||||
{
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
.form-signin input[type="text"]
|
|
||||||
{
|
|
||||||
margin-bottom: -1px;
|
|
||||||
border-bottom-left-radius: 0;
|
|
||||||
border-bottom-right-radius: 0;
|
|
||||||
}
|
|
||||||
.form-signin input[type="password"]
|
|
||||||
{
|
|
||||||
margin-bottom: 10px;
|
|
||||||
border-top-left-radius: 0;
|
|
||||||
border-top-right-radius: 0;
|
|
||||||
}
|
|
||||||
.account-wall
|
|
||||||
{
|
|
||||||
margin-top: 20px;
|
|
||||||
padding: 40px 0px 20px 0px;
|
|
||||||
background-color: #f7f7f7;
|
|
||||||
-moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
|
||||||
-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
|
||||||
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
|
||||||
}
|
|
||||||
.login-title
|
|
||||||
{
|
|
||||||
color: #555;
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 400;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
.profile-img
|
|
||||||
{
|
|
||||||
width: 96px;
|
|
||||||
height: 96px;
|
|
||||||
margin: 0 auto 10px;
|
|
||||||
display: block;
|
|
||||||
-moz-border-radius: 50%;
|
|
||||||
-webkit-border-radius: 50%;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
.need-help
|
|
||||||
{
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
.new-account
|
|
||||||
{
|
|
||||||
display: block;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<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="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>
|
|
||||||
<button class="btn btn-lg btn-primary btn-block" type="submit" (click)="login()">
|
|
||||||
Sign in
|
|
||||||
</button>
|
|
||||||
<label class="checkbox pull-left">
|
|
||||||
<input type="checkbox" value="remember-me">
|
|
||||||
Remember me
|
|
||||||
</label>
|
|
||||||
<a href="#" class="pull-right need-help">Need help? </a><span class="clearfix"></span>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<p>Form value: {{ nativeLoginForm.value | json }}</p>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<a href="#" class="text-center new-account">Create an account </a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-6 col-md-4 col-md-offset-4">
|
|
||||||
<div class="account-wall">
|
|
||||||
<h1 class="text-center login-title"></h1>
|
|
||||||
<h4 class="text-center">Sign in with social</h4>
|
|
||||||
<googgle-sign-in></googgle-sign-in>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { MainSignInComponent } from './main-sign-in.component';
|
|
||||||
|
|
||||||
describe('MainSignInComponent', () => {
|
|
||||||
let component: MainSignInComponent;
|
|
||||||
let fixture: ComponentFixture<MainSignInComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ MainSignInComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(MainSignInComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,93 +0,0 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
||||||
import { NativeLoginService } from '../../services/login/native-login.service';
|
|
||||||
import { TokenService, TokenProvider } from '../../services/login/token.service';
|
|
||||||
import { Router } from '@angular/router';
|
|
||||||
|
|
||||||
import '../../../assets/custom.js';
|
|
||||||
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',
|
|
||||||
templateUrl: './main-sign-in.component.html',
|
|
||||||
styleUrls: ['./main-sign-in.component.css']
|
|
||||||
})
|
|
||||||
export class MainSignInComponent implements OnInit {
|
|
||||||
|
|
||||||
|
|
||||||
nativeLoginForm: any;
|
|
||||||
|
|
||||||
creds: any = { "username": "", "password": "" };
|
|
||||||
|
|
||||||
|
|
||||||
constructor(private fb: FormBuilder, private nativeLogin: NativeLoginService, private tokenService: TokenService,
|
|
||||||
private router: Router, private authservice: AuthService, public route: ActivatedRoute, private zone: NgZone) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
createProjectEditorForm() {
|
|
||||||
|
|
||||||
this.nativeLoginForm = this.fb.group({
|
|
||||||
username: ['', Validators.required],
|
|
||||||
password: ['', Validators.required]
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
this.createProjectEditorForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
login() {
|
|
||||||
//login using the credentials
|
|
||||||
|
|
||||||
// this.nativeLogin.login(this.creds.username, this.creds.password).subscribe(
|
|
||||||
// response => {
|
|
||||||
|
|
||||||
// simple_notifier("success",null,"Successful login");
|
|
||||||
|
|
||||||
// this.tokenService.login(response['token'], TokenProvider.native, this.creds.username, response['email']);
|
|
||||||
|
|
||||||
// },
|
|
||||||
// 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']
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,172 +0,0 @@
|
||||||
|
|
||||||
/* MY CUSTOM CSS */
|
|
||||||
|
|
||||||
.float-left{
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
#3a679c
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* SIDEBAR's CSS */
|
|
||||||
.nav-side-menu {
|
|
||||||
overflow: auto;
|
|
||||||
font-family: verdana;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 200;
|
|
||||||
background-color: #557DAA;
|
|
||||||
position: inherit;
|
|
||||||
top: 0px;
|
|
||||||
width: 300px;
|
|
||||||
height: 100%;
|
|
||||||
color: #e1ffff;
|
|
||||||
}
|
|
||||||
.nav-side-menu .brand {
|
|
||||||
background-color: #345881;
|
|
||||||
line-height: 50px;
|
|
||||||
display: block;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
.nav-side-menu .toggle-btn {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.nav-side-menu ul,
|
|
||||||
.nav-side-menu li {
|
|
||||||
list-style: none;
|
|
||||||
padding: 0px;
|
|
||||||
margin: 0px;
|
|
||||||
line-height: 35px;
|
|
||||||
cursor: pointer;
|
|
||||||
/*
|
|
||||||
.collapsed{
|
|
||||||
.arrow:before{
|
|
||||||
font-family: FontAwesome;
|
|
||||||
content: "\f053";
|
|
||||||
display: inline-block;
|
|
||||||
padding-left:10px;
|
|
||||||
padding-right: 10px;
|
|
||||||
vertical-align: middle;
|
|
||||||
float:right;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
.nav-side-menu ul :not(collapsed) .arrow:before,
|
|
||||||
.nav-side-menu li :not(collapsed) .arrow:before {
|
|
||||||
font-family: FontAwesome;
|
|
||||||
content: "\f078";
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 10px;
|
|
||||||
padding-right: 10px;
|
|
||||||
vertical-align: middle;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
.nav-side-menu ul .active,
|
|
||||||
.nav-side-menu li .active {
|
|
||||||
border-left: 3px solid #d19b3d;
|
|
||||||
background-color: #587AA1;
|
|
||||||
}
|
|
||||||
.nav-side-menu ul .sub-menu li.active,
|
|
||||||
.nav-side-menu li .sub-menu li.active {
|
|
||||||
color: #d19b3d;
|
|
||||||
}
|
|
||||||
.nav-side-menu ul .sub-menu li.active a,
|
|
||||||
.nav-side-menu li .sub-menu li.active a {
|
|
||||||
color: #d19b3d;
|
|
||||||
}
|
|
||||||
.nav-side-menu ul .sub-menu li,
|
|
||||||
.nav-side-menu li .sub-menu li {
|
|
||||||
background-color: #181c20;
|
|
||||||
border: none;
|
|
||||||
line-height: 28px;
|
|
||||||
border-bottom: 1px solid #18375A;
|
|
||||||
margin-left: 0px;
|
|
||||||
}
|
|
||||||
.nav-side-menu ul .sub-menu li:hover,
|
|
||||||
.nav-side-menu li .sub-menu li:hover {
|
|
||||||
background-color: #020203;
|
|
||||||
}
|
|
||||||
.nav-side-menu ul .sub-menu li:before,
|
|
||||||
.nav-side-menu li .sub-menu li:before {
|
|
||||||
font-family: FontAwesome;
|
|
||||||
content: "\f105";
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 10px;
|
|
||||||
padding-right: 10px;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
.nav-side-menu li {
|
|
||||||
padding-left: 0px;
|
|
||||||
border-left: 3px solid #2e353d;
|
|
||||||
border-bottom: 1px solid #23282e;
|
|
||||||
}
|
|
||||||
.nav-side-menu li a {
|
|
||||||
text-decoration: none;
|
|
||||||
color: #e1ffff;
|
|
||||||
}
|
|
||||||
.nav-side-menu li a i {
|
|
||||||
padding-left: 10px;
|
|
||||||
width: 20px;
|
|
||||||
padding-right: 20px;
|
|
||||||
}
|
|
||||||
.nav-side-menu li:hover {
|
|
||||||
border-left: 3px solid #d19b3d;
|
|
||||||
background-color: #4f5b69;
|
|
||||||
-webkit-transition: all 1s ease;
|
|
||||||
-moz-transition: all 1s ease;
|
|
||||||
-o-transition: all 1s ease;
|
|
||||||
-ms-transition: all 1s ease;
|
|
||||||
transition: all 1s ease;
|
|
||||||
}
|
|
||||||
@media (max-width: 767px) {
|
|
||||||
.nav-side-menu {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
.nav-side-menu .toggle-btn {
|
|
||||||
display: block;
|
|
||||||
cursor: pointer;
|
|
||||||
position: absolute;
|
|
||||||
right: 10px;
|
|
||||||
top: 10px;
|
|
||||||
z-index: 10 !important;
|
|
||||||
padding: 3px;
|
|
||||||
background-color: #ffffff;
|
|
||||||
color: #000;
|
|
||||||
width: 40px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.brand {
|
|
||||||
text-align: left !important;
|
|
||||||
font-size: 22px;
|
|
||||||
padding-left: 20px;
|
|
||||||
line-height: 50px !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@media (min-width: 767px) {
|
|
||||||
.nav-side-menu .menu-list .menu-content {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
body {
|
|
||||||
margin: 0px;
|
|
||||||
padding: 0px;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/* END OF SIDEBAR's CSS */
|
|
||||||
|
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
<div class="float-left">
|
|
||||||
<div class="nav-side-menu">
|
|
||||||
<div class="brand">Quick Navigation</div>
|
|
||||||
<i class="fa fa-bars fa-2x toggle-btn" data-toggle="collapse" data-target="#menu-content"></i>
|
|
||||||
|
|
||||||
<div class="menu-list">
|
|
||||||
|
|
||||||
<ul id="menu-content" class="menu-content collapse out">
|
|
||||||
|
|
||||||
<li data-toggle="collapse" data-target="#manage-datasets" class="collapsed">
|
|
||||||
<a style="cursor:pointer"><i class="fa fa-file-text-o"></i> Manage Datasets <span class="arrow"></span></a>
|
|
||||||
</li>
|
|
||||||
<ul class="sub-menu collapse" id="manage-datasets">
|
|
||||||
<li [ngClass]="{true:'active'}[currentlySelected=='datasets']" (click)="setActive('datasets')" [routerLink]="['/datasets']" ><a style="cursor:pointer">Datasets</a></li>
|
|
||||||
<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-users" class="collapsed">
|
|
||||||
<a style="cursor:pointer"><i class="fa fa-newspaper-o"></i> Users <span class="arrow"></span></a>
|
|
||||||
</li>
|
|
||||||
<ul class="sub-menu collapse" id="manage-users">
|
|
||||||
<li [ngClass]="{true:'active'}[currentlySelected=='users']" (click)="setActive('users')" >User List</li>
|
|
||||||
</ul>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="float-left">
|
|
||||||
|
|
||||||
<router-outlet></router-outlet>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { MainWindowComponent } from './main-window.component';
|
|
||||||
|
|
||||||
describe('MainWindowComponent', () => {
|
|
||||||
let component: MainWindowComponent;
|
|
||||||
let fixture: ComponentFixture<MainWindowComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ MainWindowComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(MainWindowComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,31 +0,0 @@
|
||||||
import { Component, OnInit, Input } from '@angular/core';
|
|
||||||
import { TokenService } from '../services/login/token.service';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'main-window',
|
|
||||||
templateUrl: './main-window.component.html',
|
|
||||||
styleUrls: ['../../assets/simple-sidebar.css', './main-window.component.css']
|
|
||||||
})
|
|
||||||
export class MainWindowComponent implements OnInit {
|
|
||||||
|
|
||||||
constructor(public tokenService : TokenService) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//@Input() loggedInAs;
|
|
||||||
|
|
||||||
showSidebar : boolean = true;
|
|
||||||
|
|
||||||
currentlySelected : string = "";
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
setActive(val) {
|
|
||||||
this.currentlySelected = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
<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>
|
|
|
@ -1,146 +0,0 @@
|
||||||
|
|
||||||
// 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
|
|
||||||
// }
|
|
||||||
// }
|
|
|
@ -1,121 +0,0 @@
|
||||||
|
|
||||||
<div class="editor-container container">
|
|
||||||
|
|
||||||
<div [ngClass]="{true:'visible', false:'invisible'}[tableVisible]">
|
|
||||||
<table class="table table-striped" [mfData]="tableData | datasetProfileTableFilter : 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>
|
|
||||||
<th>
|
|
||||||
<button type="button" class="btn btn-sm btn-primary btn-create" data-toggle="modal" data-target="#newdataset-modal-container" [routerLink]="['/form']">Create New</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="created">Created</mfDefaultSorter></th>
|
|
||||||
<th><mfDefaultSorter by="description">Description</mfDefaultSorter></th>
|
|
||||||
<th><mfDefaultSorter by="status">Status</mfDefaultSorter></th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr class="grayout-empty-table" *ngIf="!mf.data[0]" [contextMenu]="basicMenu" [contextMenuSubject]="datasetProfile"> <td colspan="5">No elements</td></tr>
|
|
||||||
<tr *ngFor="let datasetProfile of mf.data" class="hover" [contextMenu]="basicMenu" [contextMenuSubject]="datasetProfile">
|
|
||||||
<!-- <td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{datasetProfile.id}}</td> -->
|
|
||||||
<td>{{datasetProfile?.label}}</td>
|
|
||||||
<td>{{datasetProfile?.created}}</td>
|
|
||||||
<td>{{datasetProfile?.description}}</td>
|
|
||||||
<td>{{datasetProfile?.status}}</td>
|
|
||||||
<td><button type="button" class="btn btn-sm btn-primary btn-create" data-toggle="modal" data-target="#newdataset-modal-container" [routerLink]="['/form/'+datasetProfile.id]">Go</button></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]="datasetProfileEditorForm" novalidate style="display:block;">
|
|
||||||
<div class="form-group" [ngClass]="{null:'invisible'}[editingDatasetProfile?.id]">
|
|
||||||
<label class="center-block">ID: {{datasetProfile?.id}}
|
|
||||||
<input class="form-control invisible" formControlName="id" [ngModel]="editingDatasetProfile?.id">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="center-block">Label:
|
|
||||||
<input class="form-control" formControlName="label" [ngModel]="editingDatasetProfile?.label" (ngModelChange)="editingDatasetProfile.label=$event">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="center-block">Ruleset:
|
|
||||||
<input class="form-control" formControlName="ruleset" [ngModel]="editingDatasetProfile?.ruleset" (ngModelChange)="editingDatasetProfile.ruleset=$event">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="center-block">Viewstyle:
|
|
||||||
<input class="form-control" formControlName="viewstyle" [ngModel]="editingDatasetProfile?.viewstyle" (ngModelChange)="editingDatasetProfile.viewstyle$event">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="center-block">Definition:
|
|
||||||
<input class="form-control" formControlName="definition" [ngModel]="editingDatasetProfile?.definition" (ngModelChange)="editingDatasetProfile.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: {{ datasetProfileEditorForm.value | json }}</p>
|
|
||||||
-->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<context-menu>
|
|
||||||
<ng-template contextMenuItem [subMenu]="manage">
|
|
||||||
<span></span>Manage Dataset Profiles
|
|
||||||
</ng-template>
|
|
||||||
<context-menu #manage>
|
|
||||||
<ng-template contextMenuItem (execute)="new($event?.item)">
|
|
||||||
<span class="glyphicon glyphicon-plus"></span>Create Dataset profile
|
|
||||||
</ng-template>
|
|
||||||
<ng-template contextMenuItem (execute)="edit($event?.item?.id)">
|
|
||||||
<span class="glyphicon glyphicon-pencil"></span>Edit this Dataset profile
|
|
||||||
</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>
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { DatasetprofileEditorComponent } from './datasetprofile-editor.component';
|
|
||||||
|
|
||||||
describe('DatasetprofileEditorComponent', () => {
|
|
||||||
let component: DatasetprofileEditorComponent;
|
|
||||||
let fixture: ComponentFixture<DatasetprofileEditorComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ DatasetprofileEditorComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(DatasetprofileEditorComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,132 +0,0 @@
|
||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
||||||
import { DatasetProfileService } from '../../services/dataset-profile.service';
|
|
||||||
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-datasetprofile-editor',
|
|
||||||
templateUrl: './datasetprofile-editor.component.html',
|
|
||||||
styleUrls: ['./datasetprofile-editor.component.css']
|
|
||||||
})
|
|
||||||
export class DatasetprofileEditorComponent implements OnInit {
|
|
||||||
|
|
||||||
|
|
||||||
constructor(private datasetProfileService : DatasetProfileService, private fb: FormBuilder) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//whole dmp data model
|
|
||||||
tableData : any[] = new Array();
|
|
||||||
|
|
||||||
//DatasetProfile editor data model
|
|
||||||
editingDatasetProfile: any = {};
|
|
||||||
datasetProfileEditorForm : 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.getAllDatasetProfiles(false);
|
|
||||||
this.createDatasetProfileEditorForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
createDatasetProfileEditorForm(){
|
|
||||||
this.datasetProfileEditorForm = this.fb.group({
|
|
||||||
id: '',
|
|
||||||
label: ['', Validators.required ],
|
|
||||||
ruleset: '',
|
|
||||||
viewstyle: '',
|
|
||||||
definition: ''
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
switchToTable(){
|
|
||||||
this.tableVisible = true;
|
|
||||||
this.editorVisible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
switchToEditor(datasetProfileID){
|
|
||||||
this.tableVisible = false;
|
|
||||||
this.editorVisible = true;
|
|
||||||
if(datasetProfileID == null){
|
|
||||||
this.editingDatasetProfile = {id: null, label: "", created: "", description: "", status: "" };
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.editingDatasetProfile = this.tableData.filter((datasetProfile) => datasetProfile.id === datasetProfileID)[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
getAllDatasetProfiles(showNotification : boolean){
|
|
||||||
this.datasetProfileService.fetchAllDatasetProfiles().subscribe( (data) => {
|
|
||||||
this.tableData = data.payload;
|
|
||||||
if(showNotification)
|
|
||||||
simple_notifier("info",null,"Refreshed the table");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
edit(data){
|
|
||||||
this.switchToEditor(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
new(){
|
|
||||||
this.switchToEditor(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
save(mouseEvent){
|
|
||||||
this.datasetProfileService.createDatasetProfile(this.datasetProfileEditorForm.value).subscribe(
|
|
||||||
response => {
|
|
||||||
simple_notifier("success",null,"Saved dataset Profile");
|
|
||||||
this.getAllDatasetProfiles(false);
|
|
||||||
this.switchToTable();
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
simple_notifier("danger",null,"Could not save dataset Profile");
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete(data){
|
|
||||||
console.log(data);
|
|
||||||
this.datasetProfileService.delete(data).subscribe(
|
|
||||||
(response) => {
|
|
||||||
simple_notifier("success",null,"Deleted dataset profile");
|
|
||||||
this.getAllDatasetProfiles(false);
|
|
||||||
this.switchToTable();
|
|
||||||
},
|
|
||||||
(err) => {
|
|
||||||
simple_notifier("danger",null,"Could not delete dataset profile");
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
refreshTable($event){
|
|
||||||
this.getAllDatasetProfiles(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -1,100 +0,0 @@
|
||||||
|
|
||||||
<div class="editor-container container">
|
|
||||||
|
|
||||||
<div [ngClass]="{true:'visible', false:'invisible'}[tableVisible]">
|
|
||||||
<table class="table table-striped" [mfData]="tableData | dmpProfileTableFilter : 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="definition">Definition</mfDefaultSorter></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr class="grayout-empty-table" *ngIf="!mf.data[0]" [contextMenu]="basicMenu" [contextMenuSubject]="dmpProfile"> <td colspan="3">No elements</td></tr>
|
|
||||||
<tr *ngFor="let dmpProfile of mf.data" class="hover" [contextMenu]="basicMenu" [contextMenuSubject]="dmpProfile">
|
|
||||||
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{dmpProfile.id}}</td>
|
|
||||||
<td>{{dmpProfile?.label}}</td>
|
|
||||||
<td>{{dmpProfile?.definition}}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<td colspan="3">
|
|
||||||
<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]="dmpProfileEditorForm" novalidate style="display:block;">
|
|
||||||
<div class="form-group" [ngClass]="{null:'invisible'}[editingDmpProfile?.id]">
|
|
||||||
<label class="center-block">ID: {{editingProject?.id}}
|
|
||||||
<input class="form-control invisible" formControlName="id" [ngModel]="editingDmpProfile?.id">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="center-block">Label:
|
|
||||||
<input class="form-control" formControlName="label" [ngModel]="editingDmpProfile?.label" (ngModelChange)="editingDmpProfile.label=$event">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="center-block">Definition:
|
|
||||||
<input class="form-control" formControlName="definition" [ngModel]="editingDmpProfile?.definition" (ngModelChange)="editingDmpProfile.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: {{ dmpProfileEditorForm.value | json }}</p>
|
|
||||||
-->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<context-menu>
|
|
||||||
<ng-template contextMenuItem [subMenu]="manage">
|
|
||||||
<span></span>Manage DMP Profiles
|
|
||||||
</ng-template>
|
|
||||||
<context-menu #manage>
|
|
||||||
<ng-template contextMenuItem (execute)="newDmpProfile($event?.item)">
|
|
||||||
<span class="glyphicon glyphicon-plus"></span>Create DMP Profile
|
|
||||||
</ng-template>
|
|
||||||
<ng-template contextMenuItem (execute)="editDmpProfile($event?.item?.id)">
|
|
||||||
<span class="glyphicon glyphicon-pencil"></span>Edit this DMP Profile
|
|
||||||
</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>
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue