ui (invalid records, zepplin non configured)
This commit is contained in:
parent
caeb3c8ddb
commit
6ec96e2c82
|
@ -19,6 +19,7 @@ public class ZeppelinRestController extends AbstractDnetController {
|
||||||
@GetMapping("/zeppelin/templates")
|
@GetMapping("/zeppelin/templates")
|
||||||
public List<String> getTemplates() throws MDStoreManagerException {
|
public List<String> getTemplates() throws MDStoreManagerException {
|
||||||
try {
|
try {
|
||||||
|
// if (zeppelinClient.get)
|
||||||
return zeppelinClient.listTemplates();
|
return zeppelinClient.listTemplates();
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
throw new MDStoreManagerException("Zeppelin is unreachable", e);
|
throw new MDStoreManagerException("Zeppelin is unreachable", e);
|
||||||
|
|
|
@ -75,6 +75,8 @@ public class ZeppelinClient {
|
||||||
|
|
||||||
public String zeppelinNote(final String note, final MDStoreWithInfo mdstore, final String currentVersionPath) throws MDStoreManagerException {
|
public String zeppelinNote(final String note, final MDStoreWithInfo mdstore, final String currentVersionPath) throws MDStoreManagerException {
|
||||||
|
|
||||||
|
if (notConfigured()) { throw new MDStoreManagerException("A zeppelin property is empty"); }
|
||||||
|
|
||||||
final String newName =
|
final String newName =
|
||||||
StringUtils.join(Arrays.asList(zeppelinNamePrefix, "notes", mdstore.getDatasourceName().replaceAll("/", "-"), mdstore.getApiId()
|
StringUtils.join(Arrays.asList(zeppelinNamePrefix, "notes", mdstore.getDatasourceName().replaceAll("/", "-"), mdstore.getApiId()
|
||||||
.replaceAll("/", "-"), note.replaceAll("/", "-"), mdstore.getCurrentVersion().replaceAll("/", "-")), "/");
|
.replaceAll("/", "-"), note.replaceAll("/", "-"), mdstore.getCurrentVersion().replaceAll("/", "-")), "/");
|
||||||
|
@ -107,12 +109,17 @@ public class ZeppelinClient {
|
||||||
|
|
||||||
public List<String> listTemplates() {
|
public List<String> listTemplates() {
|
||||||
final String prefix = zeppelinNamePrefix + "/templates/";
|
final String prefix = zeppelinNamePrefix + "/templates/";
|
||||||
return listNotes().stream()
|
|
||||||
.map(map -> map.get("name"))
|
if (notConfigured()) {
|
||||||
.filter(s -> s.startsWith(prefix))
|
return new ArrayList<>();
|
||||||
.map(s -> StringUtils.substringAfter(s, prefix))
|
} else {
|
||||||
.sorted()
|
return listNotes().stream()
|
||||||
.collect(Collectors.toList());
|
.map(map -> map.get("name"))
|
||||||
|
.filter(s -> s.startsWith(prefix))
|
||||||
|
.map(s -> StringUtils.substringAfter(s, prefix))
|
||||||
|
.sorted()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Map<String, String>> listNotes() {
|
private List<Map<String, String>> listNotes() {
|
||||||
|
@ -149,8 +156,9 @@ public class ZeppelinClient {
|
||||||
|
|
||||||
@Scheduled(fixedRate = 12 * 60 * 60 * 1000) // 12 hours
|
@Scheduled(fixedRate = 12 * 60 * 60 * 1000) // 12 hours
|
||||||
public void cleanExpiredNotes() {
|
public void cleanExpiredNotes() {
|
||||||
try {
|
if (notConfigured()) { return; }
|
||||||
|
|
||||||
|
try {
|
||||||
// I sort the notes according to the version datestamp (more recent first)
|
// I sort the notes according to the version datestamp (more recent first)
|
||||||
final List<Map<String, String>> notes = listNotes()
|
final List<Map<String, String>> notes = listNotes()
|
||||||
.stream()
|
.stream()
|
||||||
|
@ -302,4 +310,8 @@ public class ZeppelinClient {
|
||||||
this.jsessionid = jsessionid;
|
this.jsessionid = jsessionid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean notConfigured() {
|
||||||
|
return StringUtils.isAnyBlank(zeppelinBaseUrl, zeppelinLogin, zeppelinPassword, zeppelinNamePrefix);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,8 +124,12 @@
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<div class="card mt-4" ng-repeat="rec in records | filter:recordsFilter">
|
<div class="card mt-4" ng-repeat="rec in records | filter:recordsFilter">
|
||||||
<div class="card-header text-white bg-primary small">{{rec.id}}</div>
|
<div class="card-header text-white bg-primary small">
|
||||||
<table class="table table-condensed table-striped small">
|
<span ng-show="rec.id">{{rec.id}}</span>
|
||||||
|
<span ng-hide="rec.id">the record is unreadable</span>
|
||||||
|
</div>
|
||||||
|
<div class="card-body" ng-hide="rec.id">Invalid record format</div>
|
||||||
|
<table class="table table-condensed table-striped small" ng-show="rec.id">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="col-xs-3">Original Id</th>
|
<th class="col-xs-3">Original Id</th>
|
||||||
<td class="col-xs-9">{{rec.originalId}}</td>
|
<td class="col-xs-9">{{rec.originalId}}</td>
|
||||||
|
@ -147,7 +151,7 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div class="card-body">
|
<div class="card-body" ng-show="rec.id">
|
||||||
<span class="badge badge-success float-right">{{rec.encoding}}</span>
|
<span class="badge badge-success float-right">{{rec.encoding}}</span>
|
||||||
<br />
|
<br />
|
||||||
<pre class="small">{{rec.body}}</pre>
|
<pre class="small">{{rec.body}}</pre>
|
||||||
|
|
Loading…
Reference in New Issue