Pārlūkot izejas kodu

HUE-1221 [pig] Load back an executed script

Fixed bug on script load of unsaved scripts
Enrico Berti 12 gadi atpakaļ
vecāks
revīzija
d8c82eee91
2 mainītis faili ar 3 papildinājumiem un 0 dzēšanām
  1. 1 0
      apps/pig/src/pig/api.py
  2. 2 0
      apps/pig/static/js/pig.ko.js

+ 1 - 0
apps/pig/src/pig/api.py

@@ -174,6 +174,7 @@ class OozieApi:
         'duration': job.endTime and job.startTime and format_duration_in_millis(( time.mktime(job.endTime) - time.mktime(job.startTime) ) * 1000) or None,
         'appName': hue_pig and hue_pig.dict['name'] or _('Unsaved script'),
         'scriptId': hue_pig and hue_pig.id or -1,
+        'scriptContent': hue_pig and hue_pig.dict['script'] or '',
         'progress': get_progress(job),
         'progressPercent': '%d%%' % get_progress(job),
         'user': job.user,

+ 2 - 0
apps/pig/static/js/pig.ko.js

@@ -80,6 +80,7 @@ var Workflow = function (wf) {
   return {
     id: wf.id,
     scriptId: wf.scriptId,
+    scriptContent: wf.scriptContent,
     lastModTime: wf.lastModTime,
     endTime: wf.endTime,
     status: wf.status,
@@ -437,6 +438,7 @@ var PigViewModel = function (props) {
 
   self.viewSubmittedScript = function (workflow) {
     self.loadScript(workflow.scriptId);
+    self.currentScript().script(workflow.scriptContent);
     self.currentScript().isRunning(true);
     self.currentScript().watchUrl(workflow.watchUrl);
     $(document).trigger("loadEditor");