@ms-atlas-module/datastudio-datafactory 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @ms-atlas-module/datastudio-datafactory might be problematic. Click here for more details.

Files changed (111) hide show
  1. package/_generated/ClientResources.js +1549 -0
  2. package/_generated/Framework.js +97 -0
  3. package/_generated/Svg.js +201 -0
  4. package/bootstrapper/BreadcrumbsKnockoutBinding.js +25 -0
  5. package/bootstrapper/CSS/Callout.css +43 -0
  6. package/bootstrapper/CSS/Common.css +22 -0
  7. package/bootstrapper/CSS/FormFields.css +133 -0
  8. package/bootstrapper/CSS/InlineBlock.css +34 -0
  9. package/bootstrapper/CSS/ParameterGroups.css +77 -0
  10. package/bootstrapper/CSS/Pivot.css +25 -0
  11. package/bootstrapper/CSS/Wizard.css +197 -0
  12. package/bootstrapper/CalloutBinding.js +52 -0
  13. package/bootstrapper/CollapsibleKnockoutBinding.js +70 -0
  14. package/bootstrapper/CopyBinding.js +150 -0
  15. package/bootstrapper/FilterFlyoutKnockoutBinding.js +114 -0
  16. package/bootstrapper/FormFields.js +397 -0
  17. package/bootstrapper/InlineBlockBinding.js +69 -0
  18. package/bootstrapper/JQueryUIBindings.js +152 -0
  19. package/bootstrapper/KnockoutBindings.js +635 -0
  20. package/bootstrapper/LoadingBinding.js +54 -0
  21. package/bootstrapper/MonacoEditorKnockoutBinding.js +67 -0
  22. package/bootstrapper/ParameterGroupsBinding.js +289 -0
  23. package/bootstrapper/PivotKnockoutBinding.js +61 -0
  24. package/bootstrapper/StatusCalendarFlyoutKnockoutBinding.js +398 -0
  25. package/bootstrapper/StatusCalendarKnockoutBinding.js +107 -0
  26. package/bootstrapper/TelemetryKnockoutBinding.js +68 -0
  27. package/bootstrapper/WinJSButtonKnockoutBinding.js +72 -0
  28. package/bootstrapper/WinJSKnockoutBindings.js +49 -0
  29. package/bootstrapper/WizardBinding.js +611 -0
  30. package/bootstrapper/startup.js +29 -0
  31. package/libs/VivaGraphControl/Content/CSS/Graph.css +157 -0
  32. package/libs/VivaGraphControl/Content/CSS/LightTheme.css +699 -0
  33. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Base/Base.TriggerableLifetimeManager.js +190 -0
  34. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/Base.js +647 -0
  35. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/Image.js +113 -0
  36. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/KnockoutExtensions.js +1064 -0
  37. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/DockedBalloon.js +18 -0
  38. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Animation.js +192 -0
  39. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Commands/MoveNodes.js +83 -0
  40. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Geometry.js +167 -0
  41. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphEntityViewModel.js +260 -0
  42. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphViewModel.js +338 -0
  43. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphWidget.Constants.js +178 -0
  44. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphWidget.js +5190 -0
  45. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/MouseCapture.js +148 -0
  46. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/SvgUtils.js +164 -0
  47. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Detection.js +658 -0
  48. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Resize.js +241 -0
  49. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Util.Private.js +236 -0
  50. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Util.js +905 -0
  51. package/libs/WinJS/WinJs.min.js +61909 -0
  52. package/libs/WinJS/ui-light.css +8500 -0
  53. package/package.json +15 -0
  54. package/scripts/AppContext.js +262 -0
  55. package/scripts/ExposureControl.js +11 -0
  56. package/scripts/Framework/Model/ActivityWindowCache.js +390 -0
  57. package/scripts/Framework/Model/ArmDataFactoryCache.js +77 -0
  58. package/scripts/Framework/Model/Contracts/Activity.js +83 -0
  59. package/scripts/Framework/Model/Contracts/ActivityWindow.js +185 -0
  60. package/scripts/Framework/Model/Contracts/BaseEncodable.js +106 -0
  61. package/scripts/Framework/Model/Contracts/Common.js +19 -0
  62. package/scripts/Framework/Model/Contracts/DataArtifact.js +100 -0
  63. package/scripts/Framework/Model/Contracts/Diagram.js +9 -0
  64. package/scripts/Framework/Model/Contracts/Encodable.js +113 -0
  65. package/scripts/Framework/Model/Contracts/Gateway.js +98 -0
  66. package/scripts/Framework/Model/Contracts/LinkedService.js +200 -0
  67. package/scripts/Framework/Model/Contracts/Pipeline.js +197 -0
  68. package/scripts/Framework/Model/DataCache.js +105 -0
  69. package/scripts/Framework/Model/DataFactoryCache.js +24 -0
  70. package/scripts/Framework/Model/Filter.js +186 -0
  71. package/scripts/Framework/Model/Helpers/ActivityWindowHelper.js +185 -0
  72. package/scripts/Framework/Model/MonitoringView.js +40 -0
  73. package/scripts/Framework/Shared/Constants.js +27 -0
  74. package/scripts/Framework/Shared/DataConstants.js +61 -0
  75. package/scripts/Framework/Shared/Disposable.js +53 -0
  76. package/scripts/Framework/Shared/IconResources.js +59 -0
  77. package/scripts/Framework/Shared/Resources/IbizaSvgs.js +241 -0
  78. package/scripts/Framework/Shared/TypeDeclarations.js +4 -0
  79. package/scripts/Framework/Telemetry/Telemetry.js +78 -0
  80. package/scripts/Framework/UI/Breadcrumbs.js +84 -0
  81. package/scripts/Framework/UI/Command.js +231 -0
  82. package/scripts/Framework/UI/ContextMenu.js +80 -0
  83. package/scripts/Framework/UI/Loader.js +11 -0
  84. package/scripts/Framework/UI/Menu.js +65 -0
  85. package/scripts/Framework/UI/PanelMessage.js +25 -0
  86. package/scripts/Framework/UI/Refresh.js +70 -0
  87. package/scripts/Framework/UI/Spinner.js +61 -0
  88. package/scripts/Framework/UI/StatusCalendar.js +1070 -0
  89. package/scripts/Framework/UI/Toolbar.js +84 -0
  90. package/scripts/Framework/Util/Datetime.js +258 -0
  91. package/scripts/Framework/Util/Log.js +10 -0
  92. package/scripts/Framework/Util/ResourceIdUtil.js +56 -0
  93. package/scripts/Framework/Util/Security.js +73 -0
  94. package/scripts/Framework/Util/Util.js +332 -0
  95. package/scripts/Framework/Views/HoverFlyout.js +92 -0
  96. package/scripts/Handlers/ErrorHandler.js +176 -0
  97. package/scripts/Handlers/MessageHandler.js +115 -0
  98. package/scripts/Handlers/MonitoringViewHandler.js +199 -0
  99. package/scripts/Handlers/RoutingHandler.js +364 -0
  100. package/scripts/Handlers/WinJSHandlers.js +265 -0
  101. package/scripts/MonitoringViewContext.js +75 -0
  102. package/scripts/Services/AzureInsightsService.js +162 -0
  103. package/scripts/Services/AzureResourceManagerService.js +869 -0
  104. package/scripts/Services/BaseService.js +232 -0
  105. package/scripts/Services/DataFactoryService.js +204 -0
  106. package/scripts/Services/HDInsightArmService.js +59 -0
  107. package/scripts/ViewContext.js +9 -0
  108. package/stylesheets/main.css +1042 -0
  109. package/views/Edit/DateTimeFilterViewModel.js +211 -0
  110. package/views/Edit/FilterViewModel.js +131 -0
  111. package/views/Shared/ProvisioningState.js +11 -0
