Просмотр исходного кода

AMBARI-5263. Mirroring: add schedule dataset action. (akovalenko)

Aleksandr Kovalenko 11 лет назад
Родитель
Сommit
28b31ba020

+ 19 - 1
ambari-web/app/controllers/main/mirroring/jobs_controller.js

@@ -40,6 +40,25 @@ App.MainDatasetJobsController = Em.Controller.extend({
     this.get('content.datasetJobs').filterProperty('status', 'RUNNING').setEach('status', 'SUSPENDED');
   },
 
+  resume: function () {
+    App.ajax.send({
+      name: 'mirroring.resume_entity',
+      sender: this,
+      data: {
+        name: this.get('content.prefixedName'),
+        type: 'feed',
+        falconServer: App.get('falconServerURL')
+      },
+      success: 'onResumeSuccess',
+      error: 'onError'
+    });
+  },
+
+  onResumeSuccess: function() {
+    this.set('content.status', 'RUNNING');
+    this.get('content.datasetJobs').filterProperty('status', 'SUSPENDED').setEach('status', 'RUNNING');
+  },
+
   schedule: function () {
     App.ajax.send({
       name: 'mirroring.schedule_entity',
@@ -56,7 +75,6 @@ App.MainDatasetJobsController = Em.Controller.extend({
 
   onScheduleSuccess: function() {
     this.set('content.status', 'RUNNING');
-    this.get('content.datasetJobs').filterProperty('status', 'SUSPENDED').setEach('status', 'RUNNING');
   },
 
 

+ 1 - 0
ambari-web/app/messages.js

@@ -1872,6 +1872,7 @@ Em.I18n.translations = {
   'mirroring.dataset.targetCluster':'Target Cluster',
   'mirroring.dataset.targetDir':'Target Directory',
   'mirroring.dataset.schedule':'Schedule',
+  'mirroring.dataset.resume':'Resume',
   'mirroring.dataset.suspend':'Suspend',
   'mirroring.dataset.suspendInstance':'Suspend Instance',
   'mirroring.dataset.resumeInstance':'Resume Instance',

+ 9 - 2
ambari-web/app/templates/main/mirroring/jobs.hbs

@@ -44,8 +44,8 @@
         <ul class="dropdown-menu pull-right">
           {{#if view.dataset.isSuspended}}
             <li>
-              <a href="javascript:void(null);" {{action schedule target="controller"}}>
-                {{t mirroring.dataset.schedule}}
+              <a href="javascript:void(null);" {{action resume target="controller"}}>
+                {{t mirroring.dataset.resume}}
               </a>
             </li>
           {{/if}}
@@ -56,6 +56,13 @@
               </a>
             </li>
           {{/if}}
+          {{#if view.dataset.isSubmitted}}
+            <li>
+              <a href="javascript:void(null);" {{action schedule target="controller"}}>
+                {{t mirroring.dataset.schedule}}
+              </a>
+            </li>
+          {{/if}}
           <li>
             <a {{action editDataset}} href="javascript:void(null);">
               {{t common.edit}}

+ 13 - 1
ambari-web/app/utils/ajax.js

@@ -1589,7 +1589,7 @@ var urls = {
     }
   },
 
-  'mirroring.schedule_entity': {
+  'mirroring.resume_entity': {
     'real': '/proxy?url=http://{falconServer}:15000/api/entities/resume/{type}/{name}?user.name=ambari-qa',
     'mock': '/data/mirroring/succeeded.json',
     'apiPrefix': '',
@@ -1601,6 +1601,18 @@ var urls = {
     }
   },
 
+  'mirroring.schedule_entity': {
+    'real': '/proxy?url=http://{falconServer}:15000/api/entities/schedule/{type}/{name}?user.name=ambari-qa',
+    'mock': '/data/mirroring/succeeded.json',
+    'apiPrefix': '',
+    'type': 'POST',
+    'format': function () {
+      return {
+        dataType: 'xml'
+      }
+    }
+  },
+
   'mirroring.suspend_instance': {
     'real': '/proxy?url=http://{falconServer}:15000/api/instance/suspend/feed/{feed}?start={name}&user.name=ambari-qa',
     'mock': '/data/mirroring/succeeded.json',