diff --git a/app/components/code-highlighter.js b/app/components/code-highlighter.js new file mode 100644 index 0000000..37a6aab --- /dev/null +++ b/app/components/code-highlighter.js @@ -0,0 +1,14 @@ +import Ember from 'ember'; +/* global hljs */ + +export default Ember.Component.extend({ + tagName: 'pre', + + classNames: ['code-highlighter'], + + didRender() { + let codeBlock = this.$().find('code')[0]; + + hljs.highlightBlock(codeBlock); + } +}); diff --git a/app/index.html b/app/index.html index 69edb1a..870fcd7 100644 --- a/app/index.html +++ b/app/index.html @@ -8,6 +8,7 @@ {{content-for 'head'}} + {{content-for 'head-footer'}}
diff --git a/app/pods/cluster/template.hbs b/app/pods/cluster/template.hbs index 55126e6..9b1053b 100644 --- a/app/pods/cluster/template.hbs +++ b/app/pods/cluster/template.hbs @@ -57,7 +57,12 @@ {{/if}} {{/dashboard-module}} - {{#dashboard-module label='Search Indexes'}} + {{#dashboard-module label='Search Overview'}} + {{#link-to 'search-schema.create' model.id class='btn btn-small btn-primary'}} + + Create new search schema + {{/link-to}} + {{#if model.searchIndexes}} {{search-indexes indexes=model.searchIndexes}} {{else}} diff --git a/app/pods/search-index/template.hbs b/app/pods/search-index/template.hbs index 16b2da7..89c0eff 100644 --- a/app/pods/search-index/template.hbs +++ b/app/pods/search-index/template.hbs @@ -22,7 +22,7 @@
+
+ {{content-editable
+ value=model.content
+ type="html"}}
+
+
{{/dashboard-module}}
diff --git a/app/pods/search-schema/route.js b/app/pods/search-schema/route.js
index af3d837..8863598 100644
--- a/app/pods/search-schema/route.js
+++ b/app/pods/search-schema/route.js
@@ -3,13 +3,20 @@ import $ from 'jquery';
export default Ember.Route.extend({
model(params) {
+ let self = this;
+
return this.explorer.getCluster(params.clusterId, this.store)
.then(function(cluster){
- return cluster.get('searchSchemas').findBy('name', params.searchSchemaId);
+ let schema = cluster.get('searchSchemas').findBy('name', params.searchSchemaId);
+
+ if (!schema) {
+ schema = self.explorer.createSchema(params.searchSchemaId, cluster, self.store);
+ }
+
+ return schema;
});
},
- // TODO: Move to init???
afterModel(model, transition) {
return Ember.$.ajax({
type: 'GET',
diff --git a/app/pods/search-schema/template.hbs b/app/pods/search-schema/template.hbs
index fe182bb..f64b380 100644
--- a/app/pods/search-schema/template.hbs
+++ b/app/pods/search-schema/template.hbs
@@ -14,8 +14,12 @@
Edit Schema
{{/link-to}}
+
+
+ View Raw
+
- + {{#code-highlighter language-type='XML'}} {{model.content}} -+ {{/code-highlighter}} {{/dashboard-module}} diff --git a/app/router.js b/app/router.js index 8a74cc3..c1ff7f8 100644 --- a/app/router.js +++ b/app/router.js @@ -30,6 +30,8 @@ export default Router.map(function() { this.route('service-not-found'); }); this.route('search-index', { path: '/cluster/:clusterId/index/:searchIndexId' }); - this.route('search-schema', { path: '/cluster/:clusterId/schema/:searchSchemaId' }); - this.route('search-schema.edit', { path: '/cluster/:clusterId/schema/:searchSchemaId/edit' }); + + this.route('search-schema', { path: '/cluster/:clusterId/schema/:searchSchemaId' }); + this.route('search-schema.edit', { path: '/cluster/:clusterId/schema/:searchSchemaId/edit' }); + this.route('search-schema.create', { path: '/cluster/:clusterId/schema/create' }); }); diff --git a/app/styles/app.scss b/app/styles/app.scss index fd4b342..52e518d 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -25,6 +25,8 @@ @import "components/cluster-resource-link"; @import "components/pagination-component"; @import "components/schema-actions"; +@import "components/code-highlter"; +@import "components/content-editable"; // View specific styling @import "views/object-counter-container"; diff --git a/app/styles/components/_code-highlter.scss b/app/styles/components/_code-highlter.scss new file mode 100644 index 0000000..16da0c1 --- /dev/null +++ b/app/styles/components/_code-highlter.scss @@ -0,0 +1,10 @@ +.code-highlighter { + padding: 0; + margin: 0; + border: none; + background: none; + + code { + border-radius: 4px; + } +} diff --git a/app/styles/components/_content-editable.scss b/app/styles/components/_content-editable.scss new file mode 100644 index 0000000..d8fbde3 --- /dev/null +++ b/app/styles/components/_content-editable.scss @@ -0,0 +1,18 @@ +// Don't focus when inside of a code block +code { + .ember-content-editable { + margin-top: -50px; // Not sure why this space is being added to the component + min-height: 100px; + + &:focus { + outline: none; + } + } +} + +pre.editable { + background: #FFF; + border-color: #000; + border-radius: 0px; +} + diff --git a/app/styles/components/_schema-actions.scss b/app/styles/components/_schema-actions.scss index 2fecfd9..21fc856 100644 --- a/app/styles/components/_schema-actions.scss +++ b/app/styles/components/_schema-actions.scss @@ -19,4 +19,12 @@ .update { @extend .btn-primary; } + + .create { + @extend .btn-primary; + } + + .raw { + @extend .btn-primary; + } } diff --git a/app/templates/components/code-highlighter.hbs b/app/templates/components/code-highlighter.hbs new file mode 100644 index 0000000..803f55c --- /dev/null +++ b/app/templates/components/code-highlighter.hbs @@ -0,0 +1,4 @@ +
+ {{yield}}
+
+
diff --git a/app/templates/components/search-indexes.hbs b/app/templates/components/search-indexes.hbs
index 5778a0f..d970830 100644
--- a/app/templates/components/search-indexes.hbs
+++ b/app/templates/components/search-indexes.hbs
@@ -11,7 +11,7 @@