Skip to content

Commit 73d6bc0

Browse files
committed
fixed New Flow and New Entity buttons
- New Flow and New Entity buttons now work - cleaned up on New Flow and New Entity modal implementation
1 parent b87bb6f commit 73d6bc0

File tree

8 files changed

+840
-504
lines changed

8 files changed

+840
-504
lines changed

quick-start/src/main/resources/static/app/services/dataHubService.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@
123123
self.status = status;
124124
self.displayMessage('New entity is created successfully.', 'success', 'notification', false);
125125
})
126-
.error(function (error) {
127-
self.displayMessage(error.message, 'error', 'entityModalMessage', true);
128-
});
129126
}
130127

131128
function displayEntity(entityName) {
@@ -168,13 +165,9 @@
168165
.success(function (selectedEntity) {
169166
self.status.selectedEntity = selectedEntity;
170167
self.displayMessage('New flow is created successfully.', 'success', 'notification', false);
171-
})
172-
.error(function (error) {
173-
self.displayMessage(error.message, 'error', 'flowModalMessage', true);
174168
});
175169
}
176170

177-
178171
function displayMessage(message,messageType,elementId,isModal) {
179172
if(typeof elementId === 'undefined') {
180173
elementId = 'messageDiv';

quick-start/src/main/resources/static/app/services/modalService.js

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@
44

55
angular.module('dhib.quickstart.service.modal', ['ui.bootstrap'])
66
.service('ModalService', ModalService)
7-
.controller('loadDataModalController', LoadDataModalController);
7+
.controller('loadDataModalController', LoadDataModalController)
8+
.controller('entityModalController', EntityModalController)
9+
.controller('flowModalController', FlowModalController);
810

911
function ModalService($uibModal) {
1012
var self = this;
1113
angular.extend(self, {
1214
openLoadDataModal: openLoadDataModal
15+
,openEntityModal: openEntityModal
16+
,openFlowModal: openFlowModal
1317
});
1418

1519
function openLoadDataModal() {
@@ -24,6 +28,43 @@
2428

2529
return modalInstance.result;
2630
}
31+
32+
function openEntityModal() {
33+
var modalInstance = $uibModal.open({
34+
animation : true,
35+
templateUrl : 'top/modal/entityModal.html',
36+
controller : 'entityModalController',
37+
size : 'md',
38+
backdrop : 'static',
39+
keyboard : true
40+
});
41+
42+
return modalInstance.result;
43+
}
44+
45+
function openFlowModal(entityName, flowType, extension) {
46+
var modalInstance = $uibModal.open({
47+
animation : true,
48+
templateUrl : 'top/modal/flowModal.html',
49+
controller : 'flowModalController',
50+
size : 'sm',
51+
backdrop : 'static',
52+
keyboard : true,
53+
resolve : {
54+
'entityName' : function () {
55+
return entityName;
56+
}
57+
,'flowType' : function () {
58+
return flowType;
59+
}
60+
,'extension' : function () {
61+
return extension;
62+
}
63+
}
64+
});
65+
66+
return modalInstance.result;
67+
}
2768
}
2869

2970
function LoadDataModalController($scope, $uibModalInstance) {
@@ -43,5 +84,63 @@
4384
$uibModalInstance.dismiss();
4485
};
4586
}
87+
88+
function EntityModalController($scope, $uibModalInstance, DataHub) {
89+
$scope.entityForm = {};
90+
$scope.errorMessage =null;
91+
$scope.hasError = false;
92+
93+
$scope.ok = function () {
94+
DataHub.saveEntity($scope.entityForm)
95+
.success(function () {
96+
$scope.hasError = false;
97+
98+
$uibModalInstance.close($scope.entityForm);
99+
})
100+
.error(function (error) {
101+
$scope.hasError = true;
102+
$scope.errorMessage = error.message;
103+
})
104+
.finally(function () {
105+
$scope.loading = false;
106+
});
107+
};
108+
109+
$scope.cancel = function () {
110+
$uibModalInstance.dismiss();
111+
};
112+
}
113+
114+
function FlowModalController($scope, $uibModalInstance, DataHub, entityName, flowType, extension) {
115+
$scope.flowForm = {
116+
'entityName' : entityName
117+
,'flowType' : flowType
118+
,'extension' : extension
119+
};
120+
$scope.errorMessage =null;
121+
$scope.hasError = false;
122+
123+
$scope.ok = function () {
124+
$scope.loading = true;
125+
126+
DataHub.saveFlow($scope.flowForm)
127+
.success(function () {
128+
$scope.hasError = false;
129+
130+
$uibModalInstance.close($scope.flowForm);
131+
})
132+
.error(function (error) {
133+
$scope.hasError = true;
134+
$scope.errorMessage = error.message;
135+
})
136+
.finally(function () {
137+
$scope.loading = false;
138+
});
139+
};
140+
141+
$scope.cancel = function () {
142+
$uibModalInstance.dismiss();
143+
};
144+
}
46145

47146
})();

quick-start/src/main/resources/static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<script src="lib/angular.js/js/angular.js"></script>
1414
<script src="lib/angular.js/js/angular-route.js"></script>
1515
<script src="lib/angular.js/js/angular-animate.js"></script>
16-
<script src="lib/angular.js/js/ui-bootstrap-tpls-1.1.2.js"></script>
16+
<script src="lib/angular.js/js/ui-bootstrap-tpls-1.2.4.js"></script>
1717
<script src="lib/angular.js/js/angular-aria.min.js"></script>
1818
<script src="lib/angular.js/js/angular-material.min.js"></script>
1919

0 commit comments

Comments
 (0)