// Generated by CoffeeScript 1.12.5 import Ember from 'ember'; import config from 'ember-get-config'; export default Ember.Component.extend({ tagName: 'span', panda_prefix: '/panda/api/v1', loading_html: "", session: Ember.inject.service('session'), identifier: '', actions: { on_show: function(element, popup) { var identifier, request, session, start_time, url; if (!(identifier = this.get('identifier'))) { return; } session = this.get('session'); url = "" + config.apiHost + (this.get('panda_prefix')) + "/workflow_action_definitions/" + identifier + "/action_info"; start_time = new Date(); request = { url: url, contentType: "application/json", dataType: "html", success: function(response) { var action_info_load_time, finish_time; finish_time = new Date(); action_info_load_time = finish_time - start_time; console.log("Action info for action " + identifier + " loaded (" + (Math.round(action_info_load_time / 100) / 10) + "s)"); if (action_info_load_time < 500) { return setTimeout((function() { return popup.setSemanticAttr('html', response); }), 500); } else { return popup.setSemanticAttr('html', response); } } }; if (Ember.get(session, 'isAuthenticated')) { session.authorize('authorizer:devise', function(key, authorization) { var obj; request.crossDomain = true; return request.headers = ( obj = {}, obj["" + key] = authorization, obj ); }); } Ember.$.ajax(request); return true; } } });