hackedteam/rcs-console

View on GitHub
src/it/ht/rcs/console/operations/view/agents/build/mobile/MobPersist.mxml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
         xmlns:s="library://ns.adobe.com/flex/spark" 
         xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%" xmlns:build="it.ht.rcs.console.operations.view.agents.build.*">
    
  <fx:Script>
    <![CDATA[
      import it.ht.rcs.console.monitor.controller.LicenseManager;
      import it.ht.rcs.console.operations.view.configuration.ConfigurationView;
      import it.ht.rcs.console.task.controller.DownloadManager;
      import it.ht.rcs.console.utils.AlertPopUp;
      
      import locale.R;
      
      import mx.core.UIComponent;
      import mx.managers.PopUpManager;
      import mx.rpc.events.FaultEvent;
      import mx.rpc.events.ResultEvent;
      
      [Bindable]
      public var configView:ConfigurationView;
      
      [Bindable]
      private var _platform:String;
      
      public function set platform(platform:*):void
      {
        if (platform == null)
          return;
        
        _platform = platform;
        
        createBtn.platforms = [platform];
      }
        
      protected function create():void
      {
        var params:Object;
        
        params = {factory: {_id: parentDocument.factory._id}, 
                  platform: parentDocument.platform, 
                  binary: {demo: createBtn.demo.selected, admin: admin.selected, persist: true}, 
                  melt: {}, 
                  'package': {} };
        
        var filename:String = parentDocument.factory.name + "_" + parentDocument.platform + '_persistent.zip'
        
        PopUpManager.removePopUp(((parentDocument as UIComponent).parentDocument).hostComponent);
        DownloadManager.instance.createTask("build", filename, params, onSuccess, onFailure);
      }
      
      private function onSuccess(e:ResultEvent):void
      {
        PopUpManager.removePopUp(((parentDocument as UIComponent).parentDocument).hostComponent);
      }
      
      private function onFailure(e:FaultEvent):void
      {
        AlertPopUp.show(R.get('TASK_ALREADY_CREATED'));
      }
      
    ]]>
  </fx:Script>
 
  <s:VGroup left="10" top="10">
    <s:CheckBox left="10" id="admin" label="{R.get('REQUIRE_ADMIN')}" fontWeight="bold" selected="false"/>
    <s:TextArea left="25" width="280" height="55" borderVisible="false"
                contentBackgroundAlpha="0.0" editable="false"
                text="{R.get('REQUIRE_ADMIN_DESC')}"/>   
  </s:VGroup>
  
  
  <build:CreateWithDemoButton id="createBtn" left="10" bottom="0" right="10" create="{create}" configView="{configView}"/>
  
</s:Group>