@@ -0,0 +1,260 @@
1
+ var __extends =
2
+ this.__extends ||
3
+ function (d, b) {
4
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
5
+ function __() {
6
+ this.constructor = d;
7
+ }
8
+ __.prototype = b.prototype;
9
+ d.prototype = new __();
10
+ };
11
+ define(["require", "exports", "../../../Util/Util"], function (
12
+ require,
13
+ exports,
14
+ Util
15
+ ) {
16
+ var Main;
17
+ (function (Main) {
18
+ "use strict";
19
+ /**
20
+ * Definition of edge line types.
21
+ */
22
+ (function (EdgeType) {
23
+ /**
24
+ * Single line/curve.
25
+ */
26
+ EdgeType[(EdgeType["Single"] = 1)] = "Single";
27
+ /**
28
+ * 2 parallel lines/curves.
29
+ */
30
+ EdgeType[(EdgeType["Double"] = 2)] = "Double";
31
+ })(Main.EdgeType || (Main.EdgeType = {}));
32
+ var EdgeType = Main.EdgeType;
33
+ /**
34
+ * Definition of edge line styles.
35
+ */
36
+ (function (EdgeStyle) {
37
+ /**
38
+ * Solid line/curve.
39
+ */
40
+ EdgeStyle[(EdgeStyle["Solid"] = 1)] = "Solid";
41
+ /**
42
+ * Dotted line/curve.
43
+ */
44
+ EdgeStyle[(EdgeStyle["Dotted"] = 2)] = "Dotted";
45
+ /**
46
+ * Dashed line/curve.
47
+ */
48
+ EdgeStyle[(EdgeStyle["Dashed"] = 3)] = "Dashed";
49
+ })(Main.EdgeStyle || (Main.EdgeStyle = {}));
50
+ var EdgeStyle = Main.EdgeStyle;
51
+ /**
52
+ * Definition of edge markers.
53
+ */
54
+ (function (EdgeMarker) {
55
+ /**
56
+ * None.
57
+ */
58
+ EdgeMarker[(EdgeMarker["None"] = 1)] = "None";
59
+ /**
60
+ * Arrow.
61
+ */
62
+ EdgeMarker[(EdgeMarker["Arrow"] = 2)] = "Arrow";
63
+ /**
64
+ * Circle.
65
+ */
66
+ EdgeMarker[(EdgeMarker["Circle"] = 3)] = "Circle";
67
+ })(Main.EdgeMarker || (Main.EdgeMarker = {}));
68
+ var EdgeMarker = Main.EdgeMarker;
69
+ /**
70
+ * An abstract class that holds common elements for things that go in the graph.
71
+ * Don't instantiate this.
72
+ */
73
+ var GraphEntity = (function () {
74
+ /**
75
+ * This class is abstract. Do not instantiate it.
76
+ */
77
+ function GraphEntity(id) {
78
+ if (id === void 0) {
79
+ id = Util.newGuid();
80
+ }
81
+ /**
82
+ * Whether this entity allows being selected by a user or not.
83
+ */
84
+ this.selectable = ko.observable(true);
85
+ /**
86
+ * Whether this entity is selected or not.
87
+ */
88
+ this.selected = ko.observable(false);
89
+ /**
90
+ * If true, the entity should have a low opacity.
91
+ */
92
+ this.dimmed = ko.observable(false);
93
+ /**
94
+ * CommandGroup to display in the context menu of the node.
95
+ */
96
+ this.commandGroup = ko.observable("");
97
+ this.id = ko.observable(id);
98
+ }
99
+ return GraphEntity;
100
+ })();
101
+ Main.GraphEntity = GraphEntity;
102
+ /**
103
+ * A graph edge. Put these in Graph.ViewModel's edge array.
104
+ */
105
+ var GraphEdge = (function (_super) {
106
+ __extends(GraphEdge, _super);
107
+ /**
108
+ * Creates a graph edge.
109
+ *
110
+ * @param startNode The node the edge eminates from.
111
+ * @param endNode The node the edge ends on.
112
+ */
113
+ function GraphEdge(startNode, endNode) {
114
+ _super.call(this);
115
+ /**
116
+ * The edge line strength (thickness). Limited to values in the range [1; 6] - where 1 represents the weakest (the thinnest) and 6 - the strongest (the thickest) connection.
117
+ */
118
+ this.strength = ko.observable(1);
119
+ /**
120
+ * The compound type characteristics of the edge line.
121
+ */
122
+ this.type = ko.observable(1 /* Single */);
123
+ /**
124
+ * The style of the edge line.
125
+ */
126
+ this.style = ko.observable(1 /* Solid */);
127
+ /**
128
+ * The start marker of the edge.
129
+ */
130
+ this.startMarker = ko.observable(3 /* Circle */);
131
+ /**
132
+ * The end marker of the edge.
133
+ */
134
+ this.endMarker = ko.observable(2 /* Arrow */);
135
+ this.selectable(false);
136
+ this.startNodeId = ko.observable(startNode.id());
137
+ this.endNodeId = ko.observable(endNode.id());
138
+ }
139
+ return GraphEdge;
140
+ })(GraphEntity);
141
+ Main.GraphEdge = GraphEdge;
142
+ /**
143
+ * A graph node. Put these in Graph.ViewModel's graphNodes array.
144
+ */
145
+ var GraphNode = (function (_super) {
146
+ __extends(GraphNode, _super);
147
+ /**
148
+ * Creates an instance of a graph node.
149
+ * @param initialRect Optional initial position and size information.
150
+ */
151
+ function GraphNode(initialRect) {
152
+ _super.call(this);
153
+ /**
154
+ * The view model to use for displaying the graph node's content.
155
+ */
156
+ this.extensionViewModel = null;
157
+ /**
158
+ * A Knockout template describing what the graph node looks like.
159
+ */
160
+ this.extensionTemplate = "";
161
+ this._initialRect = {
162
+ x: 0,
163
+ y: 0,
164
+ height: 85,
165
+ width: 85,
166
+ };
167
+ if (!initialRect) {
168
+ return;
169
+ }
170
+ if (initialRect.x !== undefined) {
171
+ this._initialRect.x = initialRect.x;
172
+ }
173
+ if (initialRect.y !== undefined) {
174
+ this._initialRect.y = initialRect.y;
175
+ }
176
+ if (initialRect.height !== undefined) {
177
+ this._initialRect.height = initialRect.height;
178
+ }
179
+ if (initialRect.width !== undefined) {
180
+ this._initialRect.width = initialRect.width;
181
+ }
182
+ }
183
+ /**
184
+ * Called when the user activates the graph node (double click or something via accessibility).
185
+ */
186
+ GraphNode.prototype.activated = function () {};
187
+ return GraphNode;
188
+ })(GraphEntity);
189
+ Main.GraphNode = GraphNode;
190
+ /**
191
+ * An abstract class for the graph port is the connection point where an edge attaches to a node.
192
+ * Don't instantiate this.
193
+ */
194
+ var GraphNodePort = (function (_super) {
195
+ __extends(GraphNodePort, _super);
196
+ /**
197
+ * Creates instance of a node port.
198
+ * @param parentGraphNode The node the port belongs to.
199
+ */
200
+ function GraphNodePort(parentGraphNode) {
201
+ _super.call(this);
202
+ /**
203
+ * The value indicates whether the port is connected or not.
204
+ */
205
+ this.connected = ko.observable(false);
206
+ /**
207
+ * The flag manages whether the port should be visible or not.
208
+ */
209
+ this.visible = ko.observable(false);
210
+ if (!parentGraphNode) {
211
+ throw "'parent' parameter is required";
212
+ }
213
+ this._parent = parentGraphNode;
214
+ }
215
+ Object.defineProperty(GraphNodePort.prototype, "parentNode", {
216
+ /**
217
+ * Gets parent node of the port.
218
+ */
219
+ get: function () {
220
+ return this._parent;
221
+ },
222
+ enumerable: true,
223
+ configurable: true,
224
+ });
225
+ return GraphNodePort;
226
+ })(GraphEntity);
227
+ Main.GraphNodePort = GraphNodePort;
228
+ /**
229
+ * The graph node port the edge starts from.
230
+ * Don't instantiate this.
231
+ */
232
+ var InputPort = (function (_super) {
233
+ __extends(InputPort, _super);
234
+ /**
235
+ * Creates the input port instance.
236
+ */
237
+ function InputPort(hostNode) {
238
+ _super.call(this, hostNode);
239
+ }
240
+ return InputPort;
241
+ })(GraphNodePort);
242
+ Main.InputPort = InputPort;
243
+ /**
244
+ * The graph node port the edge ends at.
245
+ * Don't instantiate this.
246
+ */
247
+ var OutputPort = (function (_super) {
248
+ __extends(OutputPort, _super);
249
+ /**
250
+ * Creates the output port instance.
251
+ */
252
+ function OutputPort(hostNode) {
253
+ _super.call(this, hostNode);
254
+ }
255
+ return OutputPort;
256
+ })(GraphNodePort);
257
+ Main.OutputPort = OutputPort;
258
+ })(Main || (Main = {}));
259
+ return Main;
260
+ });
@@ -0,0 +1,338 @@
1
+ var __extends =
2
+ this.__extends ||
3
+ function (d, b) {
4
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
5
+ function __() {
6
+ this.constructor = d;
7
+ }
8
+ __.prototype = b.prototype;
9
+ d.prototype = new __();
10
+ };
11
+ define([
12
+ "require",
13
+ "exports",
14
+ "../../Base/KnockoutExtensions",
15
+ "../../Base/Base",
16
+ "./GraphEntityViewModel",
17
+ ], function (require, exports, KnockoutExtensions, Base, GraphEntityViewModel) {
18
+ var Main;
19
+ (function (Main) {
20
+ "use strict";
21
+ /**
22
+ * Skin styles of the graph editor.
23
+ */
24
+ (function (GraphEditorSkinStyle) {
25
+ /**
26
+ * Canvas and node background colors are consistent with typical blade and parts background colors.
27
+ */
28
+ GraphEditorSkinStyle[(GraphEditorSkinStyle["Blade"] = 0)] = "Blade";
29
+ /**
30
+ * Canvas background color is strictly white or black (depending on main color theme), node background color is a tint of blue.
31
+ */
32
+ GraphEditorSkinStyle[(GraphEditorSkinStyle["Document"] = 1)] = "Document";
33
+ })(Main.GraphEditorSkinStyle || (Main.GraphEditorSkinStyle = {}));
34
+ var GraphEditorSkinStyle = Main.GraphEditorSkinStyle;
35
+ /**
36
+ * Capabilities of the graph editor. Flags enum, literals can be combined.
37
+ */
38
+ (function (GraphEditorCapabilities) {
39
+ /**
40
+ * No editor capabilities. Only viewing, panning and zooming-in/-out allowed on the graph.
41
+ */
42
+ GraphEditorCapabilities[(GraphEditorCapabilities["None"] = 0)] = "None";
43
+ /**
44
+ * Capability to move nodes (connected edges move accordingly).
45
+ */
46
+ GraphEditorCapabilities[(GraphEditorCapabilities["MoveEntities"] = 1)] =
47
+ "MoveEntities";
48
+ /**
49
+ * Capability to update lists of nodes and edges.
50
+ */
51
+ GraphEditorCapabilities[
52
+ (GraphEditorCapabilities["AddRemoveEntities"] = 2)
53
+ ] = "AddRemoveEntities";
54
+ })(Main.GraphEditorCapabilities || (Main.GraphEditorCapabilities = {}));
55
+ var GraphEditorCapabilities = Main.GraphEditorCapabilities;
56
+ /**
57
+ * Strategies defining how edges connect to nodes and how they follow the nodes' moves.
58
+ */
59
+ (function (EdgeConnectionStrategy) {
60
+ /**
61
+ * Edge line is a ray originating at the center of the start node and going to the center of the end node.
62
+ */
63
+ EdgeConnectionStrategy[(EdgeConnectionStrategy["NodeCenter"] = 0)] =
64
+ "NodeCenter";
65
+ /**
66
+ * Edge path is a Bezier curve originating at the output port of the start node and going to the input port of the end node.
67
+ */
68
+ EdgeConnectionStrategy[(EdgeConnectionStrategy["NodePort"] = 1)] =
69
+ "NodePort";
70
+ })(Main.EdgeConnectionStrategy || (Main.EdgeConnectionStrategy = {}));
71
+ var EdgeConnectionStrategy = Main.EdgeConnectionStrategy;
72
+ /**
73
+ * View model that represents a graph.
74
+ */
75
+ var ViewModel = (function (_super) {
76
+ __extends(ViewModel, _super);
77
+ /**
78
+ * Creates instance of Graph ViewModel, optionally setting non-default style skin.
79
+ */
80
+ function ViewModel(styleSkin) {
81
+ if (styleSkin === void 0) {
82
+ styleSkin = 0 /* Blade */;
83
+ }
84
+ _super.call(this);
85
+ /**
86
+ * The strategy defining how edges connect to nodes and how they follow the nodes' moves. Default is EdgeConnectionStrategy.NodeCenter.
87
+ */
88
+ this.edgeConnectionStrategy = ko.observable(0 /* NodeCenter */);
89
+ /**
90
+ * The editing capabilities the graph editor exposes. Default is GraphEditorCapabilities.None.
91
+ */
92
+ this.editorCapabilities = ko.observable(0 /* None */);
93
+ /**
94
+ * All graph nodes in the graph.
95
+ */
96
+ this.graphNodes = new KnockoutExtensions.ObservableMap();
97
+ /**
98
+ * All edges in the graph.
99
+ */
100
+ this.edges = new KnockoutExtensions.ObservableMap();
101
+ /**
102
+ * When dragging graph nodes, they snap to a grid. This is how many pixels wide and tall each grid cell is. Default is 10.
103
+ */
104
+ this.gridResolution = ko.observable(10);
105
+ /**
106
+ * Notifies subscribers when the a layout change has been committed to the graph.
107
+ */
108
+ this.layoutChanged = ko.observable(0);
109
+ /**
110
+ * Returns a new candidate layout without overlaps, given a proposed movement of some nodes.
111
+ * The returned candidade layout is used to preview the change and, if the user commits the change,
112
+ * to update the committed locations of nodes.
113
+ * This should be specified by the extension. If it's set null, no automatic layout will occur.
114
+ *
115
+ * @param changedNodes The nodes with explicitly changed positions.
116
+ * @param rootId The node under the user's cursor (which should not move).
117
+ * @return The nodes with implicitly changed positions.
118
+ */
119
+ this.getLayoutNoOverlaps = ko.observable(null);
120
+ /**
121
+ * Sets the rects for specified graph nodes.
122
+ *
123
+ * This can only be called after widgetAttached() is true, otherwise it will throw an exception.
124
+ * All calls to this function will result in animation, so best practice is to initialize nodes with
125
+ * their starting rects (per the optional constructor).
126
+ * This API is used to allow the widget to track animated and comitted state, as well as allow for batch updates.
127
+ *
128
+ * @param rects Map of rects.
129
+ * @param options Configuratble options (ex: undo/redo stack).
130
+ * @return A promise that resolves once the changes have been applied.
131
+ */
132
+ this.setNodeRects = ko.observable(function (rects, options) {
133
+ throw new Error("Function called before widget was initialized.");
134
+ });
135
+ /**
136
+ * Returns all rects for every graph node, or a specified list of graph node ids.
137
+ *
138
+ * This can only be called after widgetAttached() is true, otherwise it will throw an exception.
139
+ *
140
+ * @param ids The list of ids from which to return corresponding gaphNodes.
141
+ * @return A promise that resolves with a string map of committed rects.
142
+ */
143
+ this.getNodeRects = ko.observable(function (ids) {
144
+ if (ids === void 0) {
145
+ ids = [];
146
+ }
147
+ throw new Error("Function called before widget was initialized.");
148
+ });
149
+ /**
150
+ * Currently selected entities.
151
+ */
152
+ this.selectedEntities = ko.observableArray([]);
153
+ /**
154
+ * When true, the user can multi-select by clicking in the background and dragging. When false, clicking and dragging in the background pans.
155
+ * Default is false.
156
+ */
157
+ this.rectSelectionMode = ko.observable(false);
158
+ /**
159
+ * Zooms to fit the graph in the viewport.
160
+ */
161
+ this.zoomToFit = ko.observable(function () {
162
+ var deferred = Q.defer();
163
+ deferred.resolve();
164
+ return deferred.promise;
165
+ });
166
+ /**
167
+ * Zooms in.
168
+ */
169
+ this.zoomIn = ko.observable(function () {
170
+ var deferred = Q.defer();
171
+ deferred.resolve();
172
+ return deferred.promise;
173
+ });
174
+ /**
175
+ * Zooms out.
176
+ */
177
+ this.zoomOut = ko.observable(function () {
178
+ var deferred = Q.defer();
179
+ deferred.resolve();
180
+ return deferred.promise;
181
+ });
182
+ /**
183
+ * Zooms to 100%.
184
+ */
185
+ this.zoomTo100Percent = ko.observable(function () {
186
+ var deferred = Q.defer();
187
+ deferred.resolve();
188
+ return deferred.promise;
189
+ });
190
+ /**
191
+ * Brings a specified rectangle into the view with an animation.
192
+ */
193
+ this.bringRectIntoView = ko.observable(function (rect) {
194
+ var deferred = Q.defer();
195
+ deferred.resolve();
196
+ return deferred.promise;
197
+ });
198
+ /**
199
+ * If true, disable zoom in/out behavior on mouse wheel events. Default to false.
200
+ */
201
+ this.disableMouseWheelZoom = ko.observable(false);
202
+ /**
203
+ * If true, reduce opacity of all graph entities except the ones selected and the ones in its
204
+ * upstream and downstream
205
+ */
206
+ this.enableLineage = ko.observable(false);
207
+ this._styleSkin = styleSkin;
208
+ }
209
+ /**
210
+ * Teardown the view model.
211
+ */
212
+ ViewModel.prototype.dispose = function () {
213
+ this.graphNodes.dispose();
214
+ this.edges.dispose();
215
+ };
216
+ /**
217
+ * Deletes the specified graph entities (nodes and edges).
218
+ *
219
+ * @param nodesToDelete The array of nodes to delete.
220
+ * @param edgesToDelete The array of edges to delete.
221
+ * @return JQuery promise object that is resolved when the operation completes or fails.
222
+ */
223
+ ViewModel.prototype.deleteEntities = function (
224
+ nodesToDelete,
225
+ edgesToDelete
226
+ ) {
227
+ var deferred = jQuery.Deferred();
228
+ GraphEntitiesDeletion.run(this, nodesToDelete, edgesToDelete);
229
+ deferred.resolve();
230
+ return deferred.promise();
231
+ };
232
+ /**
233
+ * Adds the specified GraphEntityViewModel.GraphEdge instance to the list of the view model edges.
234
+ *
235
+ * @param edgeToAdd The edge instance to add.
236
+ * @return JQuery promise object that is resolved when the operation completes or fails.
237
+ */
238
+ ViewModel.prototype.addEdge = function (edgeToAdd) {
239
+ var deferred = jQuery.Deferred(),
240
+ edge;
241
+ if (!edgeToAdd) {
242
+ throw "The edge is null or undefined.";
243
+ } else if (!this.graphNodes.lookup(edgeToAdd.startNodeId)) {
244
+ throw "The edge start node is not present in the list of the view model graph nodes.";
245
+ } else if (!this.graphNodes.lookup(edgeToAdd.endNodeId)) {
246
+ throw "The edge end node is not present in the list of the view model graph nodes.";
247
+ } else {
248
+ edge = new GraphEntityViewModel.GraphEdge(
249
+ { id: ko.observable(edgeToAdd.startNodeId) },
250
+ { id: ko.observable(edgeToAdd.endNodeId) }
251
+ );
252
+ this.edges.put(edge.id(), edge);
253
+ deferred.resolve();
254
+ }
255
+ return deferred.promise();
256
+ };
257
+ /*
258
+ * Checks whether the specified editor capability is set for the view model.
259
+ * @param capability The capability to check on.
260
+ * @return True if the capability is enabled, false othervise.
261
+ */
262
+ ViewModel.prototype.hasEditorCapability = function (capability) {
263
+ return (this.editorCapabilities() & capability) === capability;
264
+ };
265
+ return ViewModel;
266
+ })(Base.ViewModel);
267
+ Main.ViewModel = ViewModel;
268
+ /**
269
+ * Utility class encapsulates deletion functionality.
270
+ */
271
+ var GraphEntitiesDeletion = (function () {
272
+ function GraphEntitiesDeletion() {}
273
+ /**
274
+ * Performs deletion of the specified nodes and edges from the specified graph model.
275
+ * @param model GraphViewModel.ViewModel instance to run the deletion on.
276
+ * @param nodesToDelete List of nodes to delete.
277
+ * @param edgesToDelete List of edges to delete.
278
+ */
279
+ GraphEntitiesDeletion.run = function (
280
+ model,
281
+ nodesToDelete,
282
+ edgesToDelete
283
+ ) {
284
+ if (nodesToDelete.length > 0 || edgesToDelete.length > 0) {
285
+ var deletedEdges = new KnockoutExtensions.ObservableMap(),
286
+ deletedNodes = new KnockoutExtensions.ObservableMap();
287
+ // Getting dictionaries of what needs to be deleted
288
+ nodesToDelete.forEach(function (nodeToDelete) {
289
+ if (model.graphNodes.lookup(nodeToDelete.id)) {
290
+ deletedNodes.put(nodeToDelete.id, nodeToDelete);
291
+ } else {
292
+ throw (
293
+ "The node " +
294
+ nodeToDelete.id +
295
+ " is not present at the graphNodes map."
296
+ );
297
+ }
298
+ });
299
+ edgesToDelete.forEach(function (edgeToDelete) {
300
+ if (model.edges.lookup(edgeToDelete.id)) {
301
+ deletedEdges.put(edgeToDelete.id, edgeToDelete);
302
+ } else {
303
+ throw (
304
+ "The edge " +
305
+ edgeToDelete.id +
306
+ " is not present at the edges map."
307
+ );
308
+ }
309
+ });
310
+ model.edges.modify(function () {
311
+ model.edges.toArray().forEach(function (edge) {
312
+ // Edge should be deleted if it's connected to a node that's being deleted:
313
+ if (
314
+ deletedNodes.lookup(edge.startNodeId()) ||
315
+ deletedNodes.lookup(edge.endNodeId())
316
+ ) {
317
+ deletedEdges.put(edge.id(), { id: edge.id() });
318
+ }
319
+ if (deletedEdges.lookup(edge.id())) {
320
+ model.edges.remove(edge.id());
321
+ }
322
+ });
323
+ });
324
+ model.graphNodes.modify(function () {
325
+ deletedNodes.forEach(function (node) {
326
+ model.graphNodes.remove(node.id);
327
+ });
328
+ });
329
+ deletedEdges.dispose();
330
+ deletedNodes.dispose();
331
+ }
332
+ };
333
+ return GraphEntitiesDeletion;
334
+ })();
335
+ Main.GraphEntitiesDeletion = GraphEntitiesDeletion;
336
+ })(Main || (Main = {}));
337
+ return Main;
338
+ });