SinglePage.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. 'use strict';
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Watson Analytics (C) Copyright IBM Corp. 2016, 2017
  5. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6. */
  7. define(['./TemplateContainer'], function (BaseLayout) {
  8. var PageLayout = null;
  9. /**
  10. * Single page layout used by infographics
  11. */
  12. PageLayout = BaseLayout.extend({
  13. DEF_TIMEOUT: 120000, //120s
  14. init: function init(options) {
  15. PageLayout.inherited('init', this, arguments);
  16. this.services = options.services;
  17. this.eventRouter = this.layoutController.eventRouter;
  18. var layoutController = this.consumeView.layoutController;
  19. var id = this.consumeView.id;
  20. this.layoutController.layoutReady(id).then(function () {
  21. var layoutView = layoutController.getLayoutView(id);
  22. layoutView.onShow();
  23. });
  24. if (this.model.items.length < 1) {
  25. this.eventRouter.trigger('singlePage:no-layout-selected');
  26. }
  27. },
  28. showView: function showView(model) {
  29. if (this.eventRouter) {
  30. this.eventRouter.trigger('layout:createDropZones', {
  31. modelId: model.id
  32. });
  33. }
  34. },
  35. add: function add(layoutView) {
  36. PageLayout.inherited('add', this, arguments);
  37. this.showView(layoutView.model);
  38. }
  39. });
  40. return PageLayout;
  41. });
  42. //# sourceMappingURL=SinglePage.js.map