BackupList.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. "use strict";
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: admin
  5. * Copyright IBM Corp. 2015, 2017
  6. * US Government Users Restricted Rights - Use, duplication or disclosure
  7. * restricted by GSA ADP Schedule Contract with IBM Corp.
  8. */
  9. define(['underscore', 'bi/admin/nls/StringResource', 'bacontentnav/common/ui/ListControl'], function (_, StringResource, ListControl) {
  10. var BackupList = ListControl.extend({
  11. init: function init(options) {
  12. var dataTableOptions = {
  13. columns: this._getColumnSpecs(),
  14. accessibleLabel: StringResource.get('content'),
  15. multiSelect: false,
  16. getJSONDataCallback: this._getBackupList.bind(this),
  17. emptyFolderString: StringResource.get('noBackups')
  18. };
  19. _.extend(this, dataTableOptions);
  20. BackupList.inherited('init', this, arguments);
  21. _.extend(this, options);
  22. },
  23. _getColumnSpecs: function _getColumnSpecs() {
  24. return [{
  25. 'type': 'Text',
  26. 'label': StringResource.get('backupName'),
  27. 'propertyName': 'name',
  28. 'scope': 'row',
  29. 'clickCallback': function clickCallback() {}
  30. }];
  31. },
  32. _getBackupList: function _getBackupList() {
  33. return $.Deferred().resolve({
  34. data: this.contentView.items
  35. }).promise();
  36. },
  37. getSelectedBackupName: function getSelectedBackupName() {
  38. var selectedObj = this.getSelectedObjects();
  39. if (selectedObj == null || selectedObj.length === 0) {
  40. return "";
  41. } else {
  42. return selectedObj[0].name;
  43. }
  44. }
  45. });
  46. return BackupList;
  47. });