Пример #1
0
    it('should require userId and visId from the initialization', function () {
      expect(function () {
        MetricsTracker.init({ userId: 'user', visId: 'vis' });
      }).toThrowError('configModel is required');

      MetricsTracker.init({ userId: 'paco', visId: 'jasmine', configModel: 'whatever' });
      expect(MetricsTracker._userId).toBeDefined();
      expect(MetricsTracker._visId).toBeDefined();
      expect(MetricsTracker._configModel).toBeDefined();
    });
Пример #2
0
  beforeEach(function () {
    this.configModel = new ConfigModel({
      base_url: '/u/pepe'
    });

    this.queryGeometryModel = new Backbone.Model({
      status: 'fetched',
      simple_geom: 'point',
      query: 'select * from wadus'
    });

    this.querySchemaModel = new Backbone.Model({
      query: 'select * from wadus'
    });

    spyOn(ExportView.prototype, 'submit');

    MetricsTracker.init({
      userId: 'USER_ID',
      visId: 'VIS_ID',
      configModel: new Backbone.Model()
    });
    spyOn(MetricsTracker, 'track');

    this.modalModel = new Backbone.Model();
    this.view = new ExportView({
      configModel: this.configModel,
      queryGeometryModel: this.queryGeometryModel,
      querySchemaModel: this.querySchemaModel,
      canHideColumns: false,
      modalModel: this.modalModel,
      fromView: 'layer'
    });
    spyOn(this.view, 'fetchCSV').and.callThrough();
    spyOn(this.view, '_fetchGET');

    this.view.render();
  });
Пример #3
0
  vizId: visDefinitionModel.id
});
legendDefinitionsCollection.resetByData(vizJSON);
LegendFactory.init(legendDefinitionsCollection);
LegendsState.init(layerDefinitionsCollection, legendDefinitionsCollection);

Notifier.init({
  editorModel: editorModel,
  visDefinitionModel: visDefinitionModel
});

AppNotifications.init();

MetricsTracker.init({
  userId: userModel.get('id'),
  visId: visDefinitionModel.get('id'),
  configModel: configModel
});

BuilderOnboardingLauncher.init({
  onboardings: onboardings,
  userModel: userModel,
  editorModel: editorModel,
  onboardingNotification: onboardingNotification
});

AnalysesService.init({
  onboardings: onboardings,
  layerDefinitionsCollection: layerDefinitionsCollection,
  modals: modals,
  userModel: userModel,
Пример #4
0
 expect(function () {
   MetricsTracker.init({ userId: 'user', visId: 'vis' });
 }).toThrowError('configModel is required');
Пример #5
0
 beforeEach(function () {
   var configModel = new Backbone.Model();
   MetricsTracker.init({ userId: 'paco', visId: 'jasmine', configModel: configModel });
   spyOn(MetricsModel.prototype, 'save');
 });
Пример #6
0
var configModel = new ConfigModel({ base_url: baseURL });

var layerStyleCollection = new LayerStyleCollection();
layerStyleCollection.resetByLayersData(layersData);

var embedView = new EmbedView({
  title: vizJSON.title,
  description: utils.stripHTML(vizJSON.description),
  showMenu: vizJSON.options.dashboard_menu,
  showLegends: vizJSON.options.legends && anyLayerWithLegends,
  showLayerSelector: !!vizJSON.options.layer_selector
});

MetricsTracker.init({
  visId: vizJSON.id,
  configModel: configModel
});

$('#dashboard').prepend(embedView.render().$el);

var cartoLogoOption = _.findWhere(vizJSON.overlays, {type: 'logo'});
var dashboardOpts = {
  no_cdn: false,
  cartodb_logo: cartoLogoOption !== undefined,
  renderMenu: vizJSON.options.dashboard_menu,
  share_urls: true,
  authToken: authTokens,
  layerSelectorEnabled: true
};

var stateFromURL = URLStateHelper.getStateFromCurrentURL();