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
@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 |
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
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'); | |
}, |
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
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] |
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
/* 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 | |
*/ |
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
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')"); |
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
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 { |
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
// 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')) { |
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
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'); | |
}); |
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
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 |
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
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"); |