Skip to content

Commit

Permalink
Add analytic views default with test
Browse files Browse the repository at this point in the history
  • Loading branch information
wwelling committed Jul 21, 2023
1 parent ce9c0aa commit e9b83e0
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package edu.tamu.scholars.middleware.defaults;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

import org.springframework.stereotype.Service;

import com.fasterxml.jackson.core.type.TypeReference;

import edu.tamu.scholars.middleware.view.model.AnalyticView;
import edu.tamu.scholars.middleware.view.model.repo.AnalyticViewRepo;

@Service
public class AnalyticViewsDefaults extends AbstractDefaults<AnalyticView, AnalyticViewRepo> {

public AnalyticViewsDefaults() {
super();
}

@Override
public String path() {
return "classpath:defaults/analyticViews.yml";
}

@Override
public List<AnalyticView> read(InputStream is) throws IOException {
List<AnalyticView> views = mapper.readValue(is, new TypeReference<List<AnalyticView>>() {});
for (AnalyticView view : views) {
loadTemplateMap(view.getTemplates());
}
return views;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package edu.tamu.scholars.middleware.view.model;

public enum Layout {
LIST, GRID
LIST, GRID, CONTAINER
}
5 changes: 5 additions & 0 deletions src/main/resources/defaults/analyticViews.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Test
layout: CONTAINER
templates:
default: "defaults/analyticViews/test/default.html"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Test Analytics</h1>

0 comments on commit e9b83e0

Please sign in to comment.