Beispiel #1
0
 isCalculatorValid: Ember.computed('productLength', 'productWidth', 'productHeight', 'productWeight', function() {
   return !(Ember.isPresent(this.get('productLength')) &&
           Ember.isPresent(this.get('productWidth')) &&
           Ember.isPresent(this.get('productHeight')) &&
           Ember.isPresent(this.get('productWeight')));
 }),
Beispiel #2
0
 changed: function() {
   return this.get('relations.length') > 0
     || this.get('toMerge.length') > 0
     || Ember.isPresent(Object.keys(this.get('changes')).map(key => this.get(`changes.${key}`)).filter(Ember.isPresent));
 }.property('changes', 'relations.[]', 'toMerge.[]'),
Beispiel #3
0
 return Ember.A(parts).filter(part => Ember.isPresent(part)).join('/');
 hasUpstreamConsumerUuid: Ember.computed('upstreamConsumerUuid', function() {
   return Ember.isPresent(this.get('upstreamConsumerUuid'));
 }),
Beispiel #5
0
import Ember from 'ember';

export default Ember.Controller.extend({
  nameValid: Ember.computed('model.name', {
    get() {
      console.log(this.get('model.name'));
      return !Ember.isEmpty(this.get('model.name'));
    }
  }),
  passValid: Ember.computed('model.password', {
    get() {
      console.log(this.get('model.password'));
      return Ember.isPresent(this.get('model.password')) &&
             this.get('model.password').length > 5;
    }
  }),
  actions: {
    save() {
      console.log('save action');
      if (!this.get('nameValid')) {
        console.log('Please input a name');
        this.set('errorMessage', 'Please input a name');
        return false;
      }
      if (!this.get('passValid')) {
        console.log('Password should be at least 6 charactors');
        this.set('errorMessage', 'Password should be at least 6 charactors');
        return false;
      }
      this.get('model').save().then(() => {
        this.transitionToRoute('login');
export default Ember.Component.extend({
  tagName: 'md-backdrop',
  classNames: ['paper-backdrop', 'md-opaque', 'md-default-theme'],

  navContainer: Ember.computed(function() {
    return this.nearestOfType(PaperNavContainer);
  }),

  // Hammer event handler for tapping backdrop
  tapHammer: null,

  subscribeToTouchEvents: Ember.on('didInsertElement', function() {
    var hammer = new Hammer(this.get('element'));
    hammer.on('tap', Ember.run.bind(this, this._collapseSidenav));
    this.set('tapHammer', hammer);
  }),

  _collapseSidenav() {
    this.get('navContainer').collapseSidenav();
    return false;
  },

  willDestroyElement() {
    this._super(...arguments);
    if (Ember.isPresent(this.get('tapHammer'))) {
      this.get('tapHammer').destroy();
    }
  }

});
 get: function () {
   return this.get('model.hasDirtyAttributes') && Ember.isPresent(this.get('model.title'));
 }
Beispiel #8
0
 nodeInfo.get('macAddresses').forEach((macAddress) => {
   if (macAddress && Ember.isPresent(macAddress.get('value'))) {
     this.registerNode(nodeInfo, macAddress.get('value'));
   }
 });
Beispiel #9
0
 showNodeErrors: Ember.computed('nodeErrors', function() {
   return Ember.isPresent(this.get('nodeErrors'));
 }),
 const hasData = Object.keys(data).some(key => {
   return Ember.isPresent(data[key]);
 });
Beispiel #11
0
      return null;
    }

    foremanErrors = this.formatForemanTaskError(foremanErrors);

    return Ember.Object.create({
      taskUrl: foremanTask ? foremanTask.get('taskUrl') : '',
      message: `${nodeLabel} from ${nodeManager.get('address')} ${foremanErrors} ${lastError}`
    });
  },

  formatForemanTaskError(errorMessage) {
    let formattedErrorMessage = errorMessage;
    let requestErrorMatches = errorMessage.match(/@body=".*", @headers/i);

    if (Ember.isPresent(requestErrorMatches)) {
      formattedErrorMessage = requestErrorMatches[0].replace('@body="', '').replace('", @headers', '');
    }

    return formattedErrorMessage.substring(0, Math.min(250, errorMessage.length));
  },

  getPassword(manager) {
    let foundInfo = this.getSavedInfo(manager);
    return foundInfo ? foundInfo.get('password') : null;
  },

  getSavedInfo(manager) {
    return this.get('savedInfo').find((savedInfo) => {
      return savedInfo.get('driver') === manager.get('driver') &&
        savedInfo.get('address') === manager.get('address') &&
 let shouldCache = ()=> {
   if (Ember.isPresent(except)) {
      return (except.contains(name));
   }
   return false;
 };
 modalName: function() {
   let dashedName = (this.get('name') || '').dasherize();
   let dashedTitle = this.get('title').dasherize();
   return Ember.isPresent(dashedName) ? dashedName : dashedTitle;
 }.property('title', 'name'),
 initial: function(word) {
   var initial = Ember.isPresent(word) ? word[0] : "";
   return initial.toUpperCase();
 },
 get: function () {
   return Ember.isPresent(this.get('submittedResult'));
 }
 currentUser: function() {
   var userId = this.get('user_id');
   if (Ember.isPresent(userId)) {
     return container.lookup('store:main').find('user', userId);
   }
 }.property('user_id')
Beispiel #17
0
 hasUnpaidOrder: function () {
   return Ember.isPresent(this.get('unpaidOrder'));
 }.property('unpaidOrder'),
 hasError: Ember.computed('object.errors.[]', 'customError', function() {
   if (!this.get('object.errors')) {
     return Ember.isPresent(this.get('customError'));
   }
   return this.get('object.errors').has(this.get('for'));
 }),
    controller.set('showManagementApplications', true);
    controller.set('newSatelliteName', null);
    controller.set('showAlertMessage', false);
    controller.set('showWaitingMessage', false);
    controller.set('showErrorMessage', false);
    controller.set('errorMsg', null);

    var sessionPortal = this.modelFor('subscriptions').sessionPortal;
    var deployment = this.modelFor('deployment');
    var upstream_consumer_uuid = deployment.get('upstream_consumer_uuid');
    this.set('saveOnTransition', deployment.get('isNotStarted'));

    if (deployment.get('isStarted')) {
      sessionPortal.set('consumerUUID', upstream_consumer_uuid);
      controller.set('sessionPortal', sessionPortal);
    } else if (Ember.isPresent(sessionPortal.get('consumerUUID'))) {
      // set controller state. If this hasn't been chosen before, consumerUUID
      // will correctly be set to null, and there will not be a default selection
      sessionPortal.set('consumerUUID', controller.get('upstreamConsumerUuid'));
    } else {
      // check if org has upstream UUID using Katello V2 API
      var orgID = this.modelFor('deployment').get('organization.id');
      var url = '/katello/api/v2/organizations/' + orgID;
      Ember.$.getJSON(url).then(function(results) {
        if (Ember.isPresent(results.owner_details.upstreamConsumer)) {
          sessionPortal.set('consumerUUID', results.owner_details.upstreamConsumer.uuid);
          sessionPortal.save();
          controller.set('sessionPortal', sessionPortal);
          deployment.set('upstream_consumer_uuid', results.owner_details.upstreamConsumer.uuid);
          deployment.set('upstream_consumer_name', results.owner_details.upstreamConsumer.name);
        } else {
Beispiel #20
0
 validCredentials: Ember.computed('model.identification', 'password', function() {
   // password is not saved in the model
   return (Ember.isPresent(this.get('model.identification')) && Ember.isPresent(this.get('password')));
 }),
Beispiel #21
0
 ready: Ember.computed('properties.cpus', 'properties.memory_mb', 'properties.local_gb', function() {
   return Ember.isPresent(this.get('properties.cpus')) &&
         Ember.isPresent(this.get('properties.memory_mb')) &&
         Ember.isPresent(this.get('properties.local_gb'));
 }),
  stagesPoller: task(function*() {
    while(true) {
      this.get('buildFetcher').perform();
      yield timeout(3000); // 3-second interval
    }
  }).drop(),

  closeInfoBox() {
    this.send('unselectStage');
    this.send('closePipelineDetails');
    this.send('closePipelineEditor');
  },

  actions: {
    historyHide() {
      return Ember.isPresent(this.get('model'));
    },
    selectBuild() {
      this.closeInfoBox();
    },
    confirmCreateBuild() {
      this.closeInfoBox();
      this.$('.ui.modal.create-build-confirmation').modal('show');
    },
    createBuild() {
      this.get('buildCreator').perform();
    },
    selectStage(stage) {
      this.send('closePipelineDetails');
      this.send('closePipelineEditor');
      this.set('selectedStage', stage);
Beispiel #23
0
  }).restartable(),

  // == Actions ================================================================

  // Setting 'keyUp' directly on the {{input}} helper overwrites
  // Ember's TextSupport keyUp property, which means that other
  // TextSupport events (i.e. 'enter' and 'escape') don't fire.
  // To avoid this, we use the TextSupport 'key-up' event and
  // proxy the event to the keyUp handler.
  actions: {
    clear () {
      this.get('_clear').perform()
    },

    keyUp (value, event) {
      if (Ember.isPresent(Ember.get(this, '_eventProxy.keyUp'))) {
        this._eventProxy.keyUp(event)
      }
    },

    _onInput (event) {
      if (Ember.isPresent(Ember.get(this, '_eventProxy.input'))) {
        // Add id and value for legacy support
        event.id = this.get('elementId')
        event.value = event.target.value
        this._eventProxy.input(event)
      }
    }
  }
})
 hasHint: Ember.computed("hint", function() {
   return Ember.isPresent(this.get("hint"));
 }),
Beispiel #25
0
import Ember from 'ember';

export default Ember.Route.extend({

  setupController(controller, model) {
    controller.set('model', model);
    // reset common password fields
    controller.set('commonPassword', null);
    controller.set('confirmCommonPassword', null);
  },

  deactivate() {
    let deploymentName = this.get('controller.model.name');
    if (Ember.isPresent(deploymentName)) {
      this.set('controller.model.name', deploymentName.trim());
    }
    // pre-populate passwords
    let commonPassword = this.get('controller.commonPassword');
    let deployment = this.modelFor('deployment');
    let deploymentController = this.controllerFor('deployment');
    if (commonPassword && deploymentController.get('isValidCommonPassword')) {
      deployment.set('rhev_engine_admin_password', commonPassword);
      deployment.set('rhev_root_password', commonPassword);
      deployment.set('cfme_root_password', commonPassword);
      deployment.set('cfme_admin_password', commonPassword);
      deployment.set('cfme_db_password', commonPassword);
      deployment.set('openshift_user_password', commonPassword);
      deployment.set('openshift_root_password', commonPassword);

      // confirmation fields on the deployment controller, not the model
      deploymentController.set('confirmRhevRootPassword', commonPassword);
 hasUnit: Ember.computed("unit", function() {
   return Ember.isPresent(this.get("unit"));
 }),
Beispiel #27
0
   * @param store
   * @param type
   * @param snapshots
   * @returns {*}
   */
    bulkUpdate(store, type, snapshots) {
    var serializer = store.serializerFor(type.typeKey);
    var data = this._serializeIntoHash(serializer, type, snapshots);
    return this.ajax(this.buildURL(type.typeKey, null, snapshots, 'resourceOperation', 'bulkUpdate'), 'PUT', {data: data});
  },
  /**
   * @private
   */
    _serializeIntoHash(serializer, type, snapshots) {
        var json = {};
        if (Ember.isArray(snapshots) && Ember.isPresent(snapshots)) {

            return snapshots.map((snapshot)=> {
                json = {};
                serializer.serializeIntoHash(json, type, snapshot, {includeId: true});
                return json;
            });
            //data[this.pathForType(type.typeKey)] = records;
        } else {
            serializer.serializeIntoHash(json, type, snapshots, {includeId: true});
            return json;
        }
    },
  /**
   * findOne
   * @param store
Beispiel #28
0
 showEnvironmentSummary: Ember.computed('numNodes', 'storageSize', function() {
   return (Ember.isPresent(this.get('numNodes')) && Ember.isPresent(this.get('storageSize')));
 }),
L.Google.asyncWait = [];
L.Google.asyncInitialize = function() {
  var i;
  for (i = 0; i < L.Google.asyncWait.length; i++) {
    var o = L.Google.asyncWait[i];
    o._ready = true;
    if (o._container) {
      o._initMapObject();
      o._update();
    }
  }
  L.Google.asyncWait = [];
};

export default BaseLayer.extend({
  createLayer() {

      var googleMapInstanceName = this.get('googleMapInstanceName') ? this.get('googleMapInstanceName') : 'googleMap';
      var googleMapHolder = googleMapInstanceName+'Holder';
      var googleMapLayerName = googleMapInstanceName+'Layer';

    if (!Ember.isPresent(window.timbuktu[googleMapLayerName])) {
      // Use 'googleMap' as default

      window.timbuktu[googleMapLayerName] = new L.Google('ROADMAP', {googleMapInstanceName: googleMapInstanceName, googleMapHolder: googleMapHolder});
    }
    return window.timbuktu[googleMapLayerName];
  }
});
 hasLevel: function () {
   let level = this.get('model.levelName');
   return Ember.isPresent(level);
 }.property('model.levelName'),