{ "version": 3, "sources": ["../ui/app/components/mn_pools.js", "../ui/app/components/mn_pending_query_keeper.js", "../ui/app/components/mn_helper.js", "../ui/app/components/mn_pool_default.js"], "sourcesContent": ["/*\nCopyright 2015-Present Couchbase, Inc.\n\nUse of this software is governed by the Business Source License included in\nthe file licenses/BSL-Couchbase.txt. As of the Change Date specified in that\nfile, in accordance with the Business Source License, use of this software will\nbe governed by the Apache License, Version 2.0, included in the file\nlicenses/APL2.txt.\n*/\n\nimport angular from 'angular';\n\nexport default 'mnPools';\n\nangular\n .module('mnPools', [])\n .factory('mnPools', [\"$http\", \"$cacheFactory\", mnPoolsFactory]);\n\nfunction mnPoolsFactory($http, $cacheFactory) {\n var mnPools = {\n get: get,\n clearCache: clearCache,\n getFresh: getFresh,\n export: {}\n };\n\n var launchID = (new Date()).valueOf() + '-' + ((Math.random() * 65536) >> 0);\n\n return mnPools;\n\n function get(mnHttpParams) {\n return $http({\n method: 'GET',\n url: '/pools',\n cache: true,\n mnHttp: mnHttpParams,\n requestType: 'json'\n }).then(function (resp) {\n var pools = resp.data;\n pools.isInitialized = !!pools.pools.length;\n pools.launchID = pools.uuid + '-' + launchID;\n Object.assign(mnPools.export, pools);\n return pools;\n });\n }\n function clearCache() {\n $cacheFactory.get('$http').remove('/pools');\n return this;\n }\n function getFresh() {\n return mnPools.clearCache().get();\n }\n}\n", "/*\nCopyright 2015-Present Couchbase, Inc.\n\nUse of this software is governed by the Business Source License included in\nthe file licenses/BSL-Couchbase.txt. As of the Change Date specified in that\nfile, in accordance with the Business Source License, use of this software will\nbe governed by the Apache License, Version 2.0, included in the file\nlicenses/APL2.txt.\n*/\n\nimport angular from 'angular';\nimport _ from 'lodash';\n\nexport default 'mnPendingQueryKeeper';\n\nangular\n .module(\"mnPendingQueryKeeper\", [])\n .factory(\"mnPendingQueryKeeper\", mnPendingQueryKeeperFactory);\n\nfunction mnPendingQueryKeeperFactory() {\n var pendingQueryKeeper = [];\n\n return {\n getQueryInFly: getQueryInFly,\n removeQueryInFly: removeQueryInFly,\n push: push,\n cancelTabsSpecificQueries: cancelTabsSpecificQueries,\n cancelAllQueries: cancelAllQueries\n };\n\n function cancelAllQueries() {\n var i = pendingQueryKeeper.length;\n while (i--) {\n pendingQueryKeeper[i].canceler();\n }\n }\n function cancelTabsSpecificQueries() {\n var i = pendingQueryKeeper.length;\n while (i--) {\n if (pendingQueryKeeper[i].group !== \"global\") {\n pendingQueryKeeper[i].canceler();\n }\n }\n }\n\n function removeQueryInFly(findMe) {\n var i = pendingQueryKeeper.length;\n while (i--) {\n if (pendingQueryKeeper[i] === findMe) {\n pendingQueryKeeper.splice(i, 1);\n }\n }\n }\n\n function getQueryInFly(config) {\n return _.find(pendingQueryKeeper, function (inFly) {\n return inFly.config.method === config.method &&\n inFly.config.url === config.url;\n });\n }\n\n function push(query) {\n pendingQueryKeeper.push(query);\n }\n}\n", "/*\nCopyright 2015-Present Couchbase, Inc.\n\nUse of this software is governed by the Business Source License included in\nthe file licenses/BSL-Couchbase.txt. As of the Change Date specified in that\nfile, in accordance with the Business Source License, use of this software will\nbe governed by the Apache License, Version 2.0, included in the file\nlicenses/APL2.txt.\n*/\n\nimport angular from 'angular';\nimport _ from 'lodash';\n\nimport mnPendingQueryKeeper from './mn_pending_query_keeper.js';\n\nexport default 'mnHelper';\n\nangular\n .module('mnHelper', [mnPendingQueryKeeper])\n .factory('mnHelper', [\"$window\", \"$state\", \"$location\", \"$timeout\", \"$q\", \"$http\", \"mnPendingQueryKeeper\", mnHelperFactory]);\n\nfunction mnHelperFactory($window, $state, $location, $timeout, $q, $http, mnPendingQueryKeeper) {\n var mnHelper = {\n wrapInFunction: wrapInFunction,\n calculateMaxMemorySize: calculateMaxMemorySize,\n initializeDetailsHashObserver: initializeDetailsHashObserver,\n checkboxesToList: checkboxesToList,\n reloadApp: reloadApp,\n reloadState: reloadState,\n listToCheckboxes: listToCheckboxes,\n getEndings: getEndings,\n generateID: generateID,\n counterSpinner: counterSpinner,\n mainSpinnerCounter: counterSpinner()\n };\n\n return mnHelper;\n\n function getEndings(length) {\n return length !== 1 ? \"s\" : \"\";\n }\n\n function counterSpinner() {\n let counter = 0;\n return {\n increase: () => (counter++),\n decrease: () => (counter > 0 && counter--),\n value: () => !!counter\n }\n }\n\n function wrapInFunction(value) {\n return function () {\n return value;\n };\n }\n function calculateMaxMemorySize(totalRAMMegs) {\n return Math.floor(Math.max(totalRAMMegs * 0.8, totalRAMMegs - 1024));\n }\n function initializeDetailsHashObserver($scope, hashKey, stateName) {\n function getHashValue() {\n return _.clone($state.params[hashKey]) || [];\n }\n $scope.isDetailsOpened = function (hashValue) {\n return _.contains(getHashValue(), String(hashValue));\n };\n $scope.toggleDetails = function (hashValue) {\n var currentlyOpened = getHashValue();\n var stateParams = {};\n if ($scope.isDetailsOpened(hashValue)) {\n stateParams[hashKey] = _.difference(currentlyOpened, [String(hashValue)]);\n $state.go(stateName, stateParams);\n } else {\n currentlyOpened.push(String(hashValue));\n stateParams[hashKey] = currentlyOpened;\n $state.go(stateName, stateParams);\n }\n };\n }\n function checkboxesToList(object) {\n return _.chain(object).pick(angular.identity).keys().value();\n }\n function listToCheckboxes(list) {\n return _.zipObject(list, _.fill(new Array(list.length), true, 0, list.length));\n }\n function reloadApp() {\n $window.location.reload();\n }\n function generateID() {\n return Math.random().toString(36).substr(2, 9);\n }\n function reloadState(state) {\n if (!state) {\n mnPendingQueryKeeper.cancelAllQueries();\n }\n return $state.reload(state);\n }\n}\n", "/*\nCopyright 2015-Present Couchbase, Inc.\n\nUse of this software is governed by the Business Source License included in\nthe file licenses/BSL-Couchbase.txt. As of the Change Date specified in that\nfile, in accordance with the Business Source License, use of this software will\nbe governed by the Apache License, Version 2.0, included in the file\nlicenses/APL2.txt.\n*/\n\nimport angular from 'angular';\nimport _ from 'lodash';\nimport mnPools from './mn_pools.js';\nimport mnHelper from './mn_helper.js';\n\nexport default 'mnPoolDefault';\n\nangular\n .module('mnPoolDefault', [mnPools, mnHelper])\n .factory('mnPoolDefault', [\"mnPools\", \"mnHelper\", \"$http\", \"$q\", \"$window\", \"$location\", \"$httpParamSerializerJQLike\", \"$state\", mnPoolDefaultFactory]);\n\nfunction mnPoolDefaultFactory(mnPools, mnHelper, $http, $q, $window, $location, $httpParamSerializerJQLike, $state) {\n var latest = {};\n var mnPoolDefault = {\n latestValue: latestValue,\n get: get,\n clearCache: clearCache,\n getFresh: getFresh,\n setHideNavSidebar: setHideNavSidebar,\n getUrlsRunningService: getUrlsRunningService,\n export: {\n compat: undefined,\n hideNavSidebar: false\n }\n };\n\n var version50 = encodeCompatVersion(5, 0);\n var version51 = encodeCompatVersion(5, 1);\n var version55 = encodeCompatVersion(5, 5);\n var version65 = encodeCompatVersion(6, 5);\n var version66 = encodeCompatVersion(6, 6);\n var version70 = encodeCompatVersion(7, 0);\n var version71 = encodeCompatVersion(7, 1);\n var version72 = encodeCompatVersion(7, 2);\n var cache;\n var request;\n\n return mnPoolDefault;\n\n function setHideNavSidebar(value) {\n mnPoolDefault.export.hideNavSidebar = value;\n }\n\n function latestValue() {\n return latest;\n }\n // counterpart of ns_heart:effective_cluster_compat_version/0\n function encodeCompatVersion(major, minor) {\n if (major < 2) {\n return 1;\n }\n return major * 0x10000 + minor;\n }\n function get(params, mnHttpParams) {\n if (!(params && params.etag) && cache) {\n return $q.when(cache);\n }\n if (request && !cache) {\n return request;\n }\n params = params || {waitChange: 0};\n request = $q.all([\n $http({\n mnHttp: mnHttpParams,\n method: 'GET',\n url: '/pools/default',\n params: params,\n timeout: 30000\n }),\n mnPools.get(mnHttpParams)\n ]).then(function (resp) {\n var poolDefault = resp[0].data;\n var pools = resp[1]\n poolDefault.rebalancing = poolDefault.rebalanceStatus !== 'none';\n //TODO replace serverGroupsUri in isGroupsAvailable using mixed cluster version\n poolDefault.isGroupsAvailable = !!(pools.isEnterprise && poolDefault.serverGroupsUri);\n poolDefault.isEnterprise = pools.isEnterprise;\n poolDefault.thisNode = _.detect(poolDefault.nodes, function (n) {\n return n.thisNode;\n });\n\n poolDefault.isStrippingPort = poolDefault.nodes.every(node => node.hostname.includes(':8091'));\n\n poolDefault.compat = {\n atLeast51: poolDefault.thisNode.clusterCompatibility >= version51,\n atLeast55: poolDefault.thisNode.clusterCompatibility >= version55,\n atLeast65: poolDefault.thisNode.clusterCompatibility >= version65,\n atLeast66: poolDefault.thisNode.clusterCompatibility >= version66,\n atLeast70: poolDefault.thisNode.clusterCompatibility >= version70,\n atLeast71: poolDefault.thisNode.clusterCompatibility >= version71,\n atLeast72: poolDefault.thisNode.clusterCompatibility >= version72\n };\n poolDefault.versions = {\n \"50\": version50,\n \"51\": version51,\n \"55\": version55,\n \"65\": version65,\n \"66\": version66,\n \"70\": version70,\n \"71\": version71,\n \"72\": version72\n };\n poolDefault.capiBase = $window.location.protocol === \"https:\" ? poolDefault.thisNode.couchApiBaseHTTPS : poolDefault.thisNode.couchApiBase;\n\n _.extend(mnPoolDefault.export, poolDefault);\n latest.value = poolDefault; //deprecated and superseded by mnPoolDefault.export\n cache = poolDefault;\n\n return poolDefault;\n }, function (resp) {\n if ((resp.status === 404 && resp.data === \"unknown pool\") || resp.status === 500) {\n mnHelper.reloadApp();\n }\n return $q.reject(resp);\n });\n return request;\n }\n function clearCache() {\n cache = undefined;\n request = undefined;\n return this;\n }\n function getFresh(params) {\n return mnPoolDefault.clearCache().get(params);\n }\n /**\n * getUrlsRunningService - returns a list of URLs for nodes in the cluster\n * running the named service. It assumes that you are currently on a page\n * associated with the service, and it appends the path for the current page\n * to the URL.\n *\n * @param nodeInfos - details on the nodes in the cluster returned\n * by\n * @param service - name of service\n * @param max - optional max number of links to return\n *\n * @return a list of URLs for the current UI location running the\n * specified service.\n */\n function parseHostname(href) {\n var l = document.createElement(\"a\");\n l.href = href;\n return l;\n }\n\n function getUrlsRunningService(nodeInfos, service, max) {\n var nodes = _.filter(nodeInfos, function (node) {\n return _.indexOf(node.services, service) > -1\n && node.clusterMembership === 'active';\n });\n if (max && max < nodes.length) {\n nodes = nodes.slice(0, max);\n }\n var protocol = $location.protocol();\n var search = $httpParamSerializerJQLike($location.search());\n var hash = $location.hash();\n var ext = $state.transition ? parseHostname(\n $state.href(\n $state.transition.to().name,\n $state.transition.params(\"to\"),\n {absolute: true}\n )\n ).hash\n : \"#!\" + $location.path() +\n (search ? \"?\" + search : \"\") +\n (hash ? \"#\" + hash : \"\");\n\n return _.map(nodes, function(node) {\n // ipv4/ipv6/hostname + port\n var link = parseHostname(\"http://\" + node.hostname);\n var port = protocol == \"https\" ? node.ports.httpsMgmt : link.port;\n return protocol\n + \"://\" + link.hostname\n + \":\" + port\n + $window.location.pathname\n + ext;\n });\n }\n}\n"], "mappings": "mIAYA,GAAO,kBAAQ,UAEf,UACG,OAAO,UAAW,IAClB,QAAQ,UAAW,CAAC,QAAS,gBAAiB,iBAEjD,wBAAwB,MAAO,cAAe,CAC5C,GAAI,SAAU,CACZ,IACA,WACA,SACA,OAAQ,IAGN,SAAa,GAAI,QAAQ,UAAY,IAAQ,MAAK,SAAW,OAAU,GAE3E,MAAO,SAEP,aAAa,aAAc,CACzB,MAAO,OAAM,CACX,OAAQ,MACR,IAAK,SACL,MAAO,GACP,OAAQ,aACR,YAAa,SACZ,KAAK,SAAU,KAAM,CACtB,GAAI,OAAQ,KAAK,KACjB,aAAM,cAAgB,CAAC,CAAC,MAAM,MAAM,OACpC,MAAM,SAAW,MAAM,KAAO,IAAM,SACpC,OAAO,OAAO,QAAQ,OAAQ,OACvB,QAGX,qBAAsB,CACpB,qBAAc,IAAI,SAAS,OAAO,UAC3B,KAET,mBAAoB,CAClB,MAAO,SAAQ,aAAa,OAhCvB,wCCLT,GAAO,iCAAQ,uBAEf,UACG,OAAO,uBAAwB,IAC/B,QAAQ,uBAAwB,6BAEnC,sCAAuC,CACrC,GAAI,oBAAqB,GAEzB,MAAO,CACL,cACA,iBACA,KACA,0BACA,kBAGF,2BAA4B,CAE1B,OADI,GAAI,mBAAmB,OACpB,KACL,mBAAmB,GAAG,WAG1B,oCAAqC,CAEn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