Skip to content

Instantly share code, notes, and snippets.

View Mariusio's full-sized avatar
💭
🏝

Marius Mariusio

💭
🏝
View GitHub Profile
@user = User.find_by(id: params[:id])
unless @user
logger.error 'Not found'
end
begin
@user = User.find(params[:id])
rescue => e
logger.error 'Not found'
end
import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
session: Ember.inject.service('session'),
model() {
return this.store.findAll('dashboard');
},
class BackchannelController < ApplicationController
skip_before_action :authenticate!
before_action :authenticate_internal_api!
# POST /backchannel/event
def backchannel_event
organization_id = params[:organization_id]
report_id = params[:report_id]
execution_id = params[:execution_id]
/* eslint no-undef: "off" */
import { test } from 'qunit';
import moduleForAcceptance from 'zenline-frontend/tests/helpers/module-for-acceptance';
moduleForAcceptance('Acceptance | login logout');
/*
Checks if a user can login and logout
*/
showDashboardLink: false,
didReceiveAttrs() {
console.log("didReceiveAttrs");
if (this.get('session.isAuthenticated')) {
return this.get('store').findAll('datasource').then((datasources) => {
return this.get('store').filter('datasource', {}, function(datasource) {
return datasource.get('id') != null;
}).then((datasources) => {
console.log("datasources.get('length')");
showDashboardLink: Ember.computed(
function() {
if (this.get('session.isAuthenticated')) {
return this.get('store').findAll('datasource').then((datasources) => {
this.get('store').filter('datasource', {}, function(datasource) {
return datasource.get('id') != null;
}).then((datasources) => {
if (datasources.get('length') != 0) {
return true
} else {
// app/routes/application.js
import Ember from 'ember';
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';
export default Ember.Route.extend(ApplicationRouteMixin, {
session: Ember.inject.service('session'),
authenticated: Ember.computed.oneWay('session.isAuthenticated'),
model() {
if (this.get('authenticated')) {
createdByUserName: Ember.computed(
'userId',
function() {
this.store.findRecord('user', parseInt(this.get('userId'))).then((user) => {
console.log("userId");
console.log(this.get('userId'));
console.log(user);
console.log(user.get('firstname'));
return user.get('firstname');
});
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
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");