@ardimedia/angular-portal-azure 0.2.341 → 0.2.343

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.
package/apn.d.ts CHANGED
@@ -128,6 +128,7 @@ declare namespace angularportalazure {
128
128
  commandSearch: () => void;
129
129
  commandSearchText: string;
130
130
  isCommandStart: boolean;
131
+ isCommandStartEnabled: boolean;
131
132
  commandStart: () => void;
132
133
  commandStartText: string;
133
134
  isCommandStop: boolean;
@@ -226,20 +227,22 @@ declare namespace angularportalazure {
226
227
  onLoadItemsException(ex: angularportalazure.Exception): void;
227
228
  /**
228
229
  * Default behavior for saving an entity.
230
+ * - validates this.ngForm. if not valid, returns without saving
229
231
  * - call this.setStatusBarSaveData();
230
- * - call this.onSaveItem()
231
- * - validates this.formblade. if not valid, returns without saving
232
232
  * - set this.isCommandSaveEnabled = false
233
+ * - call this.onSaveItem()
233
234
  * - call the provided function
234
235
  * THEN
235
236
  * - call this.clearStatusBar()
236
237
  * - set this.isCommandSaveEnabled = true
238
+ * - set this.isCommandDeleteEnabled = true
237
239
  * - set this.item to the saved data
238
240
  * - call this.onSavedItem()
239
241
  * - returns the saved data
240
242
  * CATCH
241
243
  * - set this.isCommandSaveEnabled = true
242
244
  * - call this.setStatusBarException
245
+ * - call this.onLoadItemsException
243
246
  */
244
247
  saveItem(func: () => Promise<T | angularportalazure.Exception> | angular.IPromise<T | angularportalazure.Exception>, ngForm?: any): (Promise<T | void> | angular.IPromise<T | void>);
245
248
  /** Extension point */
@@ -250,16 +253,21 @@ declare namespace angularportalazure {
250
253
  onSaveItemException(ex: angularportalazure.Exception): void;
251
254
  /**
252
255
  * Default behavior for saving any object.
256
+ * - validates this.ngForm. if not valid, returns without saving
253
257
  * - call this.setStatusBarSaveData();
254
- * - call this.onSaveItem()
255
- * - validates this.formblade. if not valid, returns without saving
258
+ * - set this.isCommandSaveEnabled = false
259
+ * - call this.onSaveObject()
256
260
  * - call the provided function
257
261
  * THEN
258
262
  * - call this.clearStatusBar()
259
- * - call this.onSavedItem()
263
+ * - set this.isCommandSaveEnabled = true
264
+ * - set this.isCommandDeleteEnabled = true
265
+ * - call this.onSavedObject()
260
266
  * - returns the saved data
261
267
  * CATCH
268
+ * - set this.isCommandSaveEnabled = true
262
269
  * - call this.setStatusBarException
270
+ * - call this.onLoadItemsException
263
271
  */
264
272
  saveObject(func: () => Promise<any | angularportalazure.Exception> | angular.IPromise<any | angularportalazure.Exception>, ngForm?: any): (Promise<any | void> | angular.IPromise<any | void>);
265
273
  /** Extension point */
@@ -277,6 +285,30 @@ declare namespace angularportalazure {
277
285
  onDeletedItem(): boolean;
278
286
  /** Extension point */
279
287
  onDeletedObjectException(ex: angularportalazure.Exception): void;
288
+ /**
289
+ * Default behavior for executing
290
+ * - validates ngForm. if not valid, returns without executing
291
+ * - call this.setStatusBarInfo();
292
+ * - set this.isCommandStartEnabled = false
293
+ * - call this.onExecute()
294
+ * - call the provided function
295
+ * THEN
296
+ * - call this.clearStatusBar()
297
+ * - set this.isCommandStartEnabled = true
298
+ * - call this.onExecuted()
299
+ * - returns the data
300
+ * CATCH
301
+ * - set this.isCommandStartEnabled = true
302
+ * - call this.setStatusBarException
303
+ * - call this.onExecuteException
304
+ */
305
+ execute(message: string, func: () => Promise<T | angularportalazure.Exception> | angular.IPromise<T | angularportalazure.Exception>, ngForm?: any): (Promise<T | void> | angular.IPromise<T | void>);
306
+ /** Extension point */
307
+ onExecute(): void;
308
+ /** Extension point */
309
+ onExecuted(): void;
310
+ /** Extension point */
311
+ onExecuteException(ex: angularportalazure.Exception): void;
280
312
  isFormValid(ngForm?: any): boolean;
281
313
  /** Extension point */
282
314
  onSaveItemFormValidation(): boolean;
package/apn.js CHANGED
@@ -302,6 +302,7 @@ var angularportalazure;
302
302
  _this.commandSearch = function () { _this.onCommandSearch(); };
303
303
  _this.commandSearchText = '';
304
304
  _this.isCommandStart = false;
305
+ _this.isCommandStartEnabled = true;
305
306
  _this.commandStart = function () { _this.onCommandStart(); };
306
307
  _this.commandStartText = '';
307
308
  _this.isCommandStop = false;
@@ -800,20 +801,22 @@ var angularportalazure;
800
801
  // #region saveItem
801
802
  /**
802
803
  * Default behavior for saving an entity.
804
+ * - validates this.ngForm. if not valid, returns without saving
803
805
  * - call this.setStatusBarSaveData();
804
- * - call this.onSaveItem()
805
- * - validates this.formblade. if not valid, returns without saving
806
806
  * - set this.isCommandSaveEnabled = false
807
+ * - call this.onSaveItem()
807
808
  * - call the provided function
808
809
  * THEN
809
810
  * - call this.clearStatusBar()
810
811
  * - set this.isCommandSaveEnabled = true
812
+ * - set this.isCommandDeleteEnabled = true
811
813
  * - set this.item to the saved data
812
814
  * - call this.onSavedItem()
813
815
  * - returns the saved data
814
816
  * CATCH
815
817
  * - set this.isCommandSaveEnabled = true
816
818
  * - call this.setStatusBarException
819
+ * - call this.onLoadItemsException
817
820
  */
818
821
  BladeData.prototype.saveItem = function (func, ngForm) {
819
822
  var _this = this;
@@ -850,16 +853,21 @@ var angularportalazure;
850
853
  // #region saveObject
851
854
  /**
852
855
  * Default behavior for saving any object.
856
+ * - validates this.ngForm. if not valid, returns without saving
853
857
  * - call this.setStatusBarSaveData();
854
- * - call this.onSaveItem()
855
- * - validates this.formblade. if not valid, returns without saving
858
+ * - set this.isCommandSaveEnabled = false
859
+ * - call this.onSaveObject()
856
860
  * - call the provided function
857
861
  * THEN
858
862
  * - call this.clearStatusBar()
859
- * - call this.onSavedItem()
863
+ * - set this.isCommandSaveEnabled = true
864
+ * - set this.isCommandDeleteEnabled = true
865
+ * - call this.onSavedObject()
860
866
  * - returns the saved data
861
867
  * CATCH
868
+ * - set this.isCommandSaveEnabled = true
862
869
  * - call this.setStatusBarException
870
+ * - call this.onLoadItemsException
863
871
  */
864
872
  BladeData.prototype.saveObject = function (func, ngForm) {
865
873
  var _this = this;
@@ -930,6 +938,55 @@ var angularportalazure;
930
938
  BladeData.prototype.onDeletedObjectException = function (ex) {
931
939
  };
932
940
  // #endregion
941
+ // #region execute WebApi function
942
+ /**
943
+ * Default behavior for executing
944
+ * - validates ngForm. if not valid, returns without executing
945
+ * - call this.setStatusBarInfo();
946
+ * - set this.isCommandStartEnabled = false
947
+ * - call this.onExecute()
948
+ * - call the provided function
949
+ * THEN
950
+ * - call this.clearStatusBar()
951
+ * - set this.isCommandStartEnabled = true
952
+ * - call this.onExecuted()
953
+ * - returns the data
954
+ * CATCH
955
+ * - set this.isCommandStartEnabled = true
956
+ * - call this.setStatusBarException
957
+ * - call this.onExecuteException
958
+ */
959
+ BladeData.prototype.execute = function (message, func, ngForm) {
960
+ var _this = this;
961
+ if (ngForm === void 0) { ngForm = undefined; }
962
+ if (!this.isFormValid(ngForm) && this.onSaveItemFormValidation()) {
963
+ return;
964
+ }
965
+ this.setStatusBarInfo(message);
966
+ this.isCommandStartEnabled = false;
967
+ this.isCommandSaveEnabled;
968
+ this.onExecute();
969
+ return func().then(function (data) {
970
+ _this.clearStatusBar();
971
+ _this.isCommandStartEnabled = true;
972
+ _this.onExecuted();
973
+ return data;
974
+ }).catch(function (ex) {
975
+ _this.isCommandStartEnabled = true;
976
+ _this.setStatusBarException(ex);
977
+ _this.onExecuteException(ex);
978
+ });
979
+ };
980
+ /** Extension point */
981
+ BladeData.prototype.onExecute = function () {
982
+ };
983
+ /** Extension point */
984
+ BladeData.prototype.onExecuted = function () {
985
+ };
986
+ /** Extension point */
987
+ BladeData.prototype.onExecuteException = function (ex) {
988
+ };
989
+ // #endregion
933
990
  // #region Form Validation
934
991
  BladeData.prototype.isFormValid = function (ngForm) {
935
992
  if (ngForm === void 0) { ngForm = undefined; }
@@ -119,7 +119,7 @@
119
119
  </a>
120
120
  </li>
121
121
  <!-- START -->
122
- <li ng-show="$ctrl.vm.isCommandStart">
122
+ <li ng-show="$ctrl.vm.isCommandStart" ng-class="{'apa-disable-click': !$ctrl.vm.isCommandStartEnabled}">
123
123
  <a data-ng-click="$ctrl.vm.commandStart()" class="fxs-commandBar-item" href="#" data-bind='css: { "fxs-commandBar-itemDisabled": !enabled(), "fxs-commandBar-itemPressed": pressed() }, attr: { href: enabled() ? "#" : null }'>
124
124
  <div class="fxs-commandBar-item-text" data-bind="text: text()">{{$ctrl.vm.commandStartText || 'Start'}}</div>
125
125
  <div class="fxs-commandBar-item-icon" data-bind="image: icon">
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@ardimedia/angular-portal-azure",
3
3
  "description": "Angular Portal Azure - GUI Framework.",
4
4
  "author": "Ardimedia Anstalt <info@ardimedia.com> (http://www.ardimedia.com)",
5
- "version": "0.2.341",
5
+ "version": "0.2.343",
6
6
  "main": "index.js",
7
7
  "typings": "apn.d.ts",
8
8
  "dependencies": {