Skip to content

Instantly share code, notes, and snippets.

View Mariusio's full-sized avatar
💭
🏝

Marius Mariusio

💭
🏝
View GitHub Profile
marius@ubuntu:~/zenline_backend$ rails g scaffold_controller Datasource organization_id:integer user_id:integer name:string database_type:string host:string port:integer username:string password:string database:string tables_and_rows:string -p
Running via Spring preloader in process 6516
Could not find "api_controller.rb" in any of your source paths. Your current source paths are:
/home/marius/.rvm/gems/[email protected]/gems/active_model_serializers-0.9.4/lib/active_model/serializer/generators/serializer/templates
// Option A
Router.map(function() {
this.route('dashboards', function() {
this.route('new');
this.route('edit', {
path: ':dashboard_id/edit'
});
this.route('show', {
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'div',
classNames: ['grid-stack-item'],
attributeBindings: ['data-gs-x', 'data-gs-y', 'data-gs-width', 'data-gs-height', 'data-gs-id'],
"data-gs-x": function() {
return this.get('chart').get('column');
}.property(),
{
"data":{
"id":"11",
"type":"dashboards",
"attributes":{
"organization_id":4,
"user_id":5,
"name":"Demo",
"share_token":"token"
},
import Ember from 'ember';
export default Ember.Component.extend({
// Does not fire
dataObserver: Ember.on('didInsertElement', Ember.observer('visualization', function() {
console.log("visualization changed");
})),
// Does fire
// Option 1, does not work if there is more than one visualization
// Error:
/*TypeError: Cannot read property 'get' of undefined
at charts.js:87
at exports.default._emberMetalMixin.Mixin.create.forEach (ember.debug.js:33050)
at charts.js:86
at tryCatch (ember.debug.js:52858)
at Object.invokeCallback (ember.debug.js:52873)
at ember.debug.js:54999
at ember.debug.js:31434
import Ember from 'ember';
import DS from 'ember-data';
import {
validator, buildValidations
}
from 'ember-cp-validations';
const Validations = buildValidations({
name: validator('presence', true)
deleteVisualizations: function() {
return new Promise((resolve, reject) => {
this.get('visualizations').then((visualizations) => {
// Initiate array to store IDs and types of visualizations to be removed
var arr = [];
visualizations.forEach((visualization, index, visualizations) => {
var id = visualization.get('id');
var modelName = visualization.get('constructor.modelName');
export default Ember.Route.extend({
model: function(params) {
return Em.$.ajax(ENV.api.host + '/dashboards/' + params["dashboard_share_token"] + "/public", {
type: 'GET', // HTTP method
dataType: 'JSON', // type of data expected from the API response
contentType: "application/json",
success: (data, textStatus, jqXHR) => {
console.log("success");
import Ember from 'ember';
import ENV from 'zenline-frontend/config/environment';
export default Ember.Route.extend({
model: function(params) {
return new Promise((resolve, reject) => {
Em.$.ajax(ENV.api.host + '/dashboards/' + params["dashboard_share_token"] + "/public", {
type: 'GET', // HTTP method
dataType: 'JSON', // type of data expected from the API response