<commit_before>import Ember from 'ember';
import GeneratorModel from '../models/generator';
import config from '../config/environment';

export default Ember.Route.extend({
  model: function () {
    return GeneratorModel.create();
  },
  setupController: function(controller, model) {
    this.controllerFor('generator').set('model', model);
  },
  activate: function() {
    this._super();
    Ember.$('.application').addClass('l-app-style');
    Ember.$('footer').addClass('is-small');
  },
  deactivate: function() {
    this._super();
    Ember.$('.application').removeClass('l-app-style');
    Ember.$('footer').removeClass('is-small');
  },
  actions: {
    startComplete: function(siteUrl, file) {
      var model = this.modelFor('generator');
      if(siteUrl){
        model.set('siteUrl', siteUrl);
        model.save();
      } else if (file) {
        model.upload(file);
      }
    },
    updateLogos: function(logos) {
      var model = this.modelFor('generator');
      model.set('manifest.icons',logos);
      model.save();
    },
    buildArchive: function(platform){
      this.ga('send', 'event', 'item', 'click', 'generator-build-trigger');
      var model = this.modelFor('generator');
      model.build(platform);
    },
    downloadArchive: function(archiveLink, platform){
      var model = this.modelFor('generator');
      model.set('build' + platform + 'Ready',true);
      this.ga('send', 'event', 'item', 'click', 'generator-build-download');
      window.location.href = archiveLink;
    },
    publishWin10Package: function(publishName, publishEmail){
      var model = this.modelFor('generator');
      
      var platform = 'windows10';
      
      var options = { 
        DotWeb: false, 
        AutoPublish: true, 
        autoPublishName: publishName, 
        autoPublishEmail: publishEmail
      };
      
      model.package(platform, options);
    },
    updateModelProperty: function(name, value) {
      var model = this.modelFor('generator');
      model.set('manifest.'+ name, value);
      model.save();
    },
    manageMember: function(action, member){
      var model = this.modelFor('generator');
      var manifest = model.get('manifest');
      if(action === 'add'){
        manifest[member.member_name] = member.member_value;
      } else if (action === 'remove') {
        delete manifest[member.member_name];
      }
      model.save();
    },
    manageRelatedApplications: function(action, relatedApp) {
      var model = this.modelFor('generator');
      var manifest = model.get('manifest');
      if(action === 'add'){
        if (!manifest.related_applications) {
          manifest.related_applications = Ember.A();
        }
        manifest.related_applications.pushObject(relatedApp);
      } else if (action === 'remove') {
        var _relatedApp = manifest.related_applications.filter(function(item) {
          return item.platform === relatedApp.platform && item.url === relatedApp.url && item.id === relatedApp.id;
        });
        if (_relatedApp) {
          manifest.related_applications.removeObjects(_relatedApp);
        }
        if (manifest.related_applications.length === 0) {
          delete manifest["related_applications"];
        }
      }
      model.save();
    },
    didTransition: function() {
      Ember.$('.application').addClass('l-app-style');
    },
    updateModel: function(){
      var model = this.modelFor('generator');
      model.save();
    },
    startOver: function(){
      this.refresh();
    },
    downloadServiceWorker: function() {
      var model = this.modelFor('generator');
      model.downloadServiceWorker();
    },
    getServiceWorkerCodePreview: function() {
      var model = this.modelFor('generator');
      model.getServiceWorkerCodePreview();
    }, 
    downloadManifest: function() {
      var model = this.modelFor('generator');
      window.location = config.APP.API_URL + '/manifests/?id=' + model.get('manifestId');<commit_msg>Changed API invocation to download the manifest<commit_after>import Ember from 'ember';
import GeneratorModel from '../models/generator';
import config from '../config/environment';

export default Ember.Route.extend({
  model: function () {
    return GeneratorModel.create();
  },
  setupController: function(controller, model) {
    this.controllerFor('generator').set('model', model);
  },
  activate: function() {
    this._super();
    Ember.$('.application').addClass('l-app-style');
    Ember.$('footer').addClass('is-small');
  },
  deactivate: function() {
    this._super();
    Ember.$('.application').removeClass('l-app-style');
    Ember.$('footer').removeClass('is-small');
  },
  actions: {
    startComplete: function(siteUrl, file) {
      var model = this.modelFor('generator');
      if(siteUrl){
        model.set('siteUrl', siteUrl);
        model.save();
      } else if (file) {
        model.upload(file);
      }
    },
    updateLogos: function(logos) {
      var model = this.modelFor('generator');
      model.set('manifest.icons',logos);
      model.save();
    },
    buildArchive: function(platform){
      this.ga('send', 'event', 'item', 'click', 'generator-build-trigger');
      var model = this.modelFor('generator');
      model.build(platform);
    },
    downloadArchive: function(archiveLink, platform){
      var model = this.modelFor('generator');
      model.set('build' + platform + 'Ready',true);
      this.ga('send', 'event', 'item', 'click', 'generator-build-download');
      window.location.href = archiveLink;
    },
    publishWin10Package: function(publishName, publishEmail){
      var model = this.modelFor('generator');
      
      var platform = 'windows10';
      
      var options = { 
        DotWeb: false, 
        AutoPublish: true, 
        autoPublishName: publishName, 
        autoPublishEmail: publishEmail
      };
      
      model.package(platform, options);
    },
    updateModelProperty: function(name, value) {
      var model = this.modelFor('generator');
      model.set('manifest.'+ name, value);
      model.save();
    },
    manageMember: function(action, member){
      var model = this.modelFor('generator');
      var manifest = model.get('manifest');
      if(action === 'add'){
        manifest[member.member_name] = member.member_value;
      } else if (action === 'remove') {
        delete manifest[member.member_name];
      }
      model.save();
    },
    manageRelatedApplications: function(action, relatedApp) {
      var model = this.modelFor('generator');
      var manifest = model.get('manifest');
      if(action === 'add'){
        if (!manifest.related_applications) {
          manifest.related_applications = Ember.A();
        }
        manifest.related_applications.pushObject(relatedApp);
      } else if (action === 'remove') {
        var _relatedApp = manifest.related_applications.filter(function(item) {
          return item.platform === relatedApp.platform && item.url === relatedApp.url && item.id === relatedApp.id;
        });
        if (_relatedApp) {
          manifest.related_applications.removeObjects(_relatedApp);
        }
        if (manifest.related_applications.length === 0) {
          delete manifest["related_applications"];
        }
      }
      model.save();
    },
    didTransition: function() {
      Ember.$('.application').addClass('l-app-style');
    },
    updateModel: function(){
      var model = this.modelFor('generator');
      model.save();
    },
    startOver: function(){
      this.refresh();
    },
    downloadServiceWorker: function() {
      var model = this.modelFor('generator');
      model.downloadServiceWorker();
    },
    getServiceWorkerCodePreview: function() {
      var model = this.modelFor('generator');
      model.getServiceWorkerCodePreview();
    }, 
    downloadManifest: function() {
      var model = this.modelFor('generator');
      window.location = config.APP.API_URL + '/manifests/' + model.get('manifestId') + '/download';
{'fraction_non_alphanumeric': 0.15492604662822762, 'fraction_numerical': 0.00125344697919278, 'mean_word_length': 2.873300970873786, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2323011', 'n_tokens_mistral': 2249, 'n_tokens_neox': 2210, 'n_words': 418}