-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
465d6f0
commit e977147
Showing
22 changed files
with
207 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Controller.extend({ | ||
schemaName: '', | ||
schemaContent: '' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Route.extend({ | ||
model(params) { | ||
return this.explorer.getCluster(params.clusterId, this.store); | ||
}, | ||
|
||
actions: { | ||
createSchema: function(clusterId, schemaName, schemaContent) { | ||
let self = this; | ||
let xmlDoc = null; | ||
let url = `/riak/clusters/${clusterId}/search/schema/${schemaName}`; | ||
|
||
try { | ||
xmlDoc = Ember.$.parseXML(schemaContent); | ||
} catch(error) { | ||
// TODO: Put in proper error messaging | ||
alert('Invalid XML. Please check and make sure schema is valid xml.'); | ||
return; | ||
} | ||
|
||
if (!Ember.$(xmlDoc).find('schema').attr('name')) { | ||
// TODO: Put in proper error messaging | ||
alert('Solr requires that the schema tag has a name attribute. Please update your xml.'); | ||
return; | ||
} | ||
|
||
if (!Ember.$(xmlDoc).find('schema').attr('version')) { | ||
// TODO: Put in proper error messaging | ||
alert('Solr requires that the schema tag has a version attribute. Please update your xml.'); | ||
return; | ||
} | ||
|
||
return Ember.$.ajax({ | ||
type: 'PUT', | ||
url: url, | ||
contentType: 'application/xml', | ||
processData: false, | ||
data: xmlDoc | ||
}).then(function(data) { | ||
self.transitionTo('search-schema', clusterId, schemaName); | ||
}, function(error) { | ||
// TODO: Put in proper error messaging | ||
alert('Something went wrong, schema was not saved.'); | ||
}); | ||
} | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<div class='view-header'> | ||
{{breadcrumb-component | ||
clusterId=model.clusterId | ||
pageTitle='create schema' | ||
}} | ||
{{view-label | ||
pre-label='Create Schema'}} | ||
</div> | ||
|
||
{{#dashboard-module}} | ||
<div class="schema-actions"> | ||
<span class="create schema-action" {{action 'createSchema' model.clusterId schemaName schemaContent}}> | ||
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> | ||
Create Schema | ||
</span> | ||
|
||
{{#link-to 'cluster' model.clusterId class='cancel schema-action' }} | ||
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> | ||
Cancel | ||
{{/link-to}} | ||
</div> | ||
|
||
<form> | ||
<div class="form-group"> | ||
<label>Schema Name</label> | ||
{{input value=schemaName class='form-control'}} | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label>Schema XML</label> | ||
{{textarea value=schemaContent rows=10 class='form-control'}} | ||
</div> | ||
</form> | ||
{{/dashboard-module}} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.code-highlighter { | ||
padding: 0; | ||
margin: 0; | ||
border: none; | ||
background: none; | ||
|
||
code { | ||
border-radius: 4px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,12 @@ | |
.update { | ||
@extend .btn-primary; | ||
} | ||
|
||
.create { | ||
@extend .btn-primary; | ||
} | ||
|
||
.raw { | ||
@extend .btn-primary; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<code class={{language-type}}> | ||
{{yield}} | ||
</code> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { moduleForComponent, test } from 'ember-qunit'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
|
||
moduleForComponent('code-highlighter', 'Integration | Component | code highlighter', { | ||
integration: true | ||
}); | ||
|
||
test('it renders', function(assert) { | ||
assert.expect(2); | ||
|
||
// Set any properties with this.set('myProperty', 'value'); | ||
// Handle any actions with this.on('myAction', function(val) { ... }); | ||
|
||
this.render(hbs`{{code-highlighter}}`); | ||
|
||
assert.equal(this.$().text().trim(), ''); | ||
|
||
// Template block usage: | ||
this.render(hbs` | ||
{{#code-highlighter}} | ||
template block text | ||
{{/code-highlighter}} | ||
`); | ||
|
||
assert.equal(this.$().text().trim(), 'template block text'); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.