Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Show warning message if the filesystem is not configured

  • Loading branch information...
commit 48b5b4eefc3506425e775a2592fc411d67bed216 1 parent 7275fd0
@mikecafarella mikecafarella authored
View
86 src/java/com/cloudera/recordbreaker/fisheye/FilePage.java
@@ -20,6 +20,7 @@
import com.cloudera.recordbreaker.analyzer.TypeGuessSummary;
import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.ExternalLink;
import org.apache.wicket.request.mapper.parameter.PageParameters;
@@ -35,42 +36,61 @@
* @see WebPage
*/
public class FilePage extends WebPage {
- public FilePage() {
- add(new SettingsWarningBox());
- }
- public FilePage(PageParameters params) {
- String fidStr = params.get("fid").toString();
- add(new SettingsWarningBox());
- if (fidStr != null) {
- try {
- FileSummary fs = new FileSummary(FishEye.getInstance().getAnalyzer(), Long.parseLong(fidStr));
- add(new Label("filetitle", fs.getFname()));
- //add(new Label("filesubtitle", "in " + fs.getPath()));
- add(new ExternalLink("filesubtitlelink", urlFor(FilesPage.class, new PageParameters("targetdir=" + fs.getPath())).toString(), fs.getPath()));
- add(new Label("owner", fs.getOwner()));
- add(new Label("size", "" + fs.getSize()));
- add(new Label("lastmodified", fs.getLastModified()));
- add(new Label("crawledon", fs.getCrawl().getStartedDate()));
+ final class FilePageDisplay extends WebMarkupContainer {
+ public FilePageDisplay(String name, String fidStr) {
+ super(name);
+ FishEye fe = FishEye.getInstance();
- List<TypeGuessSummary> tgses = fs.getTypeGuesses();
- TypeGuessSummary tgs = tgses.get(0);
- TypeSummary ts = tgs.getTypeSummary();
- SchemaSummary ss = tgs.getSchemaSummary();
+ if (fe.hasFSAndCrawl()) {
+ if (fidStr != null) {
+ try {
+ FileSummary fs = new FileSummary(fe.getAnalyzer(), Long.parseLong(fidStr));
+ add(new Label("filetitle", fs.getFname()));
+ add(new ExternalLink("filesubtitlelink", urlFor(FilesPage.class, new PageParameters("targetdir=" + fs.getPath())).toString(), fs.getPath()));
+ add(new Label("owner", fs.getOwner()));
+ add(new Label("size", "" + fs.getSize()));
+ add(new Label("lastmodified", fs.getLastModified()));
+ add(new Label("crawledon", fs.getCrawl().getStartedDate()));
- String typeUrl = urlFor(FiletypePage.class, new PageParameters("typeid=" + ts.getTypeId())).toString();
- String schemaUrl = urlFor(SchemaPage.class, new PageParameters("schemaid=" + ss.getSchemaId())).toString();
- add(new ExternalLink("typelink", typeUrl, ts.getLabel()));
- add(new ExternalLink("schemalink", schemaUrl, "Schema"));
- return;
- } catch (NumberFormatException nfe) {
+ List<TypeGuessSummary> tgses = fs.getTypeGuesses();
+ TypeGuessSummary tgs = tgses.get(0);
+ TypeSummary ts = tgs.getTypeSummary();
+ SchemaSummary ss = tgs.getSchemaSummary();
+
+ String typeUrl = urlFor(FiletypePage.class, new PageParameters("typeid=" + ts.getTypeId())).toString();
+ String schemaUrl = urlFor(SchemaPage.class, new PageParameters("schemaid=" + ss.getSchemaId())).toString();
+ add(new ExternalLink("typelink", typeUrl, ts.getLabel()));
+ add(new ExternalLink("schemalink", schemaUrl, "Schema"));
+ return;
+ } catch (NumberFormatException nfe) {
+ }
+ }
+ add(new Label("filetitle", "unknown"));
+ add(new Label("filesubtitlelink", ""));
+ add(new Label("filesubtitle", ""));
+ add(new Label("owner", ""));
+ add(new Label("size", ""));
+ add(new Label("lastmodified", ""));
+ add(new Label("crawledon", ""));
}
+
+ setOutputMarkupPlaceholderTag(true);
+ setVisibilityAllowed(false);
}
- add(new Label("filetitle", "unknown"));
- add(new Label("filesubtitlelink", ""));
- add(new Label("filesubtitle", ""));
- add(new Label("owner", ""));
- add(new Label("size", ""));
- add(new Label("lastmodified", ""));
- add(new Label("crawledon", ""));
+ public void onConfigure() {
+ FishEye fe = FishEye.getInstance();
+ setVisibilityAllowed(fe.hasFSAndCrawl());
+ }
+ }
+
+ public FilePage() {
+ add(new SettingsWarningBox());
+ add(new CrawlWarningBox());
+ add(new FilePageDisplay("currentFileDisplay", ""));
+ }
+ public FilePage(PageParameters params) {
+ add(new SettingsWarningBox());
+ add(new CrawlWarningBox());
+ add(new FilePageDisplay("currentFileDisplay", params.get("fid").toString()));
}
}
View
68 src/java/com/cloudera/recordbreaker/fisheye/FiletypePage.java
@@ -20,6 +20,7 @@
import com.cloudera.recordbreaker.analyzer.TypeGuessSummary;
import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.link.ExternalLink;
@@ -37,37 +38,52 @@
* @see WebPage
*/
public class FiletypePage extends WebPage {
- public FiletypePage() {
- }
- public FiletypePage(PageParameters params) {
- String filetypeStr = params.get("typeid").toString();
- if (filetypeStr != null) {
- try {
- // Metadata for type
- TypeSummary ts = new TypeSummary(FishEye.getInstance().getAnalyzer(), Long.parseLong(filetypeStr));
- add(new Label("typetitle", ts.getLabel()));
- List<TypeGuessSummary> tgses = ts.getTypeGuesses();
+ final class FiletypeDisplay extends WebMarkupContainer {
+ public FiletypeDisplay(String name, String filetypeStr) {
+ super(name);
+ FishEye fe = FishEye.getInstance();
+ if (fe.hasFSAndCrawl()) {
+ if (filetypeStr == null) {
+ add(new Label("typetitle", ""));
+ } else {
+ try {
+ // Metadata for type
+ TypeSummary ts = new TypeSummary(FishEye.getInstance().getAnalyzer(), Long.parseLong(filetypeStr));
+ add(new Label("typetitle", ts.getLabel()));
+ List<TypeGuessSummary> tgses = ts.getTypeGuesses();
- // Files that have this type
- ListView<TypeGuessSummary> observationList = new ListView<TypeGuessSummary>("observations", tgses) {
- protected void populateItem(ListItem<TypeGuessSummary> item) {
- TypeGuessSummary tgs = item.getModelObject();
- FileSummary fs = tgs.getFileSummary();
- SchemaSummary ss = tgs.getSchemaSummary();
+ // Files that have this type
+ ListView<TypeGuessSummary> observationList = new ListView<TypeGuessSummary>("observations", tgses) {
+ protected void populateItem(ListItem<TypeGuessSummary> item) {
+ TypeGuessSummary tgs = item.getModelObject();
+ FileSummary fs = tgs.getFileSummary();
+ SchemaSummary ss = tgs.getSchemaSummary();
- String fileUrl = urlFor(FilePage.class, new PageParameters("fid=" + fs.getFid())).toString();
- item.add(new ExternalLink("filelink", fileUrl, fs.getFname()));
+ String fileUrl = urlFor(FilePage.class, new PageParameters("fid=" + fs.getFid())).toString();
+ item.add(new ExternalLink("filelink", fileUrl, fs.getFname()));
- String schemaUrl = urlFor(SchemaPage.class, new PageParameters("schemaid=" + ss.getSchemaId())).toString();
- item.add(new ExternalLink("schemalink", schemaUrl, "Schema"));
+ String schemaUrl = urlFor(SchemaPage.class, new PageParameters("schemaid=" + ss.getSchemaId())).toString();
+ item.add(new ExternalLink("schemalink", schemaUrl, "Schema"));
+ }
+ };
+ add(observationList);
+ } catch (NumberFormatException nfe) {
}
- };
- add(observationList);
-
- return;
- } catch (NumberFormatException nfe) {
+ }
}
+ setOutputMarkupPlaceholderTag(true);
+ setVisibilityAllowed(false);
}
- add(new Label("typetitle", ""));
+ }
+
+ public FiletypePage() {
+ add(new SettingsWarningBox());
+ add(new CrawlWarningBox());
+ add(new FiletypeDisplay("currentFiletypeDisplay", ""));
+ }
+ public FiletypePage(PageParameters params) {
+ add(new SettingsWarningBox());
+ add(new CrawlWarningBox());
+ add(new FiletypeDisplay("currentFiletypeDisplay", params.get("typeid").toString()));
}
}
View
75 src/java/com/cloudera/recordbreaker/fisheye/SchemaPage.java
@@ -17,6 +17,7 @@
import com.cloudera.recordbreaker.analyzer.SchemaSummary;
import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.markup.html.list.ListView;
@@ -81,39 +82,59 @@
return listOfSchemaElts;
}
- public SchemaPage() {
- }
+ final class SchemaPageDisplay extends WebMarkupContainer {
+ public SchemaPageDisplay(String name, String schemaidStr) {
+ super(name);
+ FishEye fe = FishEye.getInstance();
- public SchemaPage(PageParameters params) {
- List<List<JsonNode>> listOfSchemaElts = new ArrayList<List<JsonNode>>();
- String schemaidStr = params.get("schemaid").toString();
- if (schemaidStr != null) {
- try {
- SchemaSummary ss = new SchemaSummary(FishEye.getInstance().getAnalyzer(), Long.parseLong(schemaidStr));
- listOfSchemaElts = getSchemaDigest(ss.getLabel());
- } catch (NumberFormatException nfe) {
- } catch (IOException ie) {
- }
- }
+ if (fe.hasFSAndCrawl()) {
+ List<List<JsonNode>> listOfSchemaElts = new ArrayList<List<JsonNode>>();
+ if (schemaidStr != null) {
+ try {
+ SchemaSummary ss = new SchemaSummary(fe.getAnalyzer(), Long.parseLong(schemaidStr));
+ listOfSchemaElts = getSchemaDigest(ss.getLabel());
+ } catch (NumberFormatException nfe) {
+ } catch (IOException ie) {
+ }
+ }
- ListView<List<JsonNode>> biglistview = new ListView<List<JsonNode>>("biglistview", listOfSchemaElts) {
- protected void populateItem(ListItem<List<JsonNode>> item) {
- List<JsonNode> myListOfSchemaElts = item.getModelObject();
+ add(new ListView<List<JsonNode>>("biglistview", listOfSchemaElts) {
+ protected void populateItem(ListItem<List<JsonNode>> item) {
+ List<JsonNode> myListOfSchemaElts = item.getModelObject();
- ListView<JsonNode> listview = new ListView<JsonNode>("listview", myListOfSchemaElts) {
- protected void populateItem(ListItem<JsonNode> item2) {
- JsonNode jnode = item2.getModelObject();
+ ListView<JsonNode> listview = new ListView<JsonNode>("listview", myListOfSchemaElts) {
+ protected void populateItem(ListItem<JsonNode> item2) {
+ JsonNode jnode = item2.getModelObject();
- item2.add(new Label("fieldname", "" + jnode.get("name")));
- item2.add(new Label("fieldtype", "" + jnode.get("type")));
- item2.add(new Label("fielddoc", "" + jnode.get("doc")));
+ item2.add(new Label("fieldname", "" + jnode.get("name")));
+ item2.add(new Label("fieldtype", "" + jnode.get("type")));
+ item2.add(new Label("fielddoc", "" + jnode.get("doc")));
+ }
+ };
+ item.add(listview);
}
- };
- item.add(listview);
+ });
+ add(new Label("numSchemaElements", "" + listOfSchemaElts.size()));
}
- };
+
+ setOutputMarkupPlaceholderTag(true);
+ setVisibilityAllowed(false);
+ }
+ public void onConfigure() {
+ FishEye fe = FishEye.getInstance();
+ setVisibilityAllowed(fe.hasFSAndCrawl());
+ }
+ }
- add(new Label("numSchemaElements", "" + listOfSchemaElts.size()));
- add(biglistview);
+ public SchemaPage() {
+ add(new SettingsWarningBox());
+ add(new CrawlWarningBox());
+ add(new SchemaPageDisplay("currentSchemaDisplay", ""));
+ }
+
+ public SchemaPage(PageParameters params) {
+ add(new SettingsWarningBox());
+ add(new CrawlWarningBox());
+ add(new SchemaPageDisplay("currentSchemaDisplay", params.get("schemaid").toString()));
}
}
View
72 src/web/fisheye/FilePage.html
@@ -78,39 +78,47 @@
</div>
</div>
- <h1>File: <span wicket:id="filetitle"/></h1>
- <h5>in <a href="#" wicket:id="filesubtitlelink"></a></h5>
+ <h1>File</h1>
+ <div class="errorbox" wicket:id="crawlWarningMsgContainer">
+ <div class="alert alert-info">
+ <strong>Note: </strong><span wicket:id="crawlErrorLabel"></span>
+ </div>
+ </div>
- <table class="table table-striped table-bordered table-condensed">
- <thead>
- </thead>
- <tbody>
- <tr>
- <td>owner</td>
- <td><span wicket:id="owner" /></td>
- </tr>
- <tr>
- <td>size</td>
- <td><span wicket:id="size" /></td>
- </tr>
- <tr>
- <td>last modified</td>
- <td><span wicket:id="lastmodified" /></td>
- </tr>
- <tr>
- <td>crawled on</td>
- <td><span wicket:id="crawledon" /></td>
- </tr>
- <tr>
- <td>type</td>
- <td><a href="#" wicket:id="typelink"></a></td>
- </tr>
- <tr>
- <td>schema</td>
- <td><a href="#" wicket:id="schemalink"></a></td>
- </tr>
- </tbody>
- </table>
+ <div wicket:id="currentFileDisplay">
+ <h5><span wicket:id="filetitle"/> in <a href="#" wicket:id="filesubtitlelink"></a></h5>
+
+ <table class="table table-striped table-bordered table-condensed">
+ <thead>
+ </thead>
+ <tbody>
+ <tr>
+ <td>owner</td>
+ <td><span wicket:id="owner" /></td>
+ </tr>
+ <tr>
+ <td>size</td>
+ <td><span wicket:id="size" /></td>
+ </tr>
+ <tr>
+ <td>last modified</td>
+ <td><span wicket:id="lastmodified" /></td>
+ </tr>
+ <tr>
+ <td>crawled on</td>
+ <td><span wicket:id="crawledon" /></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td><a href="#" wicket:id="typelink"></a></td>
+ </tr>
+ <tr>
+ <td>schema</td>
+ <td><a href="#" wicket:id="schemalink"></a></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
</div> <!-- /container -->
</div>
View
46 src/web/fisheye/FiletypePage.html
@@ -71,22 +71,38 @@
</div>
<div class="span10">
<div class="container">
- <h1>Type: <span wicket:id="typetitle"/></h1>
+ <!-- The Settings warning box -->
+ <div class="errorbox" wicket:id="settingsWarningMsgContainer">
+ <div class="alert alert-error">
+ <strong>Warning: </strong><span wicket:id="settingsErrorLabel"></span>
+ </div>
+ </div>
+
+ <h1>Type</h1>
+ <div class="errorbox" wicket:id="crawlWarningMsgContainer">
+ <div class="alert alert-info">
+ <strong>Note: </strong><span wicket:id="crawlErrorLabel"></span>
+ </div>
+ </div>
- Files with this type:
- <table class="table table-striped table-bordered table-condensed">
- <thead>
- <tr>
- <th>File</th>
- <th>Schema</th>
- </tr>
- </thead>
- <tbody>
- <tr wicket:id="observations">
- <td><a href="#" wicket:id="filelink"></a></td><td><a href="#" wicket:id="schemalink"></a></td>
- </tr>
- </tbody>
- </table>
+ <div wicket:id="currentFiletypeDisplay">
+ <h2><span wicket:id="typetitle"/></h2>
+
+ Files with this type:
+ <table class="table table-striped table-bordered table-condensed">
+ <thead>
+ <tr>
+ <th>File</th>
+ <th>Schema</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr wicket:id="observations">
+ <td><a href="#" wicket:id="filelink"></a></td><td><a href="#" wicket:id="schemalink"></a></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
</div> <!-- /container -->
</div>
</div>
View
44 src/web/fisheye/SchemaPage.html
@@ -79,26 +79,34 @@
</div>
<h1>Schema</h1>
- <p>Fisheye is currently boring into <span wicket:id="numSchemaElements"></span> schema(s).</p>
+ <div class="errorbox" wicket:id="crawlWarningMsgContainer">
+ <div class="alert alert-info">
+ <strong>Note: </strong><span wicket:id="crawlErrorLabel"></span>
+ </div>
+ </div>
- <table>
- <tr wicket:id="biglistview">
- <table class="table table-striped table-bordered table-condensed">
- <thead>
- <tr>
- <th>Field name</th>
- <th>Type</th>
- <th>Documentation</th>
- </tr>
- </thead>
- <tbody>
- <tr wicket:id="listview">
- <td><span wicket:id="fieldname"/></td><td><span wicket:id="fieldtype"/></td><td><span wicket:id="fielddoc"/></td>
+ <div wicket:id="currentSchemaDisplay">
+ <p>Fisheye is currently boring into <span wicket:id="numSchemaElements"></span> schema(s).</p>
+
+ <table>
+ <tr wicket:id="biglistview">
+ <table class="table table-striped table-bordered table-condensed">
+ <thead>
+ <tr>
+ <th>Field name</th>
+ <th>Type</th>
+ <th>Documentation</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr wicket:id="listview">
+ <td><span wicket:id="fieldname"/></td><td><span wicket:id="fieldtype"/></td><td><span wicket:id="fielddoc"/></td>
+ </tr>
+ </tbody>
+ </table>
</tr>
- </tbody>
- </table>
- </tr>
- </table>
+ </table>
+ </div>
</div> <!-- /container -->
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.