This commit is contained in:
Ioannis Kalyvas 2018-06-28 12:39:39 +03:00
commit cd8b3448f5
1278 changed files with 38431 additions and 52786 deletions

6
.env Normal file
View File

@ -0,0 +1,6 @@
TAG=6.2.1
ENV=dev
PROFILE=production
AOT=no-aot
ELASTIC_VERSION=6.2.1
ELASTIC_PASSWORD=changeme

7
.gitignore vendored
View File

@ -19,8 +19,9 @@ dmp-backend/src/main/ui-resources/static/favicon.ico
dmp-backend/src/main/ui-resources/static/assets/lang/en.json
dmp-frontend/new 3.xml
dmp-backend/src/main/ui-resources/static/
dmp-backend/data/target/
dmp-backend/web/target/
dmp-backend/queryable/target/
dmp-backend/logging/target/
*.class
dmp-backend/web/src/main/ui-resources/static/
dmp-backend/data/target/data-1.0-SNAPSHOT.jar
dmp-backend/data/target/
dmp-backend/queryable/target/

3
ELK.Docker/.env Normal file
View File

@ -0,0 +1,3 @@
TAG=6.2.1
ELASTIC_VERSION=6.2.1
ELASTIC_PASSWORD=changeme

1
ELK.Docker/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
**/*~

7
ELK.Docker/.travis.yml Normal file
View File

@ -0,0 +1,7 @@
---
language: python
python: ['3.5']
script: make
sudo: required
services: ['docker']

201
ELK.Docker/LICENSE Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

30
ELK.Docker/Makefile Normal file
View File

@ -0,0 +1,30 @@
SHELL=/bin/bash
ifndef ELASTIC_VERSION
ELASTIC_VERSION := $(shell awk 'BEGIN { FS = "[= ]" } /^ELASTIC_VERSION=/ { print $$2 }' .env)
endif
export ELASTIC_VERSION
ifndef GIT_BRANCH
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
endif
TARGETS := apm-server elasticsearch logstash kibana beats
images: $(TARGETS)
push: $(TARGETS:%=%-push)
clean: $(TARGETS:%=%-clean)
$(TARGETS): $(TARGETS:%=%-checkout)
(cd stack/$@ && make)
$(TARGETS:%=%-push): $(TARGETS:%=%-checkout)
(cd stack/$(@:%-push=%) && make push)
$(TARGETS:%=%-checkout):
test -d stack/$(@:%-checkout=%) || \
git clone https://github.com/elastic/$(@:%-checkout=%)-docker.git stack/$(@:%-checkout=%)
(cd stack/$(@:%-checkout=%) && git fetch && git reset --hard && git checkout origin/$(GIT_BRANCH))
$(TARGETS:%=%-clean):
rm -rf stack/$(@:%-clean=%)

25
ELK.Docker/README.md Normal file
View File

@ -0,0 +1,25 @@
# stack-docker
This example Docker Compose configuration demonstrates many components of the
Elastic Stack, all running on a single machine under Docker.
## Prerequisites
- Docker and Compose. Windows and Mac users get Compose installed automatically
with Docker. Linux users can:
```
pip install docker-compose
```
- At least 4GiB of RAM for the containers. Windows and Mac users _must_
configure their Docker virtual machine to have more than the default 2 GiB of
RAM:
![Docker VM memory settings](screenshots/docker-vm-memory-settings.png)
## Starting the stack
Try `docker-compose up` to create a demonstration Elastic Stack with
Elasticsearch, Kibana, Logstash, Auditbeat, Metricbeat, Filebeat, Packetbeat,
and Heartbeat.
Point a browser at [`http://localhost:5601`](http://localhost:5601) to see the results.
Log in with `elastic` / `changeme`.

View File

@ -0,0 +1,28 @@
input {
http {
port => 31311 # default: 8080
}
}
filter {
grok{
match => { "message" => "%{GREEDYDATA:request}"}
}
json{
source => "request"
target => "parsed"
}
split{
field=>"entries"
}
}
output {
elasticsearch {
hosts => [ 'elasticsearch' ]
user => 'elastic'
password => 'changeme'
index => "data-management-plan-%{[entries][indexType]}-%{+YYYY.MM.dd}"
}
}

View File

@ -0,0 +1,106 @@
---
version: '3'
services:
# The environment variable "TAG" is used throughout this file to
# specify the version of the images to run. The default is set in the
# '.env' file in this folder. It can be overridden with any normal
# technique for setting environment variables, for example:
#
# TAG=6.0.0-beta1 docker-compose up
#
# REF: https://docs.docker.com/compose/compose-file/#variable-substitution
#
# Also be sure to set the ELASTIC_VERSION variable. For released versions,
# ${TAG} and ${ELASTIC_VERSION} will be identical, but for pre-release
# versions, ${TAG} might contain an extra build identifier, like
# "6.0.0-beta1-3eab5b40", so a full invocation might look like:
#
# ELASTIC_VERSION=6.0.0-beta1 TAG=6.0.0-beta1-3eab5b40 docker-compose up
#
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${TAG}
container_name: elasticsearch
#volumes:
# - esdata:/usr/share/elasticsearch/data
environment: ['http.host=0.0.0.0', 'transport.host=127.0.0.1', 'ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
ports: ['0.0.0.0:9200:9200']
networks: ['stack']
kibana:
image: docker.elastic.co/kibana/kibana:${TAG}
container_name: kibana
ports: ['0.0.0.0:5601:5601']
networks: ['stack']
depends_on: ['elasticsearch']
logstash:
image: docker.elastic.co/logstash/logstash:${TAG}
container_name: logstash
# Provide a simple pipeline configuration for Logstash with a bind-mounted file.
volumes:
- ./config/logstash.conf:/usr/share/logstash/pipeline/logstash.conf
ports: ['0.0.0.0:31311:31311']
networks: ['stack']
depends_on: ['elasticsearch', 'setup_logstash']
filebeat:
image: docker.elastic.co/beats/filebeat:${TAG}
container_name: filebeat
command: -e -E 'output.elasticsearch.password=${ELASTIC_PASSWORD}'
# If the host system has logs at "/var/log", mount them at "/mnt/log"
# inside the container, where Filebeat can find them.
# volumes: ['/var/log:/mnt/log:ro']
networks: ['stack']
depends_on: ['elasticsearch', 'setup_filebeat']
heartbeat:
image: docker.elastic.co/beats/heartbeat:${TAG}
container_name: heartbeat
command: -e -E 'output.elasticsearch.password=${ELASTIC_PASSWORD}'
networks: ['stack']
depends_on: ['elasticsearch', 'setup_heartbeat']
# Run a short-lived container to set up Logstash.
setup_logstash:
image: centos:7
container_name: setup_logstash
volumes: ['./scripts/setup-logstash.sh:/usr/local/bin/setup-logstash.sh:ro']
# The script may have CR/LF line endings if using Docker for Windows, so
# make sure that they don't confuse Bash.
command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-logstash.sh | tr -d "\r" | bash']
environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
networks: ['stack']
depends_on: ['elasticsearch']
setup_kibana:
image: centos:7
container_name: setup_kibana
volumes: ['./scripts/setup-kibana.sh:/usr/local/bin/setup-kibana.sh:ro']
command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-kibana.sh | tr -d "\r" | bash']
environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
networks: ['stack']
depends_on: ['elasticsearch']
setup_filebeat:
image: docker.elastic.co/beats/filebeat:${TAG}
container_name: setup_filebeat
volumes: ['./scripts/setup-beat.sh:/usr/local/bin/setup-beat.sh:ro']
command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-beat.sh | tr -d "\r" | bash -s filebeat']
environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
networks: ['stack']
depends_on: ['kibana']
setup_heartbeat:
image: docker.elastic.co/beats/heartbeat:${TAG}
container_name: setup_heartbeat
volumes: ['./scripts/setup-beat.sh:/usr/local/bin/setup-beat.sh:ro']
command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-beat.sh | tr -d "\r" | bash -s heartbeat']
environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
networks: ['stack']
depends_on: ['kibana']
#volumes:
#esdata:
# driver: local
networks: {stack: {}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -0,0 +1,18 @@
#!/bin/bash
set -euo pipefail
beat=$1
until curl -s http://kibana:5601; do
sleep 2
done
sleep 5
# Load the sample dashboards for the Beat.
# REF: https://www.elastic.co/guide/en/beats/metricbeat/master/metricbeat-sample-dashboards.html
${beat} setup \
-E setup.kibana.host=kibana \
-E setup.kibana.username=elastic \
-E setup.kibana.password=${ELASTIC_PASSWORD} \
-E output.elasticsearch.password=${ELASTIC_PASSWORD}

View File

@ -0,0 +1,10 @@
#!/bin/bash
set -euo pipefail
es_url=http://elastic:${ELASTIC_PASSWORD}@elasticsearch:9200
# Wait for Elasticsearch to start up before doing anything.
until curl -s $es_url -o /dev/null; do
sleep 1
done

View File

@ -0,0 +1,10 @@
#!/bin/bash
set -euo pipefail
es_url=http://elastic:${ELASTIC_PASSWORD}@elasticsearch:9200
# Wait for Elasticsearch to start up before doing anything.
until curl -s $es_url -o /dev/null; do
sleep 1
done

2
ELK.Docker/stack/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!/.gitignore

View File

@ -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": {}
}
}

43
dmp-admin/.gitignore vendored
View File

@ -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

View File

@ -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).

View File

@ -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!');
});
});

View File

@ -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();
}
}

View File

@ -1,14 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"baseUrl": "./",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}

11780
dmp-admin/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -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"
}
}

View File

@ -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;
}

View File

@ -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>

View File

@ -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!');
}));
});

View File

@ -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();
}
}

View File

@ -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'
}

View File

@ -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 { }

View File

@ -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;
}

View File

@ -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">&times;</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>

View File

@ -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();
});
});

View File

@ -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);
}
}

View File

@ -1,7 +0,0 @@
.form-control {
width: 540px;
}
.form-control.props{
height: 240px;
}

View File

@ -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">&times;</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>

View File

@ -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();
});
});

View File

@ -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);
}
);
}
}

View File

@ -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;
}

View File

@ -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>

View File

@ -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();
});
});

View File

@ -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;
}
}
}

View File

@ -1,3 +0,0 @@
textarea.custom{
border-style: dotted;
}

View File

@ -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">&times;</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>

View File

@ -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();
});
});

View File

@ -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;
}
}
}

View File

@ -1,4 +0,0 @@
export enum ValidationTypes {
None = 0,
Required = 1
}

View File

@ -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>

View File

@ -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());
}
}

View File

@ -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>

View File

@ -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());
}
}

View File

@ -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>

View File

@ -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());
}
}

View File

@ -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>

View File

@ -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");
}
}

View File

@ -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>

View File

@ -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());
}
}

View File

@ -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>

View File

@ -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);
}
}

View File

@ -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>

View File

@ -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());
}
}

View File

@ -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>

View File

@ -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);
}
}

View File

@ -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: [
]
};
}
}

View File

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

View File

@ -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[];
}

View File

@ -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 });
}
}

View File

@ -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>

View File

@ -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);
}
}

View File

@ -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 { }

View File

@ -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
}
];

View File

@ -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>

View File

@ -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");
}
}

View File

@ -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>

View File

@ -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();
}
}

View File

@ -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>

View File

@ -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);
}
}

View File

@ -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>

View File

@ -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() {
}
}

View File

@ -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>

View File

@ -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(){
}
}

View File

@ -1,5 +0,0 @@
.section-container {
background-color: #f5f5f5;
border: 1px solid #e3e3e3;
padding: 24px;
}

View File

@ -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>

View File

@ -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();
}
}

View File

@ -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>

View File

@ -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();
});
});

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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 -->

View File

@ -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();
});
});

View File

@ -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");
}
);
}
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -1,12 +0,0 @@
<table class="table">
<tbody>
<tr align="center">
<div class="g-signin2" id="googleBtn"></div>
</tr>
</tbody>
</table>

View File

@ -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();
});
});

View File

@ -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.');
});
}
*/
}

View File

@ -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;
}

View File

@ -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>

View File

@ -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();
});
});

View File

@ -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']
// })
}
}

View File

@ -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 */

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