Commit a8253991 authored by Andres Kütt's avatar Andres Kütt

Merge branch 'master' of https://github.com/e-gov/RIHA-Browser

parents c5927ff8 4b25139e
......@@ -2,3 +2,5 @@ target/
.idea/
*.iws
*.ipr
*.iml
node_modules/
# RIHA-Browser [![Build Status](https://travis-ci.org/e-gov/RIHA-Browser.svg?branch=master)](https://travis-ci.org/e-gov/RIHA-Browser)
Software application that allows a human user to browse descriptions and approval decisions. Browser takes descriptions from the Publisher.
## Prerequisites
- java8
- npm
- maven
## Packaging
```
build.sh
```
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-freemarker:1.4.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.4.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:1.4.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.7" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.7" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.21" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.21" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.21" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.17" level="project" />
<orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.25-incubating" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:4.3.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:1.4.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:1.4.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.6" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:5.2.4.Final" level="project" />
<orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.0.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.4.RELEASE" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.springframework.boot:spring-boot-devtools:1.4.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.4.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.4.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.16.10" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:1.4.2.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:1.4.2.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:1.4.2.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.2.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.2.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.21" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:2.5.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:1.10.19" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.3.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.json:json:20140107" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.4.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:4.3.4.RELEASE" level="project" />
<orderEntry type="library" name="jasmine-DefinitelyTyped" level="application" />
</component>
</module>
\ No newline at end of file
#!/bin/bash
npm install && mvn clean package
......@@ -12,9 +12,7 @@ module.exports = function(karma) {
// list of files / patterns to load in the browser
files: [
'src/main/resources/static/js/vendor/tether.min.js',
'src/main/resources/static/js/vendor/jquery-3.1.1.min.js',
'src/main/resources/static/js/vendor/bootstrap.min.js',
'src/main/resources/static/js/vendor/jquery.dataTables.min.js',
'src/main/resources/static/js/**/*.js',
'src/test/js/**/*.js',
......
......@@ -57,6 +57,22 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.kelveden</groupId>
<artifactId>maven-karma-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<goals>
<goal>start</goal>
</goals>
</execution>
</executions>
<configuration>
<browsers>PhantomJS2</browsers>
<configFile>karma-conf.js</configFile>
</configuration>
</plugin>
</plugins>
</build>
......
package ee.ria.riha.conf;
import freemarker.core.HTMLOutputFormat;
import freemarker.template.TemplateException;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -29,7 +30,9 @@ public class MvcConfigurer extends WebMvcConfigurerAdapter {
factory.setTemplateLoaderPaths("classpath:templates", "src/main/resource/templates");
factory.setDefaultEncoding("UTF-8");
FreeMarkerConfigurer result = new FreeMarkerConfigurer();
result.setConfiguration(factory.createConfiguration());
freemarker.template.Configuration configuration = factory.createConfiguration();
configuration.setOutputFormat(HTMLOutputFormat.INSTANCE);
result.setConfiguration(configuration);
return result;
}
}
\ No newline at end of file
.hidden {
display: none;
}
select {
.info-systems-table select {
width: inherit;
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -46,7 +46,7 @@ function Browser(infosystemsUrl) {
}
function addSelectFilter(column) {
var select = $('<select></select>')
var select = $('<select><option></option></select>')
.appendTo($(column.header()))
.on('click', function (e) {
e.stopPropagation();
......@@ -77,18 +77,17 @@ function Browser(infosystemsUrl) {
}
self._createTableRows = function(data) {
var template = $('.template-row');
var template = $('#row-template').html();
var tbody = $('tbody');
data.forEach(function (infosystem) {
var newRow = $(template).clone().removeClass('hidden').removeClass('template-row');
var newRow = $(template);
newRow.attr('title', JSON.stringify(infosystem));
newRow.find('.owner').text(infosystem.owner);
newRow.find('.owner').text(infosystem.owner.code);
newRow.find('.name').text(infosystem.name);
newRow.find('.last-modified').text(infosystem.status ? infosystem.status.timestamp : '');
newRow.find('.status').text(infosystem.status ? infosystem.status.staatus : '');
newRow.find('.approved').text(infosystem.approval ? infosystem.approval.timestamp : '');
newRow.find('.approval-status').text(infosystem.approval ? infosystem.approval.status : '');
newRow.find('.last-modified').text(infosystem.meta && infosystem.meta.system_status ? infosystem.meta.system_status.timestamp : '');
newRow.find('.status').text(infosystem.meta && infosystem.meta.system_status ? infosystem.meta.system_status.status : '');
newRow.find('.approved').text(infosystem.meta && infosystem.meta.approval_status ? infosystem.meta.approval_status.timestamp : '');
newRow.find('.approval-status').text(infosystem.meta && infosystem.meta.approval_status ? infosystem.meta.approval_status.status : '');
tbody.append(newRow);
});
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -4,15 +4,13 @@
<title>Sirvija</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous">
<link rel="stylesheet" href="/css/vendor/bootstrap-4.0.0-alpha.5.min.css">
<link rel="stylesheet" href="/css/vendor/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="/css/main.css">
<script src="/js/index.js"></script>
<script src="/js/vendor/jquery-3.1.1.min.js"></script>
<script src="/js/vendor/jquery.dataTables.min.js"></script>
<script src="/js/vendor/jquery.dataTables.bootstrap4.min.js"></script>
<script src="/js/vendor/tether.min.js"></script>
<script src="/js/vendor/bootstrap.min.js"></script>
<script src="/js/Browser.js"></script>
<script>
$(function() {
new Browser('${infosystemsUrl}').init();
......
......@@ -12,14 +12,16 @@
</tr>
</thead>
<tbody>
<tr class="template-row hidden">
<td class="owner"></td>
<td class="name"></td>
<td class="last-modified text-nowrap"></td>
<td class="status"></td>
<td class="approved text-nowrap"></td>
<td class="approval-status text-nowrap"></td>
</tr>
<script id="row-template" type="text/x-custom-template">
<tr>
<td class="owner"></td>
<td class="name"></td>
<td class="last-modified text-nowrap"></td>
<td class="status"></td>
<td class="approved text-nowrap"></td>
<td class="approval-status text-nowrap"></td>
</tr>
</script>
</tbody>
</table>
</div>
......
package ee.ria.riha;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class BrowserApplicationTests {
@Test
public void contextLoads() {
}
}
......@@ -2,36 +2,40 @@ describe('Browser', function() {
var data = [
{
"owner": "70000562",
"meta": {
"URI": "/70000562/Eesti kirikuregister",
"timestamp": "2015-09-05T00:36:26.255215"
},
"documentation": "https://riha.eesti.ee/riha/main/inf/eesti_kirikute_koguduste_ja_koguduste_liitude_register",
"name": "Eesti kirikute, koguduste ja koguduste liitude register",
"shortname": "Eesti kirikuregister",
"status": {
"staatus": "Lõpetatud",
"timestamp": "2015-08-05T08:29:58.328468"
"owner": {
"code": "70000562",
"name": "Siseministeerium"
},
"approval": {
"timestamp": "2016-12-07T12:16:15.847",
"status": "MITTE KOOSKÕLASTATUD"
}
},
{
"owner": "70000740",
"documentation": "eesti_kirikute_koguduste_ja_koguduste_liitude_register",
"meta": {
"URI": "/70000740/Õppurite register",
"timestamp": "2013-11-14T13:43:55.546948"
"system_status": {
"status": "INFOSYS_STAATUS_LOPETATUD",
"timestamp": "2015-09-05T00:36:26.255215"
},
"approval_status": {
"status": "MITTE KOOSKÕLASTATUD",
"timestamp": "2016-09-05T00:36:26.255215"
}
},
"documentation": "https://riha.eesti.ee/riha/main/inf/opilaste_ja_uliopilaste_register",
"uri": "http://base.url:8090/Eesti%20kirikuregister"
},
{
"name": "Õpilaste ja üliõpilaste register",
"shortname": "Õppurite register",
"status": {
"staatus": "Lõpetatud",
"timestamp": "2013-11-08T15:46:15.121725"
}
"owner": {
"code": "70000740",
"name": "Haridus- ja Teadusministeerium"
},
"documentation": "opilaste_ja_uliopilaste_register",
"meta": {
"system_status": {
"status": "INFOSYS_STAATUS_LOPETATUD",
"timestamp": "2013-11-14T13:43:55.546948"
}
},
"uri": "http://base.url:8090/%C3%95ppurite%20register"
}
];
......@@ -40,17 +44,15 @@ describe('Browser', function() {
new Browser()._createTableRows(data);
var rows = $('tbody tr:not(.template-row)');
var rows = $('tbody tr');
expect(rows.length).toBe(2);
expect(rows.hasClass('hidden')).toBe(false);
expect(rows.hasClass('template-row')).toBe(false);
expect($(rows[0]).find('.name').text()).toBe('Eesti kirikute, koguduste ja koguduste liitude register');
expect($(rows[0]).find('.owner').text()).toBe('70000562');
expect($(rows[0]).find('.last-modified').text()).toBe('2015-08-05T08:29:58.328468');
expect($(rows[0]).find('.status').text()).toBe('Lõpetatud');
expect($(rows[0]).find('.last-modified').text()).toBe('2015-09-05T00:36:26.255215');
expect($(rows[0]).find('.status').text()).toBe('INFOSYS_STAATUS_LOPETATUD');
expect($(rows[0]).find('.approval-status').text()).toBe('MITTE KOOSKÕLASTATUD');
expect($(rows[0]).find('.approved').text()).toBe('2016-12-07T12:16:15.847');
expect($(rows[0]).find('.approved').text()).toBe('2016-09-05T00:36:26.255215');
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment