@ardimedia/angular-portal-azure 0.2.305 → 0.2.307

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.
Files changed (3) hide show
  1. package/apn.d.ts +5 -0
  2. package/apn.js +41 -1
  3. package/package.json +1 -1
package/apn.d.ts CHANGED
@@ -393,10 +393,15 @@ declare namespace angularportalazure {
393
393
  * - call this.setStatusBarException
394
394
  */
395
395
  saveObject(func: () => Promise<any | angularportalazure.Exception> | angular.IPromise<any | angularportalazure.Exception>, ngForm?: any): (Promise<any | void> | angular.IPromise<any | void>);
396
+ deleteItem(func: () => Promise<T | angularportalazure.Exception> | angular.IPromise<T | angularportalazure.Exception>, ngForm?: any): (Promise<T | void> | angular.IPromise<T | void>);
396
397
  /** Extension point */
397
398
  onSaveItem(): void;
398
399
  /** Extension point */
399
400
  onSavedItem(): void;
401
+ /** Extension point */
402
+ onDeleteItem(): void;
403
+ /** Extension point */
404
+ onDeletedItem(): void;
400
405
  onCommandCancel(): void;
401
406
  }
402
407
  }
package/apn.js CHANGED
@@ -1302,12 +1302,50 @@ var angularportalazure;
1302
1302
  _this.setStatusBarException(exception);
1303
1303
  });
1304
1304
  };
1305
+ BladeDetail.prototype.deleteItem = function (func, ngForm) {
1306
+ var _this = this;
1307
+ if (ngForm === void 0) { ngForm = undefined; }
1308
+ this.setStatusBarDeleteData();
1309
+ this.onDeleteItem();
1310
+ // #region form valid?
1311
+ // angularjs: if form valid
1312
+ if (!this.formblade.$valid) {
1313
+ this.statusBar = 'Löschen nicht möglich! [Console] enthält weitere Informationen.';
1314
+ this.statusBarClass = 'apa-statusbar-error';
1315
+ //console.log(this.formblade);
1316
+ return;
1317
+ }
1318
+ // angular: if form valid
1319
+ if (ngForm !== undefined) {
1320
+ if (!ngForm.valid) {
1321
+ return;
1322
+ }
1323
+ }
1324
+ // #endregion
1325
+ this.isCommandDeleteEnabled = false;
1326
+ return func().then(function (data) {
1327
+ _this.clearStatusBar();
1328
+ _this.isCommandDeleteEnabled = true;
1329
+ _this.item = data;
1330
+ _this.onDeletedItem();
1331
+ return data;
1332
+ }).catch(function (exception) {
1333
+ _this.isCommandDeleteEnabled = true;
1334
+ _this.setStatusBarException(exception);
1335
+ });
1336
+ };
1305
1337
  /** Extension point */
1306
1338
  BladeDetail.prototype.onSaveItem = function () {
1307
1339
  };
1308
1340
  /** Extension point */
1309
1341
  BladeDetail.prototype.onSavedItem = function () {
1310
1342
  };
1343
+ /** Extension point */
1344
+ BladeDetail.prototype.onDeleteItem = function () {
1345
+ };
1346
+ /** Extension point */
1347
+ BladeDetail.prototype.onDeletedItem = function () {
1348
+ };
1311
1349
  BladeDetail.prototype.onCommandCancel = function () {
1312
1350
  this.close();
1313
1351
  };
@@ -1553,7 +1591,9 @@ var angularportalazure;
1553
1591
  // #region Static Methods
1554
1592
  Exception.getOneLineMessage = function (exception) {
1555
1593
  var message = '';
1556
- if (exception.Message.toLowerCase().indexOf('cannot insert duplicate key in object') >= 0) {
1594
+ if (exception.Message.toLowerCase().indexOf('cannot insert duplicate key in object') >= 0
1595
+ || exception.Message.toLowerCase().indexOf('the duplicate key value is') >= 0) {
1596
+ console.debug(exception.Message);
1557
1597
  return 'Datensatz mit gleichem Key (Schlüssel) bereits vorhanden!';
1558
1598
  }
1559
1599
  // Add Messages, if available
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.305",
5
+ "version": "0.2.307",
6
6
  "main": "index.js",
7
7
  "typings": "apn.d.ts",
8
8
  "dependencies": {