text: /*!!!!!!!!!!!Do not change anything between here (the DRIVERNAME placeholder will be automatically replaced at buildtime)!!!!!!!!!!!*/
  import NodeDriver from 'shared/mixins/node-driver';
  
  // do not remove LAYOUT, it is replaced at build time with a base64 representation of the template of the hbs template
  // we do this to avoid converting template to a js file that returns a string and the cors issues that would come along with that
  const LAYOUT;
  /*!!!!!!!!!!!DO NOT CHANGE END!!!!!!!!!!!*/
  
  
  /*!!!!!!!!!!!GLOBAL CONST START!!!!!!!!!!!*/
  // EMBER API Access - if you need access to any of the Ember API's add them here in the same manner rather then import them via modules, since the dependencies exist in rancher we dont want to expor the modules in the amd def
  const computed     = Ember.computed;
  const get          = Ember.get;
  const set          = Ember.set;
  const alias        = Ember.computed.alias;
  const service      = Ember.inject.service;
  
  const defaultRadix = 10;
  const defaultBase  = 1024;
  /*!!!!!!!!!!!GLOBAL CONST END!!!!!!!!!!!*/
  
  
  
  /*!!!!!!!!!!!DO NOT CHANGE START!!!!!!!!!!!*/
  export default Ember.Component.extend(NodeDriver, {
    driverName: '%%DRIVERNAME%%',
    config:     alias('model.%%DRIVERNAME%%Config'),
    app:        service(),
  
    init() {
      // This does on the fly template compiling, if you mess with this :cry:
      const decodedLayout = window.atob(LAYOUT);
      const template      = Ember.HTMLBars.compile(decodedLayout, {
        moduleName: 'nodes/components/driver-%%DRIVERNAME%%/template'
      });
      set(this,'layout', template);
  
      this._super(...arguments);
  
    },
    /*!!!!!!!!!!!DO NOT CHANGE END!!!!!!!!!!!*/
  
    // Write your component here, starting with setting 'model' to a machine with your config populated
    bootstrap: function() {
      // bootstrap is called by rancher ui on 'init', you're better off doing your setup here rather then the init function to ensure everything is setup correctly
      let config = get(this, 'globalStore').createRecord({
        type: '%%DRIVERNAME%%Config',
        ha: false
      });
  
      set(this, 'model.%%DRIVERNAME%%Config', config);
    },
  
    // Add custom validation beyond what can be done from the config API schema
    validate() {
      // Get generic API validation errors
      this._super();
      var errors = get(this, 'errors')||[];
      const fields = [
        {
          key: 'server',
          title: 'IP address'
        },
        {
          key: 'port',
          title: 'Port'
        },
        {
          key: 'username',
          title: 'Username'
        },
        {
          key: 'password',
          title: 'Password'
        },
        {
          key: 'cpuCount',
          title: 'CPUs'
        },
        {
          key: 'memorySize',
          title: 'Memory'
        },
        {
          key: 'diskSize',
          title: 'Disk'
        },
        {
          key: 'storagePolicyName',
          title: 'Storage policy'
        },
        {
          key: 'dockerosImagePath',
          title: 'OS image path'
        },
        {
          key: 'networkName',
          title: 'Network'
        }
      ];
      fields.forEach(field => {
        if (!get(this, `model.smtxosConfig.${field.key}`)) {
          errors.push(`${field.title} is required`)
        }
      })
  
      // Add more specific errors
  
      // Set the array of errors for display,
      // and return true if saving should continue.
      if ( get(errors, 'length') ) {
        set(this, 'errors', errors);
        return false;
      } else {
        set(this, 'errors', null);
        return true;
      }
    },
  
    // Any computed properties or custom logic can go here
    collapseMap: {
      account: true,
      instance: true,
      scheduling: true
    },
    actions: {
      toggle(key) {
        const collapseMap = get(this, "collapseMap");
        collapseMap[key] = !collapseMap[key];
        set(this, "collapseMap", {...collapseMap});
      }
    }
  });
  