stub.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*##############################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ############################################################################## */
  16. define([
  17. "dojo/_base/fx",
  18. "dojo/_base/window",
  19. "dojo/dom",
  20. "dojo/dom-style",
  21. "dojo/dom-geometry",
  22. "dojo/io-query",
  23. "dojo/ready",
  24. "hpcc/ECLPlaygroundWidget",
  25. "hpcc/GraphPageWidget",
  26. "hpcc/ResultsWidget",
  27. "hpcc/TimingPageWidget",
  28. "hpcc/TimingTreeMapWidget",
  29. "hpcc/ECLSourceWidget",
  30. "hpcc/InfoGridWidget",
  31. "hpcc/WUQueryWidget",
  32. "hpcc/WUDetailsWidget",
  33. "hpcc/GetDFUWorkunitsWidget",
  34. "hpcc/DFUWUDetailsWidget",
  35. "hpcc/DFUWUQueryWidget",
  36. "hpcc/LFDetailsWidget"
  37. ], function (fx, baseWindow, dom, domStyle, domGeometry, ioQuery, ready,
  38. ECLPlaygroundWidget, GraphPageWidget, ResultsWidget, TimingPageWidget, TimingTreeMapWidget, ECLSourceWidget, InfoGridWidget, WUQueryWidget, WUDetailsWidget, GetDFUWorkunitsWidget, DFUWUDetailsWidget, DFUWUQueryWidget, LFDetailsWidget
  39. ) {
  40. var initUi = function () {
  41. var params = ioQuery.queryToObject(dojo.doc.location.search.substr((dojo.doc.location.search.substr(0, 1) == "?" ? 1 : 0)));
  42. //TODO: Can we get rid of the required dependency above?
  43. var widget = new (eval(params.Widget))({
  44. id: "appLayout",
  45. "class": "hpccApp"
  46. });
  47. if (widget) {
  48. widget.placeAt(dojo.body(), "last");
  49. widget.startup();
  50. widget.init(params);
  51. }
  52. },
  53. startLoading = function (targetNode) {
  54. var overlayNode = dom.byId("loadingOverlay");
  55. if ("none" == domStyle.get(overlayNode, "display")) {
  56. var coords = domGeometry.getMarginBox(targetNode || baseWindow.body());
  57. domGeometry.setMarginBox(overlayNode, coords);
  58. domStyle.set(dom.byId("loadingOverlay"), {
  59. display: "block",
  60. opacity: 1
  61. });
  62. }
  63. },
  64. endLoading = function () {
  65. fx.fadeOut({
  66. node: dom.byId("loadingOverlay"),
  67. duration: 175,
  68. onEnd: function (node) {
  69. domStyle.set(node, "display", "none");
  70. }
  71. }).play();
  72. };
  73. return {
  74. init: function () {
  75. startLoading();
  76. ready(function () {
  77. initUi();
  78. endLoading();
  79. });
  80. }
  81. };
  82. });