123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- 'use strict';
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: CA
- *| (C) Copyright IBM Corp. 2016, 2017
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define([], function () {
- 'use strict';
- var CancelDataSourceRefreshAction = function () {
- function CancelDataSourceRefreshAction() {
- _classCallCheck(this, CancelDataSourceRefreshAction);
- }
- // Called by Glass when actionController is created.
- CancelDataSourceRefreshAction.prototype.initialize = function initialize(context) {
- var _this = this;
- return context.glassContext.getSvc('.DatasetExecutionService').then(function (datasetExecutionService) {
- _this.datasetExecutionService = datasetExecutionService;
- });
- };
- /**
- * Determine when we show/hide the menu item
- */
- CancelDataSourceRefreshAction.prototype.isItemVisible = function isItemVisible(options) {
- var objectInfo = this._getObjectInfo(options);
- if (!objectInfo) {
- return false;
- }
- if (objectInfo.type !== 'dataSet2') {
- return false;
- }
- return this.datasetExecutionService.isExecuting(objectInfo.id);
- };
- /**
- * Default action handler
- */
- CancelDataSourceRefreshAction.prototype.onSelectItem = function onSelectItem(options) {
- var objectInfo = this._getObjectInfo(options);
- if (!objectInfo) {
- return;
- }
- this.datasetExecutionService.cancel({
- 'id': objectInfo.id,
- 'name': objectInfo.defaultName,
- 'glassContext': options.glassContext
- }, true);
- };
- CancelDataSourceRefreshAction.prototype._getObjectInfo = function _getObjectInfo(options) {
- if (options && options.target && options.target.activeObject) {
- var aSelectedContext = options.target.activeObject.aSelectedContext;
- if (aSelectedContext.length === 1) {
- return aSelectedContext[0];
- }
- }
- return null;
- };
- return CancelDataSourceRefreshAction;
- }();
- return CancelDataSourceRefreshAction;
- });
- //# sourceMappingURL=CancelDataSourceRefreshAction.js.map
|