CubeListView.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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
  7. * Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. */
  9. define(['underscore', 'bi/admin/datasource/ui/MetaDataListView', 'bi/admin/nls/StringResource', 'text!bi/admin/datasource/templates/CubeListPaneTemplate.html', 'text!bi/admin/datasource/templates/CubeListTemplate.html'], function (_, MetaDataListView, StringResource, CubeListPaneTemplate, CubeListTemplate) {
  10. 'use strict'; //NOSONAR: meant to be strict
  11. var CubeListView = MetaDataListView.extend({
  12. menuId: 'com.ibm.bi.admin.cubeMenu',
  13. _metaDataColName: 'cubeName',
  14. _displayLoadingToast: false,
  15. init: function init(options) {
  16. CubeListView.inherited('init', this, arguments);
  17. this._template = CubeListTemplate;
  18. this._paneTemplate = CubeListPaneTemplate;
  19. this.sortMap = {
  20. 'schemaName': 'defaultName'
  21. };
  22. },
  23. _buildItems: function _buildItems(schema) {
  24. schema.connId = this.conn.id;
  25. schema.databaseId = schema.defaultName;
  26. schema.typeName = StringResource.get('cube');
  27. return schema;
  28. },
  29. _handleSelection: function _handleSelection(e, contextMenuAction) {
  30. var $item = $(e.target).closest('.bi-admin-list-item');
  31. var id = $item.attr('id').trim();
  32. var selectedIndex = _.find(this.selectedRows, function (schema) {
  33. return schema.id === id;
  34. });
  35. var dirtySelections = this._handleNormalSelect(id, $item, selectedIndex, [], contextMenuAction);
  36. this._applySelectionStyling(dirtySelections);
  37. },
  38. _updateStatus: function _updateStatus(id, moserResponse) {//do nothing
  39. },
  40. _handleBaseModuleError: function _handleBaseModuleError(task) {
  41. var msg = task.response && task.response.entity && task.response.entity.exceptionMsg || task.errorMessage || StringResource.get('internalErrorMsg');
  42. this.glassContext.appController.showErrorMessage(msg, StringResource.get('error'));
  43. }
  44. });
  45. return CubeListView;
  46. });