Merge branch 'master' of git@gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot.git

This commit is contained in:
Nikolaos Laskaris 2017-10-19 12:35:48 +03:00
commit 67caeffa54
26 changed files with 857 additions and 282 deletions

View File

@ -16,7 +16,7 @@ export class RestBase {
} }
protocol: string = "http"; protocol: string = "http";
hostname: string = "localhost";//"dl010.madgik.di.uoa.gr";// hostname: string = "dionysus.di.uoa.gr";//"dl010.madgik.di.uoa.gr";//
port: number = 7070;//8080;// port: number = 7070;//8080;//
webappname: string = "dmp-backend";//"dmp-backend-new";// webappname: string = "dmp-backend";//"dmp-backend-new";//
restpath: string = "rest"; restpath: string = "rest";

View File

@ -450,9 +450,6 @@ ALTER TABLE ONLY "DatasetService"
ADD CONSTRAINT "DatasetServiceServiceReference" FOREIGN KEY ("Service") REFERENCES "Service"("ID"); ADD CONSTRAINT "DatasetServiceServiceReference" FOREIGN KEY ("Service") REFERENCES "Service"("ID");
DROP table if exists "UserDMP";
DROP table if exists "UserInfo";
DROP table if exists "UserAuth";
CREATE TABLE "UserInfo" ( CREATE TABLE "UserInfo" (
"id" uuid DEFAULT uuid_generate_v4() UNIQUE NOT NULL, "id" uuid DEFAULT uuid_generate_v4() UNIQUE NOT NULL,
@ -488,13 +485,13 @@ COMMENT ON COLUMN "UserAuth"."password" IS 'This field stores a password hash';
create table "UserDMP" ( create table "UserDMP" (
"id" uuid DEFAULT uuid_generate_v4() NOT NULL, "id" uuid DEFAULT uuid_generate_v4() NOT NULL,
"user" uuid NOT NULL, "usr" uuid NOT NULL,
"dmp" uuid NOT NUll, "dmp" uuid NOT NUll,
"role" integer "role" integer
); );
ALTER TABLE "UserDMP" ADD CONSTRAINT fkey_userdmp_user FOREIGN KEY ("user") REFERENCES "UserInfo"("id"); ALTER TABLE "UserDMP" ADD CONSTRAINT fkey_userdmp_user FOREIGN KEY (usr) REFERENCES "UserInfo"("id");
ALTER TABLE "UserDMP" ADD CONSTRAINT fkey_userdmp_dmp FOREIGN KEY ("dmp") REFERENCES "DMP"("ID"); ALTER TABLE "UserDMP" ADD CONSTRAINT fkey_userdmp_dmp FOREIGN KEY (dmp) REFERENCES "DMP"("ID");
ALTER TABLE "UserInfo" OWNER TO dmptool; ALTER TABLE "UserInfo" OWNER TO dmptool;

View File

@ -175,6 +175,16 @@
"tslib": "1.7.1" "tslib": "1.7.1"
} }
}, },
"@angular/platform-server": {
"version": "4.4.5",
"resolved": "https://registry.npmjs.org/@angular/platform-server/-/platform-server-4.4.5.tgz",
"integrity": "sha1-dvI7LDhO1zldwXk8+Fl4iDuiy1A=",
"requires": {
"parse5": "3.0.2",
"tslib": "1.7.1",
"xhr2": "0.1.4"
}
},
"@angular/router": { "@angular/router": {
"version": "4.3.6", "version": "4.3.6",
"resolved": "https://registry.npmjs.org/@angular/router/-/router-4.3.6.tgz", "resolved": "https://registry.npmjs.org/@angular/router/-/router-4.3.6.tgz",
@ -240,8 +250,7 @@
"@types/node": { "@types/node": {
"version": "6.0.88", "version": "6.0.88",
"resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.88.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.88.tgz",
"integrity": "sha512-bYDPZTX0/s1aihdjLuAgogUAT5M+TpoWChEMea2p0yOcfn5bu3k6cJb9cp6nw268XeSNIGGr+4+/8V5K6BGzLQ==", "integrity": "sha512-bYDPZTX0/s1aihdjLuAgogUAT5M+TpoWChEMea2p0yOcfn5bu3k6cJb9cp6nw268XeSNIGGr+4+/8V5K6BGzLQ=="
"dev": true
}, },
"@types/q": { "@types/q": {
"version": "0.0.32", "version": "0.0.32",
@ -365,6 +374,57 @@
"integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
"dev": true "dev": true
}, },
"angular-2-data-table": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/angular-2-data-table/-/angular-2-data-table-0.1.2.tgz",
"integrity": "sha1-eiz/jPxKpxSpfTMwmLkRaqQourw="
},
"angular-4-data-table-bootstrap-4": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/angular-4-data-table-bootstrap-4/-/angular-4-data-table-bootstrap-4-0.2.0.tgz",
"integrity": "sha512-gw+3z96SSXZZFSjzAXEx69JecBZ9O5K2uMl/asCc7HFrLeS9Q2T0+HGrb4syODEBhJtey0JpzX4GGBotXuHfjg==",
"requires": {
"@angular/common": "4.3.6",
"@angular/core": "4.3.6",
"@angular/forms": "4.3.6",
"@angular/platform-browser": "4.3.6",
"@angular/platform-browser-dynamic": "4.3.6",
"@angular/platform-server": "4.4.5",
"@types/node": "8.0.44",
"rxjs": "5.4.3",
"ts-node": "3.3.0",
"zone.js": "0.8.17"
},
"dependencies": {
"@types/node": {
"version": "8.0.44",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.44.tgz",
"integrity": "sha512-56TeARKE2uMi7xWhpRRws/QdnpSVx9i7E8esGiPYoj90jnonGfmV1vwRLvHWYjPxF5u5l7p5fgdKwdse+VeAQQ=="
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
},
"ts-node": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-3.3.0.tgz",
"integrity": "sha1-wTxqMCTjC+EYDdUwOPwgkonUv2k=",
"requires": {
"arrify": "1.0.1",
"chalk": "2.1.0",
"diff": "3.3.0",
"make-error": "1.3.0",
"minimist": "1.2.0",
"mkdirp": "0.5.1",
"source-map-support": "0.4.16",
"tsconfig": "6.0.0",
"v8flags": "3.0.0",
"yn": "2.0.0"
}
}
}
},
"angular-google-signin": { "angular-google-signin": {
"version": "0.1.5", "version": "0.1.5",
"resolved": "https://registry.npmjs.org/angular-google-signin/-/angular-google-signin-0.1.5.tgz", "resolved": "https://registry.npmjs.org/angular-google-signin/-/angular-google-signin-0.1.5.tgz",
@ -690,8 +750,7 @@
"arrify": { "arrify": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
"integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0="
"dev": true
}, },
"asap": { "asap": {
"version": "2.0.6", "version": "2.0.6",
@ -1403,7 +1462,6 @@
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
"integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
"dev": true,
"requires": { "requires": {
"ansi-styles": "3.2.0", "ansi-styles": "3.2.0",
"escape-string-regexp": "1.0.5", "escape-string-regexp": "1.0.5",
@ -1414,7 +1472,6 @@
"version": "3.2.0", "version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
"integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
"dev": true,
"requires": { "requires": {
"color-convert": "1.9.0" "color-convert": "1.9.0"
} }
@ -1422,14 +1479,12 @@
"has-flag": { "has-flag": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
"integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE="
"dev": true
}, },
"supports-color": { "supports-color": {
"version": "4.2.1", "version": "4.2.1",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz",
"integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==", "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==",
"dev": true,
"requires": { "requires": {
"has-flag": "2.0.0" "has-flag": "2.0.0"
} }
@ -1623,7 +1678,6 @@
"version": "1.9.0", "version": "1.9.0",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz",
"integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=",
"dev": true,
"requires": { "requires": {
"color-name": "1.1.3" "color-name": "1.1.3"
} }
@ -1631,8 +1685,7 @@
"color-name": { "color-name": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
"dev": true
}, },
"color-string": { "color-string": {
"version": "0.3.0", "version": "0.3.0",
@ -2268,8 +2321,7 @@
"diff": { "diff": {
"version": "3.3.0", "version": "3.3.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.3.0.tgz", "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.0.tgz",
"integrity": "sha512-w0XZubFWn0Adlsapj9EAWX0FqWdO4tz8kc3RiYdWLh4k/V8PTb6i0SMgXt0vRM3zyKnT8tKO7mUlieRQHIjMNg==", "integrity": "sha512-w0XZubFWn0Adlsapj9EAWX0FqWdO4tz8kc3RiYdWLh4k/V8PTb6i0SMgXt0vRM3zyKnT8tKO7mUlieRQHIjMNg=="
"dev": true
}, },
"diffie-hellman": { "diffie-hellman": {
"version": "5.0.2", "version": "5.0.2",
@ -2717,8 +2769,7 @@
"escape-string-regexp": { "escape-string-regexp": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
"dev": true
}, },
"escope": { "escope": {
"version": "3.6.0", "version": "3.6.0",
@ -5025,8 +5076,7 @@
"make-error": { "make-error": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.0.tgz", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.0.tgz",
"integrity": "sha1-Uq06M5zPEM5itAQLcI/nByRLi5Y=", "integrity": "sha1-Uq06M5zPEM5itAQLcI/nByRLi5Y="
"dev": true
}, },
"map-obj": { "map-obj": {
"version": "1.0.1", "version": "1.0.1",
@ -5248,8 +5298,7 @@
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
"dev": true
}, },
"mixin-object": { "mixin-object": {
"version": "2.0.1", "version": "2.0.1",
@ -5273,7 +5322,6 @@
"version": "0.5.1", "version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -5881,6 +5929,14 @@
"error-ex": "1.3.1" "error-ex": "1.3.1"
} }
}, },
"parse5": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.2.tgz",
"integrity": "sha1-Be/1fw70V3+xRKefi5qWemzERRA=",
"requires": {
"@types/node": "6.0.88"
}
},
"parsejson": { "parsejson": {
"version": "0.0.3", "version": "0.0.3",
"resolved": "https://registry.npmjs.org/parsejson/-/parsejson-0.0.3.tgz", "resolved": "https://registry.npmjs.org/parsejson/-/parsejson-0.0.3.tgz",
@ -7777,8 +7833,7 @@
"source-map": { "source-map": {
"version": "0.5.7", "version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
"dev": true
}, },
"source-map-loader": { "source-map-loader": {
"version": "0.2.1", "version": "0.2.1",
@ -7824,7 +7879,6 @@
"version": "0.4.16", "version": "0.4.16",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.16.tgz", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.16.tgz",
"integrity": "sha512-A6vlydY7H/ljr4L2UOhDSajQdZQ6dMD7cLH0pzwcmwLyc9u8PNI4WGtnfDDzX7uzGL6c/T+ORL97Zlh+S4iOrg==", "integrity": "sha512-A6vlydY7H/ljr4L2UOhDSajQdZQ6dMD7cLH0pzwcmwLyc9u8PNI4WGtnfDDzX7uzGL6c/T+ORL97Zlh+S4iOrg==",
"dev": true,
"requires": { "requires": {
"source-map": "0.5.7" "source-map": "0.5.7"
} }
@ -8166,8 +8220,7 @@
"strip-json-comments": { "strip-json-comments": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo="
"dev": true
}, },
"style-loader": { "style-loader": {
"version": "0.13.2", "version": "0.13.2",
@ -8491,7 +8544,6 @@
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-6.0.0.tgz", "resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-6.0.0.tgz",
"integrity": "sha1-aw6DdgA9evGGT434+J3QBZ/80DI=", "integrity": "sha1-aw6DdgA9evGGT434+J3QBZ/80DI=",
"dev": true,
"requires": { "requires": {
"strip-bom": "3.0.0", "strip-bom": "3.0.0",
"strip-json-comments": "2.0.1" "strip-json-comments": "2.0.1"
@ -8500,8 +8552,7 @@
"strip-bom": { "strip-bom": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM="
"dev": true
} }
} }
}, },
@ -8776,8 +8827,7 @@
"user-home": { "user-home": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz",
"integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA="
"dev": true
}, },
"useragent": { "useragent": {
"version": "2.2.1", "version": "2.2.1",
@ -8842,7 +8892,6 @@
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.0.0.tgz", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.0.0.tgz",
"integrity": "sha512-AGl+C+4qpeSu2g3JxCD/mGFFOs/vVZ3XREkD3ibQXEqr4Y4zgIrPWW124/IKJFHOIVFIoH8miWrLf0o84HYjwA==", "integrity": "sha512-AGl+C+4qpeSu2g3JxCD/mGFFOs/vVZ3XREkD3ibQXEqr4Y4zgIrPWW124/IKJFHOIVFIoH8miWrLf0o84HYjwA==",
"dev": true,
"requires": { "requires": {
"user-home": "1.1.1" "user-home": "1.1.1"
} }
@ -9451,6 +9500,11 @@
"integrity": "sha1-OS2LotDxw00e4tYw8V0O+2jhBIo=", "integrity": "sha1-OS2LotDxw00e4tYw8V0O+2jhBIo=",
"dev": true "dev": true
}, },
"xhr2": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/xhr2/-/xhr2-0.1.4.tgz",
"integrity": "sha1-f4dliEdxbbUCYyOBL4GMras4el8="
},
"xml-char-classes": { "xml-char-classes": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/xml-char-classes/-/xml-char-classes-1.0.0.tgz", "resolved": "https://registry.npmjs.org/xml-char-classes/-/xml-char-classes-1.0.0.tgz",
@ -9584,8 +9638,7 @@
"yn": { "yn": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz",
"integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo="
"dev": true
}, },
"zone.js": { "zone.js": {
"version": "0.8.17", "version": "0.8.17",

View File

@ -21,6 +21,8 @@
"@angular/platform-browser": "^4.3.6", "@angular/platform-browser": "^4.3.6",
"@angular/platform-browser-dynamic": "^4.3.6", "@angular/platform-browser-dynamic": "^4.3.6",
"@angular/router": "^4.3.6", "@angular/router": "^4.3.6",
"angular-2-data-table": "^0.1.2",
"angular-4-data-table-bootstrap-4": "^0.2.0",
"angular-google-signin": "^0.1.5", "angular-google-signin": "^0.1.5",
"bootstrap": "^3.3.7", "bootstrap": "^3.3.7",
"core-js": "^2.4.1", "core-js": "^2.4.1",

View File

@ -5,6 +5,7 @@ import { DynamicFormComponent } from './form/dynamic-form.component';
import { LoginComponent } from './login/login-page'; import { LoginComponent } from './login/login-page';
import { AuthGuard } from './guards/auth.guard'; import { AuthGuard } from './guards/auth.guard';
import { ProjectsComponent } from './projects/projects.component'; import { ProjectsComponent } from './projects/projects.component';
import { DatasetsComponent } from './datasets/dataset.component';
const appRoutes: Routes = [ const appRoutes: Routes = [
{ path: 'dynamic-form', component: DynamicFormComponent, canActivate: [AuthGuard] }, { path: 'dynamic-form', component: DynamicFormComponent, canActivate: [AuthGuard] },

View File

@ -4,8 +4,10 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
import { HttpModule } from '@angular/http'; import { HttpModule } from '@angular/http';
import { RouterModule, Routes, Router } from '@angular/router'; import { RouterModule, Routes, Router } from '@angular/router';
import {DataTableModule } from 'angular-4-data-table-bootstrap-4';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { RestBase } from './services/rest-base';
import { DynamicFormComponent } from './form/dynamic-form.component'; import { DynamicFormComponent } from './form/dynamic-form.component';
import { DynamicFormFieldComponent } from './form/fields/dynamic-form-field.component'; import { DynamicFormFieldComponent } from './form/fields/dynamic-form-field.component';
import { ServerService } from './services/server.service'; import { ServerService } from './services/server.service';
@ -21,6 +23,8 @@ import { PageNotFoundComponent } from './not-found.component';
import { TocComponent } from './form/tableOfContents/toc.component'; import { TocComponent } from './form/tableOfContents/toc.component';
import { ProjectsModule } from './projects/project.module'; import { ProjectsModule } from './projects/project.module';
import { PaginationService } from './services/pagination.service'; import { PaginationService } from './services/pagination.service';
import { EestoreService } from './services/eestore.service';
import { DatasetsModule } from './datasets/dataset.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -40,10 +44,12 @@ import { PaginationService } from './services/pagination.service';
HttpModule, HttpModule,
HttpClientModule, HttpClientModule,
ProjectsModule, ProjectsModule,
AppRoutingModule DatasetsModule,
AppRoutingModule,
DataTableModule
], ],
providers: [ServerService, dataModelBuilder, AuthGuard, PaginationService, TokenService, LocalStorageService], providers: [ServerService, dataModelBuilder, AuthGuard, PaginationService, TokenService, LocalStorageService, RestBase, EestoreService],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { export class AppModule {

View File

@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { DatasetsComponent } from './dataset.component';
//import { ProjectDetailComponent } from './project.detail';
import { DynamicFormComponent } from '../form/dynamic-form.component';
import { AuthGuard } from '../guards/auth.guard';
const datasetsRoutes: Routes = [
{ path: 'dataset', component: DatasetsComponent },
{ path: 'dynamic-form/:id', component: DynamicFormComponent, canActivate: [AuthGuard] }
];
@NgModule({
imports: [
RouterModule.forChild(datasetsRoutes)
],
exports: [
RouterModule
]
})
export class DatasetRoutingModule { }

View File

@ -0,0 +1,94 @@
import { Component, OnInit, Input, ViewChild, NgZone } from '@angular/core';
import {GoogleSignInSuccess} from 'angular-google-signin';
import { Router, ActivatedRoute } from '@angular/router';
import { ServerService } from '../../app/services/server.service';
import { Project } from '../entities/model/project';
import { Dataset } from '../entities/model/dataset';
import { Dmp } from '../entities/model/Dmp';
import { DataTable, DataTableTranslations, DataTableResource } from 'angular-4-data-table-bootstrap-4';
@Component({
selector: 'projects',
templateUrl: 'dataset.html',
// template: `
// <h1 class="title">Projects</h1>
// <ul class="list-group col-md-4">
// <li *ngFor="let project of projects"
// class="list-group-item">
// <a [routerLink]="['/dynamic-form', project.id]" >
// {{ project.name }}
// </a>
// </li>
// </ul>
// <router-outlet></router-outlet>
// `,
providers: [ServerService]
})
export class DatasetsComponent implements OnInit{
returnUrl: string;
@Input() datasets: Dataset[];
datasetResource :DataTableResource<Dataset>;
@Input() datasetCount = 0;
@ViewChild(DataTable) projectsTable;
constructor(
private serverService: ServerService,
private route: ActivatedRoute,
private router: Router,
private ngZone: NgZone){
}
ngOnInit() {
//this.projects = this.serverService.getDummyProjects();
this.datasets = [];
this.serverService.getAllDatasets().subscribe(
response => {
console.log("response");
console.log(response);
response.forEach(resp => {
let dt = new Dataset();
dt.id = resp.id;
dt.name = resp.label;
dt.uriDataset = resp.uri;
this.datasets.push(dt);
var params = {limit:8,offset:0, sortAsc:false}
this.afterLoad();
this.datasetResource.query(params).then(datasets => this.datasets = datasets);
});
}
);
}
reloadDatasets(params) {
this.datasetResource.query(params).then(projects => this.datasets = projects);
}
afterLoad(){
this.datasetResource = new DataTableResource(this.datasets);
this.datasetResource.count().then(count => this.datasetCount = count);
}
rowClick(rowEvent){
this.ngZone.run(() => this.router.navigateByUrl('dynamic-form', rowEvent.row.item.id));
}
// special params:
translations = <DataTableTranslations>{
indexColumn: 'Index column',
expandColumn: 'Expand column',
selectColumn: 'Select column',
paginationLimit: 'Max results',
paginationRange: 'Result range'
};
}

View File

@ -0,0 +1,24 @@
<div style="margin: auto; max-width: 1000px; margin-top:50px">
<data-table id="films-grid" headerTitle="Datasets" [items]="datasets" [itemCount]="datasetCount" (reload)="reloadDatasets($event)"
[limit]="8" [sortBy]="'rating'" [sortAsc]="false" [substituteRows]="false"
[translations]="translations" [selectOnRowClick]="true" (rowClick)="rowClick($event)">
<data-table-column [property]="'name'" [header]="'Label'" [sortable]="true">
</data-table-column>
<!-- <data-table-column [property]="'abbreviation'" [header]="'Abbreviation'" [sortable]="true">
</data-table-column> -->
<data-table-column [property]="'id'" [header]="'Id'" [sortable]="true">
</data-table-column>
<data-table-column [property]="'uriDataset'" [header]="'Uri'" [sortable]="true">
</data-table-column>
<!-- <data-table-column [property]="'definition'" [header]="'Definition'" [sortable]="true">
</data-table-column> -->
</data-table>
<div style="margin-top: 10px">
<button type="button" class="btn btn-info">New Dataset</button>
<!-- <b>Selected:</b>
<span *ngIf="projectsTable.selectedRow == null"><i>No item selected</i></span>
<span [textContent]="projectsTable.selectedRow && projectsTable.selectedRow.item.name"></span> -->
</div>
</div>

View File

@ -0,0 +1,24 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {DataTableModule } from 'angular-4-data-table-bootstrap-4';
import { DatasetsComponent } from './dataset.component';
import { DatasetRoutingModule } from './dataset-routing.module';
//import { ProjectDetailComponent } from './project.detail';
@NgModule({
imports: [
CommonModule,
FormsModule,
DatasetRoutingModule,
DataTableModule
],
declarations: [
DatasetsComponent
//ProjectDetailComponent
],
providers: [ ]
})
export class DatasetsModule {}

View File

@ -0,0 +1,7 @@
import { Injectable } from '@angular/core';
export class Dataset {
id:string;
name: string;
uriDataset: string;
}

View File

@ -0,0 +1,7 @@
import { Injectable } from '@angular/core';
export class Dmp {
id:string;
dataset: string;
name: string;
}

View File

@ -1,7 +1,13 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Dmp } from './dmp'
import { Dataset } from './dataset'
export class Project { export class Project {
name: string; name: string;
id: string; id: string;
abbreviation: string;
definition: string;
uri: string;
dmp: Dmp;
dataset: Dataset;
} }

View File

@ -169,7 +169,7 @@ export class DynamicFormComponent implements OnInit {
//this.dataModel.groups = this.dataModel.groups.slice(this.pager.startIndex, this.pager.endIndex + 1); //this.dataModel.groups = this.dataModel.groups.slice(this.pager.startIndex, this.pager.endIndex + 1);
} }
signOut2() {debugger; signOut2() {
    var auth2 = gapi.auth2.getAuthInstance();     var auth2 = gapi.auth2.getAuthInstance();
    auth2.signOut().then(function () {     auth2.signOut().then(function () {
      console.log('User signed out.');       console.log('User signed out.');

View File

@ -14,6 +14,7 @@ export class FieldBase<T>{
description:string; description:string;
attributes: Attribute; attributes: Attribute;
regex:string; regex:string;
url: any;
constructor(options: { constructor(options: {
value?: T, value?: T,
@ -27,7 +28,8 @@ export class FieldBase<T>{
group?: string group?: string
description?: string, description?: string,
attributes?: Attribute, attributes?: Attribute,
regex?:string regex?:string,
url?: any
} = {}) { } = {}) {
this.value = options.value; this.value = options.value;
this.key = options.key || ''; this.key = options.key || '';
@ -41,5 +43,6 @@ export class FieldBase<T>{
this.description = options.description || ''; this.description = options.description || '';
this.attributes = options.attributes || new Attribute(); this.attributes = options.attributes || new Attribute();
this.regex = options.regex || ''; this.regex = options.regex || '';
this.url = options.url || {"url":null, "fieldpath":null, "data":null};
} }
} }

View File

@ -2,8 +2,7 @@
<nav id="toc" data-toggle="toc"> <nav id="toc" data-toggle="toc">
<ul class="nav flex-column"> <ul class="nav flex-column">
<li class="nav-item"> <li class="nav-item">
<div *ngFor="let section of dataModel.sections"> <div *ngFor="let group of dataModel.groups"> <!-- All contents in the first page -->
<div *ngFor="let group of section.groupFields">
<ul> <ul>
<li><a class="nav-link" [routerLink]="['.']" fragment="{{group.key}}">{{group.title}}</a> <li><a class="nav-link" [routerLink]="['.']" fragment="{{group.key}}">{{group.title}}</a>
<ul *ngFor="let field of group.groupFields"> <ul *ngFor="let field of group.groupFields">
@ -18,7 +17,7 @@
</div>
<!-- <div *ngFor="let group of dataModel.groups"> <!-- <div *ngFor="let group of dataModel.groups">
<ul> <ul>
<li><a class="nav-link" [routerLink]="['.']" fragment="{{group.key}}">{{group.title}}</a> <li><a class="nav-link" [routerLink]="['.']" fragment="{{group.key}}">{{group.title}}</a>

View File

@ -0,0 +1,16 @@
:host /deep/ .index-column,
:host /deep/ .index-column-header {
text-align: right;
}
:host /deep/ .data-table .data-table-row.selected {
background-color: #E4EDF9;
}
.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
}

View File

@ -0,0 +1,50 @@
<div style="margin: auto; max-width: 1000px; margin-top:50px">
<data-table id="films-grid" headerTitle="My Projects" [items]="projects" [itemCount]="projectCount" (reload)="reloadProjects($event)"
[limit]="8" [sortBy]="'rating'" [sortAsc]="false" [selectColumn]="true" [multiSelect]="false" [substituteRows]="false"
[expandableRows]="true" [translations]="translations" [indexColumnHeader]="'#'" [selectOnRowClick]="true">
<template #dataTableExpand let-item="item">
<div>
<!-- <a [routerLink]="['/dynamic-form', item.id]"> {{ item.dmp.id }}</a> -->
<table class="table">
<thead class="thead-inverse">
<tr>
<th>Dmp</th>
<th>Id</th>
</tr>
</thead>
<tbody>
<tr>
<!-- <td> <a [routerLink]="['/dynamic-form', item.id]"> {{ item.dmp.id }}</a></td>-->
<td> <a [routerLink]="['/dataset']"> {{ item.dmp.id }}</a></td>
<td>{{item.dmp.id}}</td>
</tr>
</tbody>
</table>
</div>
</template>
<data-table-column [property]="'name'" [header]="'Label'" [sortable]="true">
</data-table-column>
<data-table-column [property]="'abbreviation'" [header]="'Abbreviation'" [sortable]="true">
</data-table-column>
<data-table-column [property]="'id'" [header]="'Id'" [sortable]="true">
</data-table-column>
<data-table-column [property]="'uri'" [header]="'Uri'" [sortable]="true">
</data-table-column>
<data-table-column [property]="'definition'" [header]="'Definition'" [sortable]="true">
</data-table-column>
</data-table>
<div style="margin-top: 10px">
<b>Selected:</b>
<span *ngIf="projectsTable.selectedRow == null"><i>No item selected</i></span>
<span [textContent]="projectsTable.selectedRow && projectsTable.selectedRow.item.name"></span>
</div>
<button type="button" class="btn btn-info">New Project</button>
</div>
<router-outlet></router-outlet>

View File

@ -1,6 +1,7 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import {DataTableModule } from 'angular-4-data-table-bootstrap-4';
import { ProjectsComponent } from './projects.component'; import { ProjectsComponent } from './projects.component';
@ -11,7 +12,8 @@ import { ProjectDetailComponent } from './project.detail';
imports: [ imports: [
CommonModule, CommonModule,
FormsModule, FormsModule,
ProjectRoutingModule ProjectRoutingModule,
DataTableModule
], ],
declarations: [ declarations: [
ProjectsComponent, ProjectsComponent,

View File

@ -1,31 +1,39 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit, Input, ViewChild } from '@angular/core';
import {GoogleSignInSuccess} from 'angular-google-signin'; import {GoogleSignInSuccess} from 'angular-google-signin';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { ServerService } from '../../app/services/server.service'; import { ServerService } from '../../app/services/server.service';
import { Project } from '../entities/model/project'; import { Project } from '../entities/model/project';
import { Dmp } from '../entities/model/Dmp';
import { Dataset } from '../entities/model/dataset';
import { DataTable, DataTableTranslations, DataTableResource } from 'angular-4-data-table-bootstrap-4';
@Component({ @Component({
selector: 'projects', selector: 'projects',
template: ` templateUrl: 'project.html',
<h1 class="title">Projects</h1> // template: `
// <h1 class="title">Projects</h1>
<ul class="list-group col-md-4"> // <ul class="list-group col-md-4">
<li *ngFor="let project of projects" // <li *ngFor="let project of projects"
class="list-group-item"> // class="list-group-item">
<a [routerLink]="['/dynamic-form', project.id]" > // <a [routerLink]="['/dynamic-form', project.id]" >
{{ project.name }} // {{ project.name }}
</a> // </a>
</li> // </li>
</ul> // </ul>
<router-outlet></router-outlet> // <router-outlet></router-outlet>
`, // `,
providers: [ServerService] providers: [ServerService]
}) })
export class ProjectsComponent implements OnInit{ export class ProjectsComponent implements OnInit{
returnUrl: string; returnUrl: string;
projects: Project[]; @Input() projects: Project[];
projectResource :DataTableResource<Project>;
@Input() projectCount = 0;
@ViewChild(DataTable) projectsTable;
constructor( constructor(
private serverService: ServerService, private serverService: ServerService,
@ -37,7 +45,7 @@ export class ProjectsComponent implements OnInit{
ngOnInit() { ngOnInit() {
//this.projects = this.serverService.getDummyProjects(); //this.projects = this.serverService.getDummyProjects();
this.projects = []; this.projects = [];
this.serverService.getProjects().subscribe( this.serverService.getAllProjects().subscribe( //getProjects()
response => { response => {
console.log("response"); console.log("response");
@ -46,12 +54,41 @@ export class ProjectsComponent implements OnInit{
let pr = new Project(); let pr = new Project();
pr.id = resp.id; pr.id = resp.id;
pr.name = resp.label; pr.name = resp.label;
pr.abbreviation = resp.abbreviation;
pr.definition = resp.definition;
pr.uri = resp.uri;
pr.dmp = new Dmp();
// pr.dmp.id = resp.dmp;
pr.dmp.id = resp.dmp =! null || resp.dmp ==! undefined ? resp.dmp.id : null;
pr.dataset = new Dataset();
pr.dmp.dataset = resp.dmp.dataset != null ? resp.dmp.dataset.id: null;
this.projects.push(pr); this.projects.push(pr);
var params = {limit:8,offset:0, sortAsc:false}
this.afterLoad();
this.projectResource.query(params).then(projects => this.projects = projects);
}); });
} }
); );
} }
reloadProjects(params) {
this.projectResource.query(params).then(projects => this.projects = projects);
}
afterLoad(){
this.projectResource = new DataTableResource(this.projects);
this.projectResource.count().then(count => this.projectCount = count);
}
// special params:
translations = <DataTableTranslations>{
indexColumn: 'Index column',
expandColumn: 'Expand column',
selectColumn: 'Select column',
paginationLimit: 'Max results',
paginationRange: 'Result range'
};
} }

View File

@ -5,129 +5,132 @@ import { TextboxField } from '../../app/form/fields/textbox/field-textbox';
import { CheckBoxField } from '../../app/form/fields/checkbox/field-checkbox'; import { CheckBoxField } from '../../app/form/fields/checkbox/field-checkbox';
import { RadioBoxField } from '../../app/form/fields/radiobox/field-radiobox'; import { RadioBoxField } from '../../app/form/fields/radiobox/field-radiobox';
import { DataModel } from '../entities/DataModel'; import { DataModel } from '../entities/DataModel';
import {Rule} from '../entities/common/rule'; import { Rule } from '../entities/common/rule';
import { GroupBase } from '../form/dynamic-form-group/group-base'; import { GroupBase } from '../form/dynamic-form-group/group-base';
import { Attribute } from '../entities/model/attribute'; import { Attribute } from '../entities/model/attribute';
import { Param } from '../entities/model/param'; import { Param } from '../entities/model/param';
import { Section } from '../entities/model/section'; import { Section } from '../entities/model/section';
import { RestBase } from '../services/rest-base';
@Injectable() @Injectable()
export class dataModelBuilder { export class dataModelBuilder {
private dataModel : DataModel; private dataModel: DataModel;
private fields : FieldBase<any>[]; private fields: FieldBase<any>[];
public getDataModel(data){ constructor(private restBase: RestBase) { }
public getDataModel(data) {
if (this.dataModel != null)
return this.dataModel;
this.dataModel = new DataModel();
this.fields = this.buildFields(data.dataset.profile.viewstyle.definition.root.fields.field);
this.dataModel.groups = this.getGroups(data.dataset.profile.viewstyle.definition.root.fieldGroups.fieldGroup, this.fields);
this.dataModel.semanticAttr = new Array(new Attribute);
//this.dataModel.semanticAttr = data.dataset.profile.definition.root.fields.field;
this.dataModel.semanticAttr = this.getFieldsAttributes(data.dataset.profile.definition.root.fields.field, data.dataset.profile.ruleset.definition.root.functions.function, this.fields);
this.dataModel.sections = this.getSections(data.dataset.profile.viewstyle.definition.root.sections.section, this.dataModel.groups);
this.dataModel.buildIndex();
if(this.dataModel != null)
return this.dataModel; return this.dataModel;
this.dataModel = new DataModel();
this.fields = this.buildFields(data.dataset.profile.viewstyle.definition.root.fields.field);
this.dataModel.groups = this.getGroups(data.dataset.profile.viewstyle.definition.root.fieldGroups.fieldGroup, this.fields);
this.dataModel.semanticAttr = new Array(new Attribute);
//this.dataModel.semanticAttr = data.dataset.profile.definition.root.fields.field;
this.dataModel.semanticAttr = this.getFieldsAttributes(data.dataset.profile.definition.root.fields.field, data.dataset.profile.ruleset.definition.root.functions.function, this.fields) ;
this.dataModel.sections = this.getSections(data.dataset.profile.viewstyle.definition.root.sections.section, this.dataModel.groups) ;
this.dataModel.buildIndex();
return this.dataModel;
} }
private buildFields(fields:any[]) { private buildFields(fields: any[]) {
let fieldsVisible :FieldBase<any>[] =[]; let fieldsVisible: FieldBase<any>[] = [];
fields.forEach(element => { fields.forEach(element => {
if (element.viewStyle._renderstyle == "freetext"){ if (element.viewStyle._renderstyle == "freetext") {
let newfield:FieldBase <any>; let newfield: FieldBase<any>;
let rule = new Rule(); let rule = new Rule();
newfield = new TextboxField({ newfield = new TextboxField({
label: element.title.__cdata, label: element.title.__cdata,
key:element._id, key: element._id,
value: element.value, value: element.value,
order:element._ordinal, order: element._ordinal,
rules: element.visible.rule != undefined ? element.visible.rule: rule, rules: element.visible.rule != undefined ? element.visible.rule : rule,
visible: element._defaultVisibility, visible: element._defaultVisibility,
group : element._group, group: element._group,
description: element.description.__cdata description: element.description.__cdata
}); });
fieldsVisible.push(newfield); fieldsVisible.push(newfield);
} }
else if (element.viewStyle._renderstyle == "dropdown" ||element.viewStyle._renderstyle == "combobox"){//to choose one of these in xml else if (element.viewStyle._renderstyle == "dropdown" || element.viewStyle._renderstyle == "combobox") {//to choose one of these in xml
let newfield:DropdownField; let newfield: DropdownField;
let rule = new Rule(); let rule = new Rule();
newfield = new DropdownField({ newfield = new DropdownField({
label: element.title.__cdata, label: element.title.__cdata,
key:element._id, key: element._id,
value: element.value, value: element.value,
order:element._ordinal, order: element._ordinal,
rules: element.visible.rule != undefined ? element.visible.rule: rule, rules: element.visible.rule != undefined ? element.visible.rule : rule,
visible: element._defaultVisibility, visible: element._defaultVisibility,
description: element.description.__cdata, description: element.description.__cdata,
group : element._group group: element._group
}); });
fieldsVisible.push(newfield); fieldsVisible.push(newfield);
} }
else if (element.viewStyle._renderstyle == "checkbox"||element.viewStyle._renderstyle == "checkBox"){ else if (element.viewStyle._renderstyle == "checkbox" || element.viewStyle._renderstyle == "checkBox") {
let newfield:CheckBoxField; let newfield: CheckBoxField;
let rule = new Array<Rule>(); let rule = new Array<Rule>();
newfield = new CheckBoxField({ newfield = new CheckBoxField({
label: element.title.__cdata, label: element.title.__cdata,
key:element._id, key: element._id,
value: element.value, value: element.value,
order:element._ordinal, order: element._ordinal,
rules: element.visible.rule != undefined ? element.visible.rule: rule, rules: element.visible.rule != undefined ? element.visible.rule : rule,
visible: element._defaultVisibility, visible: element._defaultVisibility,
group : element._group, group: element._group,
description: element.description.__cdata, description: element.description.__cdata,
type: "checkbox" type: "checkbox"
}); });
fieldsVisible.push(newfield); fieldsVisible.push(newfield);
} }
else if (element.viewStyle._renderstyle == "booleanDesicion"){ else if (element.viewStyle._renderstyle == "booleanDesicion") {
let newfield:RadioBoxField; let newfield: RadioBoxField;
let rule = new Array<Rule>(); let rule = new Array<Rule>();
newfield = new RadioBoxField({ newfield = new RadioBoxField({
label: element.title.__cdata, label: element.title.__cdata,
key:element._id, key: element._id,
value: element.value, value: element.value,
order:element._ordinal, order: element._ordinal,
rules: element.visible.rule != undefined ? element.visible.rule: rule, rules: element.visible.rule != undefined ? element.visible.rule : rule,
visible: element._defaultVisibility, visible: element._defaultVisibility,
group : element._group, group: element._group,
type: "radio", type: "radio",
description: element.description.__cdata, description: element.description.__cdata,
answers: [ answers: [
{ {
id: 1, id: 1,
answer: "Yes", answer: "Yes",
value: true value: true
}, },
{ {
id: 2, id: 2,
answer: "No", answer: "No",
value:false value: false
}] }]
}); });
fieldsVisible.push(newfield); fieldsVisible.push(newfield);
} }
}); });
fieldsVisible.sort((a, b) => a.order - b.order); fieldsVisible.sort((a, b) => a.order - b.order);
return fieldsVisible; return fieldsVisible;
} }
private getGroups(fieldGroups:any, fields:any[]){ private getGroups(fieldGroups: any, fields: any[]) {
let groups :GroupBase<any>[] =[]; let groups: GroupBase<any>[] = [];
if(fieldGroups.length>1){ if (fieldGroups.length > 1) {
fieldGroups.forEach(fieldGroup =>{ // each fiedgroup fills with its fields from json fieldGroups.forEach(fieldGroup => { // each fiedgroup fills with its fields from json
let newfldGroup = new GroupBase(); let newfldGroup = new GroupBase();
newfldGroup.groupFields = new Array(); newfldGroup.groupFields = new Array();
fields.forEach(field => { fields.forEach(field => {
if(fieldGroup._id == field.group){ if (fieldGroup._id == field.group) {
newfldGroup.groupFields.push(field); newfldGroup.groupFields.push(field);
}else{ } else {
//this.dataModel.fields.push(field); //this.dataModel.fields.push(field);
} }
@ -138,17 +141,17 @@ export class dataModelBuilder {
newfldGroup.style = fieldGroup.visible._style; newfldGroup.style = fieldGroup.visible._style;
newfldGroup.class = fieldGroup.visible._cssclass; newfldGroup.class = fieldGroup.visible._cssclass;
groups.push(newfldGroup) groups.push(newfldGroup)
}); });
} }
else{ else {
let newfldGroup = new GroupBase(); let newfldGroup = new GroupBase();
newfldGroup.groupFields = new Array(); newfldGroup.groupFields = new Array();
fields.forEach(field => { //for one fieldgroup, because xml to json transformation doesn't create array of one fieldfroup fields.forEach(field => { //for one fieldgroup, because xml to json transformation doesn't create array of one fieldfroup
if(fieldGroups._id == field.group){ if (fieldGroups._id == field.group) {
newfldGroup.groupFields.push(field); newfldGroup.groupFields.push(field);
}else } else
this.dataModel.fields.push(field); this.dataModel.fields.push(field);
}); });
newfldGroup.title = fieldGroups.title.__cdata; newfldGroup.title = fieldGroups.title.__cdata;
newfldGroup.key = fieldGroups._id; newfldGroup.key = fieldGroups._id;
@ -159,54 +162,54 @@ export class dataModelBuilder {
} }
private getDummyGroups(){ private getDummyGroups() {
let groups :GroupBase<any>[] =[]; let groups: GroupBase<any>[] = [];
let group: GroupBase<any>; let group: GroupBase<any>;
group = new GroupBase<any>({ group = new GroupBase<any>({
key: "adfgadfsg", key: "adfgadfsg",
title: "GroupA", title: "GroupA",
rules: new Array(), rules: new Array(),
groupFields: new Array(), groupFields: new Array(),
value: "value", value: "value",
visible: true, visible: true,
order: 1 order: 1
//, //,
//controlType: "none" //controlType: "none"
}); });
let newfield1:FieldBase <any>; let newfield1: FieldBase<any>;
newfield1 = new TextboxField({ newfield1 = new TextboxField({
key:"tf1-455", key: "tf1-455",
label: "Field from group1", label: "Field from group1",
value: 'this is a groupfield', value: 'this is a groupfield',
required: true, required: true,
ordinal:1 ordinal: 1
}); });
group.groupFields.push(newfield1); group.groupFields.push(newfield1);
let newfield2:FieldBase <any>; let newfield2: FieldBase<any>;
newfield2 = new TextboxField({ newfield2 = new TextboxField({
key:"tf1-443", key: "tf1-443",
label: "Another field from group1", label: "Another field from group1",
value: 'this is a groupfield', value: 'this is a groupfield',
required: true, required: true,
ordinal:2 ordinal: 2
}); });
group.groupFields.push(newfield2); group.groupFields.push(newfield2);
groups.push(group); groups.push(group);
return groups; return groups;
} }
private getFieldsAttributes(attributes:any, functions:any, fields:any[]){ private getFieldsAttributes(attributes: any, functions: any, fields: any[]) {
let attribute:Attribute[]=[]; let attribute: Attribute[] = [];
attributes.forEach(attr => { attributes.forEach(attr => {
let newAttribute = new Attribute(); let newAttribute = new Attribute();
newAttribute.datatype = attr._datatype; newAttribute.datatype = attr._datatype;
@ -219,32 +222,62 @@ export class dataModelBuilder {
newAttribute.validation = new Array(); newAttribute.validation = new Array();
//newAttribute.validation.push(attr.validation.rule); //newAttribute.validation.push(attr.validation.rule);
if(attr.sources){ if (attr.sources) {
newAttribute.sources.push(attr.sources.source); newAttribute.sources.push(attr.sources.source);
newAttribute.sources.forEach(src => {
src.params=new Array();
for (var i=0, len=attr.sources.source.value.length; i<len; i++){
let prm = new Param();
prm.key= attr.sources.source.value[i]._value;
prm.value= attr.sources.source.value[i]._label;
src.params.push(prm);
}
}); if (attr.sources.source.url !== undefined) {
fields.find(x => x.key == newAttribute.id).url.url = attr.sources.source.url._value;
this.restBase.proxy_get(attr.sources.source.url._value).subscribe((data) => {
console.log(data);
newAttribute.sources.forEach(src => {
src.params = new Array();
data.data.forEach(data => {
let prm = new Param();
prm.key = data.id;
prm.value = data.attributes.name;
src.params.push(prm);
});
});
});
} else {
newAttribute.sources.forEach(src => {
src.params = new Array();
for (var i = 0, len = attr.sources.source.value.length; i < len; i++) {
let prm = new Param();
prm.key = attr.sources.source.value[i]._value;
prm.value = attr.sources.source.value[i]._label;
src.params.push(prm);
}
});
}
} }
if (attr.validation.rule.length) if (attr.validation.rule.length)
for (var i=0, len=attr.validation.rule.length; i<len; i++){ for (var i = 0, len = attr.validation.rule.length; i < len; i++) {
let rule = new Rule(); let rule = new Rule();
rule.ruleStyle= attr.validation.rule[i]._ruleStyle; rule.ruleStyle = attr.validation.rule[i]._ruleStyle;
rule.ruleType= attr.validation.rule[i]._type; rule.ruleType = attr.validation.rule[i]._type;
if (attr.validation.rule[i]._ruleStyle == "regex") if (attr.validation.rule[i]._ruleStyle == "regex")
rule.regex= attr.validation.rule[i].__cdata; rule.regex = attr.validation.rule[i].__cdata;
if (attr.validation.rule[i]._ruleStyle == "customValidation"){ if (attr.validation.rule[i]._ruleStyle == "customValidation") {
rule.method= attr.validation.rule[i]._method; rule.method = attr.validation.rule[i]._method;
functions.forEach(fnc => { functions.forEach(fnc => {
if(fnc._id == rule.method) if (fnc._id == rule.method)
rule.methodJs = fnc.script.__cdata; rule.methodJs = fnc.script.__cdata;
}); });
} }
@ -252,17 +285,17 @@ export class dataModelBuilder {
newAttribute.validation.push(rule); newAttribute.validation.push(rule);
} }
else{ else {
if(attr.validation.rule){ if (attr.validation.rule) {
let rule = new Rule(); let rule = new Rule();
rule.ruleStyle= attr.validation.rule._ruleStyle; rule.ruleStyle = attr.validation.rule._ruleStyle;
rule.ruleType= attr.validation.rule._type; rule.ruleType = attr.validation.rule._type;
if (attr.validation.rule._ruleStyle == "regex") if (attr.validation.rule._ruleStyle == "regex")
rule.regex= attr.validation.rule.__cdata; rule.regex = attr.validation.rule.__cdata;
if (attr.validation.rule._ruleStyle == "customValidation"){ if (attr.validation.rule._ruleStyle == "customValidation") {
rule.method= attr.validation.rule._method; rule.method = attr.validation.rule._method;
functions.forEach(fnc => { functions.forEach(fnc => {
if(fnc._id == rule.method) if (fnc._id == rule.method)
rule.methodJs = fnc.__cdata; rule.methodJs = fnc.__cdata;
}); });
@ -273,7 +306,8 @@ export class dataModelBuilder {
} }
attribute.push(newAttribute); attribute.push(newAttribute);
fields.find(x => x.key == newAttribute.id).attributes.sources = newAttribute.sources; //if (fields.find(x => x.key == newAttribute.id).url.url == null)
fields.find(x => x.key == newAttribute.id).attributes.sources = newAttribute.sources;
fields.find(x => x.key == newAttribute.id).attributes.validation = newAttribute.validation; fields.find(x => x.key == newAttribute.id).attributes.validation = newAttribute.validation;
}); });
@ -281,10 +315,10 @@ export class dataModelBuilder {
return attribute; return attribute;
} }
private getSections(sections:any, fieldGroups:GroupBase<any>[]){ private getSections(sections: any, fieldGroups: GroupBase<any>[]) {
let sects: Section[]= []; let sects: Section[] = [];
if(sections.length){ if (sections.length) {
sections.forEach(section => { sections.forEach(section => {
let newSection = new Section(); let newSection = new Section();
newSection.defaultVisibility = section.defaultVisibility; newSection.defaultVisibility = section.defaultVisibility;
@ -294,7 +328,7 @@ export class dataModelBuilder {
newSection.ordinal = section._ordinal; newSection.ordinal = section._ordinal;
newSection.groupFields = new Array(); newSection.groupFields = new Array();
fieldGroups.forEach(fldgroup => { fieldGroups.forEach(fldgroup => {
if(fldgroup.section == newSection.id) if (fldgroup.section == newSection.id)
newSection.groupFields.push(fldgroup); newSection.groupFields.push(fldgroup);
}) })
sects.push(newSection); sects.push(newSection);
@ -304,4 +338,11 @@ export class dataModelBuilder {
return sects; return sects;
} }
getValuesFromEestore(url: string, fieldPath: string) {
this.restBase.proxy_get(url).subscribe((data) => {
data.data.forEach(data => {
console.log(data);
});
});
}
} }

View File

@ -0,0 +1,61 @@
import { Component, Input, OnInit, AfterViewChecked, ViewChild, Injectable } from '@angular/core';
import {RestBase} from './rest-base';
@Injectable()
export class EestoreService implements OnInit {
base: string = "https://eestore.paas2.uninett.no/api/";
datarepo: string = this.base+"datarepo/";
projectrepo: string = this.base+"projectrepo/";
organizationrepo: string = this.base+"organizationrepo/";
metadataschemarepo: string = this.base+"metadataschemarepo/";
servicerepo: string = this.base+"servicerepo/";
personrepo: string = this.base+"personrepo/";
config: string = this.base+"config/";
configtags: string = this.base+"configtags/";
constructor(public restBase: RestBase) {
}
ngOnInit(){
}
getDataRepos(){
return this.restBase.proxy_get(this.datarepo);
}
getProjectRepos(){
return this.restBase.proxy_get(this.projectrepo);
}
getOrganizationRepos(){
return this.restBase.proxy_get(this.organizationrepo);
}
getMetadataSchemaRepos(){
return this.restBase.proxy_get(this.metadataschemarepo);
}
getServiceRepos(){
return this.restBase.proxy_get(this.servicerepo);
}
getPersonRepos(){
return this.restBase.proxy_get(this.personrepo);
}
getConfigs(){
return this.restBase.proxy_get(this.config);
}
getConfigTags(){
return this.restBase.proxy_get(this.configtags);
}
}

View File

@ -0,0 +1,69 @@
import { HttpClient , HttpHeaders, HttpParams } from '@angular/common/http';
import { TokenService, TokenProvider } from './token.service'
import 'rxjs/Rx';
declare var X2JS: any;
export class RestBase {
xml2jsonOBJ: any;
static get parameters() { return [HttpClient, TokenService] }
constructor(public http : HttpClient, public tokenService : TokenService) {
this.xml2jsonOBJ = new X2JS();
}
protocol: string = "http";
hostname: string ="dl010.madgik.di.uoa.gr" ;//"localhost";//"dl010.madgik.di.uoa.gr";//
port: number = 8080;//8080;//
webappname: string = "dmp-backend";//"dmp-backend-new";//
proxyPath : string = this.protocol+"://"+this.hostname+":"+this.port+"/"+this.webappname+"/proxy/";
loginPath : string = this.protocol+"://"+this.hostname+":"+this.port+"/"+this.webappname+"/login/";
restPath: string = this.protocol+"://"+this.hostname+":"+this.port+"/"+this.webappname+"/rest/";
public proxy_get(path : string){
var options = this.createOptions();
return this.http.get<any>(this.proxyPath +"proxy?url="+ path, options);
}
public login(path : string, data : any){
let options = { headers: new HttpHeaders().set('Content-Type', 'application/json') };
return this.http.post<any>(this.loginPath + path, JSON.stringify(data), options);
}
public get(path : string){
var options = this.createOptions();
return this.http.get<any>(this.restPath + path, options);
}
public post(path : string, data : any) {
var options = this.createOptions();
return this.http.post<any>(this.restPath + path, JSON.stringify(data), options);
}
private createOptions(){
var token = this.tokenService.getToken();
var provider: TokenProvider = this.tokenService.getProvider();
//var csrfToken : string = this.tokenService.getCSRFToken();
const params = new HttpParams();
var headers;
if(provider == TokenProvider.google)
headers = new HttpHeaders().set('Content-Type', 'application/json').set("google-token", token);
if(provider == TokenProvider.native)
headers = new HttpHeaders().set('Content-Type', 'application/json').set("native-token", token);
let options = { params: params, headers: headers };
return options;
}
}

View File

@ -8,6 +8,7 @@ import {DataModel} from '../entities/DataModel';
import {Project} from '../entities/model/project'; import {Project} from '../entities/model/project';
import {LoginComponent} from '../../app/login/login-page'; import {LoginComponent} from '../../app/login/login-page';
import { TokenService, TokenProvider } from './token.service'; import { TokenService, TokenProvider } from './token.service';
import {RestBase} from './rest-base';
import 'rxjs/Rx'; import 'rxjs/Rx';
import './../../assets/xml2json.min.js'; import './../../assets/xml2json.min.js';
@ -16,6 +17,7 @@ declare var X2JS: any;
@Injectable() @Injectable()
export class ServerService { export class ServerService {
xml2jsonOBJ: any; xml2jsonOBJ: any;
//fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/a868dbbb-ee37-4ce6-81c8-27048e0599a9'; //fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/a868dbbb-ee37-4ce6-81c8-27048e0599a9';
//fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/a71a6a92-5c23-40d7-ab87-e30bc860f5a4';//include rules! //fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/a71a6a92-5c23-40d7-ab87-e30bc860f5a4';//include rules!
@ -32,20 +34,71 @@ export class ServerService {
//data: any; //data: any;
constructor(private httpClient: HttpClient, private tokenService: TokenService) { //private http: Http constructor(private httpClient: HttpClient, private tokenService: TokenService, private restBase: RestBase) { //private http: Http
this.xml2jsonOBJ = new X2JS(); this.xml2jsonOBJ = new X2JS();
} }
public listDatasetIDs(){
return this.restBase.get("dataset");
}
public getAllDatasets(){
return this.restBase.get("getAllDatasets");
}
public getAllDatasetIDs(datasetId: string){
return this.restBase.get("dataset/"+datasetId);
}
public getAllDmps(){
return this.restBase.get("dmp/getAll");
}
public listDmpsLabelID(){
return this.restBase.get("dmp/listDMPLabelID");
}
public getDmp(dmpid : string){
return this.restBase.get("dmps/"+dmpid);
}
public listDmpIDs(){
return this.restBase.get("dmps");
}
public listProjectIDs(){
return this.restBase.get("projects");
}
public getAllProjects(){
return this.restBase.get("project/getAll");
}
public getProject(projectID : string){
return this.restBase.get("projects/"+projectID);
}
public listProjectsLabelID(){
return this.restBase.get("project/listAllLabelIDs");
}
getData() { getData() {
//let headers = new HttpHeaders(); //let headers = new HttpHeaders();
let headers = new HttpHeaders().set("google-token", this.tokenService.getToken());
console.log("google-token: "+ this.tokenService.getToken()); // let headers = new HttpHeaders().set("google-token", this.tokenService.getToken());
return this.httpClient.get<any>(this.fetchURL); // console.log("google-token: "+ this.tokenService.getToken());
// return this.httpClient.get<any>(this.fetchURL);
return this.restBase.get("dmps/9a4a4a57-4d01-465e-9887-254534f31600");
/* /*
return this.http.get(this.fetchURL) return this.http.get(this.fetchURL)
@ -75,7 +128,7 @@ export class ServerService {
console.log("google-token: "+ this.tokenService.getToken()); console.log("google-token: "+ this.tokenService.getToken());
return this.httpClient.get<any>("http://dl010.madgik.di.uoa.gr:8080/dmp-backend-no-sec/rest/project/listAllLabelIDs"); return this.httpClient.get<any>("http://dl010.madgik.di.uoa.gr:8080/dmp-backend-no-sec/rest/project/getAll");
// let projects :Project[] =[]; // let projects :Project[] =[];

View File

@ -11,11 +11,11 @@ export class TokenService {
constructor (private storage : LocalStorageService, @Inject(DOCUMENT) private document) { constructor (private storage : LocalStorageService, @Inject(DOCUMENT) private document) {
var csrfToken : string = jQuery(document).find('meta[name="csrf-token"]').attr('content'); //var csrfToken : string = jQuery(document).find('meta[name="csrf-token"]').attr('content');
this.setCSRFToken(csrfToken); //this.setCSRFToken(csrfToken);
} }
/*
getCSRFToken() : string{ getCSRFToken() : string{
return this.storage.retrieve('csrf-token'); return this.storage.retrieve('csrf-token');
} }
@ -23,7 +23,7 @@ export class TokenService {
setCSRFToken(csrfToken : string){ setCSRFToken(csrfToken : string){
this.storage.store('csrf-token',csrfToken); this.storage.store('csrf-token',csrfToken);
} }
*/
getProvider() : TokenProvider { getProvider() : TokenProvider {
return this.storage.retrieve('provider'); return this.storage.retrieve('provider');

View File

@ -5,6 +5,7 @@
<link rel="stylesheet" href="https://cdn.rawgit.com/afeld/bootstrap-toc/v0.4.1/dist/bootstrap-toc.min.css"><!--bootstrap plugin for ToC--> <link rel="stylesheet" href="https://cdn.rawgit.com/afeld/bootstrap-toc/v0.4.1/dist/bootstrap-toc.min.css"><!--bootstrap plugin for ToC-->
<!-- add after bootstrap.min.js --> <!-- add after bootstrap.min.js -->
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v0.4.1/dist/bootstrap-toc.min.js"></script> <script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v0.4.1/dist/bootstrap-toc.min.js"></script>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
@ -31,7 +32,7 @@
<div class="panel panel-default" style="margin-top: 30px; margin-bottom: 30px; margin-right: 30px; margin-left: 30px;"> <div class="panel panel-default" style="margin-top: 30px; margin-bottom: 30px; margin-right: 30px; margin-left: 30px;">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title" style="text-align: center;">Digital Management Plans Editor</h3> <h3 class="panel-title" style="text-align: center;">Digital Management Plan</h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">