@equinor/echo-framework 0.9.11 → 0.9.14
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.
- package/dist/components/appLinks/applinkUtils.d.ts +2 -0
- package/dist/components/appLinks/applinkUtils.test.d.ts +1 -0
- package/dist/index.js +3 -0
- package/package.json +42 -39
- package/dist/_virtual/_tslib.js +0 -67
- package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +0 -25
- package/dist/node_modules/@equinor/eds-icons/dist/icons.esm.js +0 -5285
- package/dist/node_modules/@microsoft/signalr/dist/esm/AbortController.js +0 -54
- package/dist/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +0 -96
- package/dist/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +0 -47
- package/dist/node_modules/@microsoft/signalr/dist/esm/Errors.js +0 -287
- package/dist/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +0 -283
- package/dist/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +0 -86
- package/dist/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +0 -20
- package/dist/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +0 -82
- package/dist/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +0 -1169
- package/dist/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +0 -1346
- package/dist/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +0 -165
- package/dist/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +0 -33
- package/dist/node_modules/@microsoft/signalr/dist/esm/ILogger.js +0 -37
- package/dist/node_modules/@microsoft/signalr/dist/esm/ITransport.js +0 -37
- package/dist/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +0 -179
- package/dist/node_modules/@microsoft/signalr/dist/esm/Loggers.js +0 -35
- package/dist/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +0 -448
- package/dist/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +0 -238
- package/dist/node_modules/@microsoft/signalr/dist/esm/Subject.js +0 -99
- package/dist/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +0 -45
- package/dist/node_modules/@microsoft/signalr/dist/esm/Utils.js +0 -435
- package/dist/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +0 -264
- package/dist/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +0 -133
- package/dist/node_modules/history/esm/history.js +0 -498
- package/dist/node_modules/resolve-pathname/esm/resolve-pathname.js +0 -73
- package/dist/node_modules/style-inject/dist/style-inject.es.js +0 -36
- package/dist/node_modules/tiny-invariant/dist/tiny-invariant.esm.js +0 -23
- package/dist/node_modules/tiny-warning/dist/tiny-warning.esm.js +0 -26
- package/dist/src/components/appLinks/AppLinks.js +0 -38
- package/dist/src/components/appLinks/AppLinks.module.css.js +0 -14
- package/dist/src/components/appLinks/linkButton/linkButton.js +0 -45
- package/dist/src/components/containers/layout.module.css.js +0 -25
- package/dist/src/components/containers/layouts.js +0 -62
- package/dist/src/components/contextualAppLinks/contextualAppLinks.context.js +0 -20
- package/dist/src/components/contextualAppLinks/contextualAppLinks.js +0 -47
- package/dist/src/components/contextualAppLinks/externalAppsMenu.js +0 -157
- package/dist/src/components/contextualAppLinks/externalAppsMenu.module.css.js +0 -16
- package/dist/src/components/contextualAppLinks/externalLinkButtons/allExternalLinks.js +0 -127
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkButtons.helpers.js +0 -169
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToCommApp.js +0 -95
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToMcApp.js +0 -95
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToProCoSys.js +0 -84
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSafeX.js +0 -38
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSap.js +0 -110
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSemiDoc.js +0 -59
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToStid.js +0 -40
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToTr2000.js +0 -114
- package/dist/src/components/contextualAppLinks/externalLinkButtons/iconButtonSpinner.js +0 -44
- package/dist/src/components/contextualAppLinks/externalLinkButtons/iconButtonSpinner.module.css.js +0 -15
- package/dist/src/components/contextualAppLinks/hooks/useContextualAppLinks.js +0 -52
- package/dist/src/components/contextualAppLinks/hooks/useContextualAppLinksContext.js +0 -36
- package/dist/src/components/contextualAppLinks/index.js +0 -22
- package/dist/src/components/contextualAppLinks/internalAppLinks.js +0 -115
- package/dist/src/components/contextualAppLinks/linkButton.js +0 -57
- package/dist/src/components/echoLogo/echoLogo.js +0 -30
- package/dist/src/components/echoLogo/echoLogo.module.css.js +0 -15
- package/dist/src/components/errorBoundary/components/chunkLoadErrorMessage.js +0 -64
- package/dist/src/components/errorBoundary/components/chunkLoadErrorMessage.module.css.js +0 -17
- package/dist/src/components/errorBoundary/components/errorBoundaryBaseMessage.js +0 -85
- package/dist/src/components/errorBoundary/components/errorBoundaryBaseMessage.module.css.js +0 -19
- package/dist/src/components/errorBoundary/components/notificationCardWithLogo.js +0 -55
- package/dist/src/components/errorBoundary/components/notificationCardWithLogo.module.css.js +0 -19
- package/dist/src/components/errorBoundary/errorBoundary.js +0 -100
- package/dist/src/components/externalLinkButton/externalLinkButton.js +0 -310
- package/dist/src/components/externalLinkButton/externalLinkButton.module.css.js +0 -23
- package/dist/src/components/footer/footer.js +0 -42
- package/dist/src/components/footer/footer.module.css.js +0 -17
- package/dist/src/components/lazyLoading/appLoadingIndicator.js +0 -34
- package/dist/src/components/lazyLoading/appLoadingIndicator.module.css.js +0 -15
- package/dist/src/components/lazyLoading/lazyLoadedAppWrapper.js +0 -40
- package/dist/src/components/mediator/mediator.js +0 -32
- package/dist/src/components/pageMenu/Navigation/applicationList.js +0 -35
- package/dist/src/components/pageMenu/Navigation/applicationList.module.css.js +0 -17
- package/dist/src/components/pageMenu/accordionItem.module.css.js +0 -16
- package/dist/src/components/pageMenu/defaultAccordionItem.js +0 -61
- package/dist/src/components/pageMenu/pageMenu.js +0 -141
- package/dist/src/components/pageMenu/pageMenu.module.css.js +0 -17
- package/dist/src/components/pageMenu/pageMenuDrawerItem.js +0 -77
- package/dist/src/components/pageMenu/pageMenuDrawerItem.module.css.js +0 -20
- package/dist/src/components/pageMenu/settings/asset.js +0 -40
- package/dist/src/components/pageMenu/settings/profile.js +0 -62
- package/dist/src/components/pageMenu/settings/settings.js +0 -41
- package/dist/src/components/pageMenu/settings/settings.module.css.js +0 -25
- package/dist/src/components/pageMenu/version/version.js +0 -88
- package/dist/src/components/pageMenu/version/version.module.css.js +0 -14
- package/dist/src/components/panel/corePanelIcon.js +0 -31
- package/dist/src/components/panel/corePanelLeft.js +0 -91
- package/dist/src/components/panel/corePanelLeft.module.css.js +0 -19
- package/dist/src/components/panel/corePanelRight.js +0 -95
- package/dist/src/components/panel/corePanelRight.module.css.js +0 -18
- package/dist/src/components/panelButton/panelButton.js +0 -124
- package/dist/src/components/panelButton/panelButton.module.css.js +0 -25
- package/dist/src/components/plantSelector/plantSelector.js +0 -137
- package/dist/src/components/projectSelector/ProcosysProjectSelector.js +0 -115
- package/dist/src/components/projectSelector/ProcosysProjectSelector.module.css.js +0 -14
- package/dist/src/components/realTimeData/RealTimePopoverButton.js +0 -168
- package/dist/src/components/realTimeData/components/IMSDropdown/RealTimeIMSDropdown.js +0 -83
- package/dist/src/components/realTimeData/components/IMSDropdown/RealTimeIMSDropdown.module.css.js +0 -15
- package/dist/src/components/realTimeData/components/connectorForIMSTag/IMSConnector.module.css.js +0 -17
- package/dist/src/components/realTimeData/components/connectorForIMSTag/RealTimeConnectorForIMSTag.js +0 -149
- package/dist/src/components/realTimeData/components/contextButton/RealTimeContextButton.js +0 -75
- package/dist/src/components/realTimeData/components/contextButton/RealTimeContextButton.module.css.js +0 -15
- package/dist/src/components/realTimeData/components/contextPopover/Popover.js +0 -37
- package/dist/src/components/realTimeData/components/contextPopover/Popover.module.css.js +0 -15
- package/dist/src/components/realTimeData/hooks/useRealTimeHub.js +0 -124
- package/dist/src/components/realTimeData/hooks/useSignalR.js +0 -175
- package/dist/src/components/realTimeData/hooks/useSignalRListener.js +0 -22
- package/dist/src/components/router/echoRoute.js +0 -45
- package/dist/src/components/router/echoRouter.js +0 -30
- package/dist/src/components/router/echoWrapper.js +0 -33
- package/dist/src/components/router/routes.js +0 -46
- package/dist/src/components/router/useLayout.js +0 -32
- package/dist/src/components/searchMenu/searchMenu.js +0 -46
- package/dist/src/components/searchMenu/searchMenu.module.css.js +0 -16
- package/dist/src/components/tagNumber/tagNo.module.css.js +0 -14
- package/dist/src/components/tagNumber/tagNumber.js +0 -38
- package/dist/src/components/toaster/toaster.js +0 -43
- package/dist/src/components/toaster/toaster.module.css.js +0 -15
- package/dist/src/components/toaster/toasters.js +0 -101
- package/dist/src/coreApplication/EchoContent.js +0 -32
- package/dist/src/coreApplication/EchoContentPanels.js +0 -40
- package/dist/src/coreApplication/EchoEventHandler.js +0 -79
- package/dist/src/coreApplication/EchoEventHandler.module.css.js +0 -14
- package/dist/src/globalStyles.css.js +0 -6
- package/dist/src/hooks/hookLibrary.js +0 -86
- package/dist/src/hooks/index.js +0 -12
- package/dist/src/hooks/useEchoHistory.js +0 -38
- package/dist/src/hooks/useLongPress.js +0 -37
- package/dist/src/hooks/useSemi.js +0 -100
- package/dist/src/hooks/useTagDetails.js +0 -153
- package/dist/src/icons/common/CommissionApp-icon.png.js +0 -7
- package/dist/src/icons/common/Evision.svg.js +0 -68
- package/dist/src/icons/common/Fusion.svg.js +0 -111
- package/dist/src/icons/common/McApp.svg.js +0 -70
- package/dist/src/icons/common/Notification.svg.js +0 -81
- package/dist/src/icons/common/ProCoSysIcon.svg.js +0 -68
- package/dist/src/icons/common/Robim.svg.js +0 -66
- package/dist/src/icons/common/SX-logo.png.js +0 -7
- package/dist/src/icons/common/SapLogo.svg.js +0 -95
- package/dist/src/icons/common/SemiIcon.svg.js +0 -82
- package/dist/src/icons/common/Stid.svg.js +0 -65
- package/dist/src/icons/common/TR2000.svg.js +0 -73
- package/dist/src/icons/common/WorkOrder.svg.js +0 -71
- package/dist/src/icons/common/Yammer.svg.js +0 -65
- package/dist/src/icons/common/satos-logo.png.js +0 -7
- package/dist/src/icons/edsIons.js +0 -15
- package/dist/src/icons/equinor-logo.js +0 -62
- package/dist/src/icons/logo_ee.js +0 -37
- package/dist/src/icons/search.js +0 -35
- package/dist/src/index.js +0 -209
- package/dist/src/index2.js +0 -201
- package/dist/src/services/api/api-manager.js +0 -190
- package/dist/src/services/api/api-plantinfo.js +0 -196
- package/dist/src/services/api/api-plants.js +0 -75
- package/dist/src/services/api/api-realtimedata.js +0 -55
- package/dist/src/services/api/api-tag-details.js +0 -69
- package/dist/src/services/api/api-tags.js +0 -88
- package/dist/src/services/api/api-version.js +0 -124
- package/dist/src/services/componentRegistry/componentRegistry.js +0 -69
- package/dist/src/services/echopediaAnalyticsModule/echopediaAnalyticsModule.js +0 -10
- package/dist/src/services/eventCallbacks/plantChanged.js +0 -42
- package/dist/src/services/eventHubActions/toastActions.js +0 -18
- package/dist/src/theme/themeConst.js +0 -75
- package/dist/src/types/extensions.js +0 -10
- package/dist/src/types/legend.js +0 -58
- package/dist/src/types/pingableSources.js +0 -11
- package/dist/src/utils/copyText.js +0 -67
- package/dist/src/utils/eventHandlerUtils.js +0 -11
- package/dist/src/utils/legendUtils.js +0 -168
- package/dist/src/utils/navigationUtils.js +0 -28
- package/dist/src/utils/plantInfo.js +0 -535
- package/dist/src/utils/plantsDataUtils.js +0 -35
- package/dist/src/utils/projectSelectorUtils.js +0 -19
- package/dist/src/utils/startup.js +0 -89
- package/dist/src/utils/taskCache.js +0 -89
|
@@ -1,535 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
6
|
-
|
|
7
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
-
|
|
9
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
-
|
|
11
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', {
|
|
14
|
-
value: true
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
var _tslib = require('../../_virtual/_tslib.js');
|
|
18
|
-
|
|
19
|
-
var EchoCore = require('@equinor/echo-core');
|
|
20
|
-
|
|
21
|
-
var apiPlantinfo = require('../services/api/api-plantinfo.js');
|
|
22
|
-
|
|
23
|
-
var echoHubPlantInfoKey = 'echoHubPlantInfo';
|
|
24
|
-
/**
|
|
25
|
-
* Method for setting echo hub plant information in local storage under the key echoHubPlantInfo
|
|
26
|
-
*
|
|
27
|
-
* @param {EchoHubPlant[]} plants list of plant information to add to local storage
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
function setPlantInfo(plants) {
|
|
31
|
-
EchoCore.storage.setItem(echoHubPlantInfoKey, JSON.stringify(plants));
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Method for getting echo hub plant information from local storage.
|
|
35
|
-
* If plant information is not in local storage, then this method will try to fetch the information
|
|
36
|
-
* from the api and update local storage if the api call was a success
|
|
37
|
-
* @export
|
|
38
|
-
* @return {*} {Promise<EchoHubPlant[]>} List of echo hub plant information
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
function getCachedPlantInfo() {
|
|
43
|
-
return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
44
|
-
var plants, plantsFromApi;
|
|
45
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
46
|
-
while (1) {
|
|
47
|
-
switch (_context.prev = _context.next) {
|
|
48
|
-
case 0:
|
|
49
|
-
plants = EchoCore.storage.getItem(echoHubPlantInfoKey);
|
|
50
|
-
|
|
51
|
-
if (!(plants && typeof plants !== 'string')) {
|
|
52
|
-
_context.next = 5;
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return _context.abrupt("return", plants);
|
|
57
|
-
|
|
58
|
-
case 5:
|
|
59
|
-
_context.next = 7;
|
|
60
|
-
return getAllPlants();
|
|
61
|
-
|
|
62
|
-
case 7:
|
|
63
|
-
plantsFromApi = _context.sent;
|
|
64
|
-
|
|
65
|
-
if (!(plantsFromApi.length > 0)) {
|
|
66
|
-
_context.next = 11;
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
setPlantInfo(plantsFromApi);
|
|
71
|
-
return _context.abrupt("return", plantsFromApi);
|
|
72
|
-
|
|
73
|
-
case 11:
|
|
74
|
-
return _context.abrupt("return", []);
|
|
75
|
-
|
|
76
|
-
case 12:
|
|
77
|
-
case "end":
|
|
78
|
-
return _context.stop();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}, _callee);
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Fetches plant information for a given installation code from the api
|
|
86
|
-
*
|
|
87
|
-
* @export
|
|
88
|
-
* @param {string} instCode
|
|
89
|
-
* @return {*} {Promise<EchoHubPlant[]>} list of plant information for a given installation code
|
|
90
|
-
*/
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
function getPlantsOnInstallation(instCode) {
|
|
94
|
-
return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
95
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
96
|
-
while (1) {
|
|
97
|
-
switch (_context2.prev = _context2.next) {
|
|
98
|
-
case 0:
|
|
99
|
-
return _context2.abrupt("return", apiPlantinfo.getPlantsInfo(instCode));
|
|
100
|
-
|
|
101
|
-
case 1:
|
|
102
|
-
case "end":
|
|
103
|
-
return _context2.stop();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}, _callee2);
|
|
107
|
-
}));
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Fetches all plant information for from the api
|
|
111
|
-
*
|
|
112
|
-
* @export
|
|
113
|
-
* @return {*} {Promise<EchoHubPlant[]>} list of plant information for a given installation code
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
function getAllPlants() {
|
|
118
|
-
return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
119
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
120
|
-
while (1) {
|
|
121
|
-
switch (_context3.prev = _context3.next) {
|
|
122
|
-
case 0:
|
|
123
|
-
return _context3.abrupt("return", apiPlantinfo.getPlantsInfo());
|
|
124
|
-
|
|
125
|
-
case 1:
|
|
126
|
-
case "end":
|
|
127
|
-
return _context3.stop();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}, _callee3);
|
|
131
|
-
}));
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Filters out a single plant information for a installation code from a lost of plant information
|
|
135
|
-
*
|
|
136
|
-
* @export
|
|
137
|
-
* @param {EchoHubPlant[]} plantInfo list of plant information to filter from
|
|
138
|
-
* @param {string} instCode installation code to filter list with
|
|
139
|
-
* @param {string} [plantIdentificator] alternative way of filtering the provided plant information
|
|
140
|
-
* @return {*} {(EchoHubPlant | null)} Returns a single plant information or null if no match was found
|
|
141
|
-
*/
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
function getPlant(plantInfo, instCode, plantIdentificator) {
|
|
145
|
-
var result = undefined;
|
|
146
|
-
|
|
147
|
-
if (plantIdentificator) {
|
|
148
|
-
var relatedPlants = plantInfo.filter(function (plant) {
|
|
149
|
-
return plant.installationCode.toUpperCase() === instCode.toUpperCase();
|
|
150
|
-
});
|
|
151
|
-
result = relatedPlants.find(function (plant) {
|
|
152
|
-
return plant.plantCode.substr(plant.plantCode.length - plantIdentificator.length).toUpperCase() === plantIdentificator.toUpperCase();
|
|
153
|
-
});
|
|
154
|
-
} else {
|
|
155
|
-
result = plantInfo.find(function (plant) {
|
|
156
|
-
return plant.installationCode.toUpperCase() === instCode.toUpperCase();
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if (result) {
|
|
161
|
-
return result;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return null;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Gets plant information from a given sap id
|
|
168
|
-
*
|
|
169
|
-
* @export
|
|
170
|
-
* @param {string} sapId Sap id to look for
|
|
171
|
-
* @return {*} {(Promise<EchoHubPlant | null>)} Returns a single plant information or null if no match was found
|
|
172
|
-
*/
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
function getPlantBySapId(sapId) {
|
|
176
|
-
return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
177
|
-
var plantInfo, result;
|
|
178
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
179
|
-
while (1) {
|
|
180
|
-
switch (_context4.prev = _context4.next) {
|
|
181
|
-
case 0:
|
|
182
|
-
_context4.next = 2;
|
|
183
|
-
return getCachedPlantInfo();
|
|
184
|
-
|
|
185
|
-
case 2:
|
|
186
|
-
plantInfo = _context4.sent;
|
|
187
|
-
result = plantInfo.find(function (plant) {
|
|
188
|
-
var _a;
|
|
189
|
-
|
|
190
|
-
return ((_a = plant.sapId) === null || _a === void 0 ? void 0 : _a.toString()) === sapId;
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
if (!result) {
|
|
194
|
-
_context4.next = 6;
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return _context4.abrupt("return", result);
|
|
199
|
-
|
|
200
|
-
case 6:
|
|
201
|
-
return _context4.abrupt("return", null);
|
|
202
|
-
|
|
203
|
-
case 7:
|
|
204
|
-
case "end":
|
|
205
|
-
return _context4.stop();
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}, _callee4);
|
|
209
|
-
}));
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Gets all plant codes for a given installation code
|
|
213
|
-
* @export
|
|
214
|
-
* @param {string} instCode installation code to look for
|
|
215
|
-
* @return {*} {Promise<string[]>} list of plant codes for the given installation
|
|
216
|
-
*/
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
function getPlantCodesOnInstallation(instCode) {
|
|
220
|
-
return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
221
|
-
var plants, plantsOnInstallation;
|
|
222
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
223
|
-
while (1) {
|
|
224
|
-
switch (_context5.prev = _context5.next) {
|
|
225
|
-
case 0:
|
|
226
|
-
_context5.next = 2;
|
|
227
|
-
return getCachedPlantInfo();
|
|
228
|
-
|
|
229
|
-
case 2:
|
|
230
|
-
plants = _context5.sent;
|
|
231
|
-
plantsOnInstallation = plants.filter(function (plant) {
|
|
232
|
-
return plant.installationCode === instCode;
|
|
233
|
-
});
|
|
234
|
-
return _context5.abrupt("return", plantsOnInstallation.map(function (plant) {
|
|
235
|
-
return plant.plantCode;
|
|
236
|
-
}));
|
|
237
|
-
|
|
238
|
-
case 5:
|
|
239
|
-
case "end":
|
|
240
|
-
return _context5.stop();
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}, _callee5);
|
|
244
|
-
}));
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Method for checking a users access to a given installation
|
|
248
|
-
*
|
|
249
|
-
* @export
|
|
250
|
-
* @param {string} instCode installation code to check access for
|
|
251
|
-
* @return {*} {Promise<boolean>} returns whether the user has access to that given installation
|
|
252
|
-
*/
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
function check3dPermissionOnInstallation(instCode) {
|
|
256
|
-
return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
257
|
-
var plantCodesOnInstallation, permittedPlantCodes, _iterator, _step, plantCode;
|
|
258
|
-
|
|
259
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
260
|
-
while (1) {
|
|
261
|
-
switch (_context6.prev = _context6.next) {
|
|
262
|
-
case 0:
|
|
263
|
-
_context6.next = 2;
|
|
264
|
-
return getPlantCodesOnInstallation(instCode);
|
|
265
|
-
|
|
266
|
-
case 2:
|
|
267
|
-
plantCodesOnInstallation = _context6.sent;
|
|
268
|
-
|
|
269
|
-
if (!(plantCodesOnInstallation.length === 1)) {
|
|
270
|
-
_context6.next = 8;
|
|
271
|
-
break;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
_context6.next = 6;
|
|
275
|
-
return apiPlantinfo.check3dPermissionForPlant(plantCodesOnInstallation[0]);
|
|
276
|
-
|
|
277
|
-
case 6:
|
|
278
|
-
_context6.t0 = _context6.sent.plantCodes.length;
|
|
279
|
-
return _context6.abrupt("return", _context6.t0 > 0);
|
|
280
|
-
|
|
281
|
-
case 8:
|
|
282
|
-
_context6.next = 10;
|
|
283
|
-
return apiPlantinfo.getPermitted3dModels();
|
|
284
|
-
|
|
285
|
-
case 10:
|
|
286
|
-
permittedPlantCodes = _context6.sent;
|
|
287
|
-
_iterator = _createForOfIteratorHelper(plantCodesOnInstallation);
|
|
288
|
-
_context6.prev = 12;
|
|
289
|
-
|
|
290
|
-
_iterator.s();
|
|
291
|
-
|
|
292
|
-
case 14:
|
|
293
|
-
if ((_step = _iterator.n()).done) {
|
|
294
|
-
_context6.next = 20;
|
|
295
|
-
break;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
plantCode = _step.value;
|
|
299
|
-
|
|
300
|
-
if (!permittedPlantCodes.plantCodes.includes(plantCode)) {
|
|
301
|
-
_context6.next = 18;
|
|
302
|
-
break;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
return _context6.abrupt("return", true);
|
|
306
|
-
|
|
307
|
-
case 18:
|
|
308
|
-
_context6.next = 14;
|
|
309
|
-
break;
|
|
310
|
-
|
|
311
|
-
case 20:
|
|
312
|
-
_context6.next = 25;
|
|
313
|
-
break;
|
|
314
|
-
|
|
315
|
-
case 22:
|
|
316
|
-
_context6.prev = 22;
|
|
317
|
-
_context6.t1 = _context6["catch"](12);
|
|
318
|
-
|
|
319
|
-
_iterator.e(_context6.t1);
|
|
320
|
-
|
|
321
|
-
case 25:
|
|
322
|
-
_context6.prev = 25;
|
|
323
|
-
|
|
324
|
-
_iterator.f();
|
|
325
|
-
|
|
326
|
-
return _context6.finish(25);
|
|
327
|
-
|
|
328
|
-
case 28:
|
|
329
|
-
return _context6.abrupt("return", false);
|
|
330
|
-
|
|
331
|
-
case 29:
|
|
332
|
-
case "end":
|
|
333
|
-
return _context6.stop();
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}, _callee6, null, [[12, 22, 25, 28]]);
|
|
337
|
-
}));
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Method for checking 3d access for a given instCode or plantCode, if plantCode in provided then instCode is ignored
|
|
341
|
-
*
|
|
342
|
-
* @export
|
|
343
|
-
* @param {string} instCode Installation code to check access on
|
|
344
|
-
* @param {string} [plantCode] Plant code to check access on, installation code is ignored if plant code is provided
|
|
345
|
-
* @return {*} {Promise<boolean>} Whether a user has access to a plant or installation
|
|
346
|
-
*/
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
function check3dAccessForInstCodeOrPlantCode(instCode, plantCode) {
|
|
350
|
-
return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
351
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
352
|
-
while (1) {
|
|
353
|
-
switch (_context7.prev = _context7.next) {
|
|
354
|
-
case 0:
|
|
355
|
-
return _context7.abrupt("return", plantCode ? check3dPermissionForPlantCode(plantCode) : check3dPermissionOnInstallation(instCode));
|
|
356
|
-
|
|
357
|
-
case 1:
|
|
358
|
-
case "end":
|
|
359
|
-
return _context7.stop();
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}, _callee7);
|
|
363
|
-
}));
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Method for checking a users access to a given plant
|
|
367
|
-
*
|
|
368
|
-
* @export
|
|
369
|
-
* @param {string} plantCode plant code to check access to
|
|
370
|
-
* @return {*} {Promise<boolean>} returns whether the user has access to that given plant
|
|
371
|
-
*/
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
function check3dPermissionForPlantCode(plantCode) {
|
|
375
|
-
return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
376
|
-
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
377
|
-
while (1) {
|
|
378
|
-
switch (_context8.prev = _context8.next) {
|
|
379
|
-
case 0:
|
|
380
|
-
_context8.next = 2;
|
|
381
|
-
return apiPlantinfo.check3dPermissionForPlant(plantCode);
|
|
382
|
-
|
|
383
|
-
case 2:
|
|
384
|
-
_context8.t0 = _context8.sent.plantCodes.length;
|
|
385
|
-
return _context8.abrupt("return", _context8.t0 > 0);
|
|
386
|
-
|
|
387
|
-
case 4:
|
|
388
|
-
case "end":
|
|
389
|
-
return _context8.stop();
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}, _callee8);
|
|
393
|
-
}));
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Method to check if a given installation and plant is available in Echo 3d
|
|
397
|
-
*
|
|
398
|
-
* @export
|
|
399
|
-
* @param {string} instCode Installation to check access to
|
|
400
|
-
* @param {string} [plantCode] Plant to check access to
|
|
401
|
-
* @return {*} {Promise<boolean>} returns whether the user has access to that given plant
|
|
402
|
-
*/
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
function checkPlantAvailableIn3d(instCode, plantCode) {
|
|
406
|
-
return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
407
|
-
var plants, plantsOnSelectedInstallation, selectedPlant, plantsAvailableIn3d;
|
|
408
|
-
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
409
|
-
while (1) {
|
|
410
|
-
switch (_context9.prev = _context9.next) {
|
|
411
|
-
case 0:
|
|
412
|
-
_context9.next = 2;
|
|
413
|
-
return getCachedPlantInfo();
|
|
414
|
-
|
|
415
|
-
case 2:
|
|
416
|
-
plants = _context9.sent;
|
|
417
|
-
plantsOnSelectedInstallation = plants.filter(function (plant) {
|
|
418
|
-
return plant.installationCode.toLocaleLowerCase() === instCode.toLocaleLowerCase();
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
if (!(plantsOnSelectedInstallation.length === 1)) {
|
|
422
|
-
_context9.next = 6;
|
|
423
|
-
break;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
return _context9.abrupt("return", plantsOnSelectedInstallation[0].availableInEcho3D);
|
|
427
|
-
|
|
428
|
-
case 6:
|
|
429
|
-
if (!plantCode) {
|
|
430
|
-
_context9.next = 10;
|
|
431
|
-
break;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
selectedPlant = plantsOnSelectedInstallation.find(function (plant) {
|
|
435
|
-
return plant.plantCode.toLocaleLowerCase() === plantCode.toLocaleLowerCase();
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
if (!selectedPlant) {
|
|
439
|
-
_context9.next = 10;
|
|
440
|
-
break;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
return _context9.abrupt("return", selectedPlant.availableInEcho3D);
|
|
444
|
-
|
|
445
|
-
case 10:
|
|
446
|
-
plantsAvailableIn3d = plantsOnSelectedInstallation.filter(function (plant) {
|
|
447
|
-
return plant.availableInEcho3D === true;
|
|
448
|
-
});
|
|
449
|
-
return _context9.abrupt("return", plantsAvailableIn3d.length > 0);
|
|
450
|
-
|
|
451
|
-
case 12:
|
|
452
|
-
case "end":
|
|
453
|
-
return _context9.stop();
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}, _callee9);
|
|
457
|
-
}));
|
|
458
|
-
}
|
|
459
|
-
/**
|
|
460
|
-
* Method to check if a given installation and plant is available in Echo 3d web
|
|
461
|
-
*
|
|
462
|
-
* @export
|
|
463
|
-
* @param {string} instCode Installation to check access to
|
|
464
|
-
* @param {string} [plantCode] Plant to check access to
|
|
465
|
-
* @return {*} {Promise<boolean>} returns whether the user has access to that given plant
|
|
466
|
-
*/
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
function checkPlantAvailableIn3dWeb(instCode, plantCode) {
|
|
470
|
-
return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
471
|
-
var plants, plantsOnSelectedInstallation, selectedPlant, plantsAvailableIn3d;
|
|
472
|
-
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
473
|
-
while (1) {
|
|
474
|
-
switch (_context10.prev = _context10.next) {
|
|
475
|
-
case 0:
|
|
476
|
-
_context10.next = 2;
|
|
477
|
-
return getCachedPlantInfo();
|
|
478
|
-
|
|
479
|
-
case 2:
|
|
480
|
-
plants = _context10.sent;
|
|
481
|
-
plantsOnSelectedInstallation = plants.filter(function (plant) {
|
|
482
|
-
return plant.installationCode.toLocaleLowerCase() === instCode.toLocaleLowerCase();
|
|
483
|
-
});
|
|
484
|
-
|
|
485
|
-
if (!(plantsOnSelectedInstallation.length === 1)) {
|
|
486
|
-
_context10.next = 6;
|
|
487
|
-
break;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
return _context10.abrupt("return", plantsOnSelectedInstallation[0].availableInEcho3DWebReveal);
|
|
491
|
-
|
|
492
|
-
case 6:
|
|
493
|
-
if (!plantCode) {
|
|
494
|
-
_context10.next = 10;
|
|
495
|
-
break;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
selectedPlant = plantsOnSelectedInstallation.find(function (plant) {
|
|
499
|
-
return plant.plantCode.toLocaleLowerCase() === plantCode.toLocaleLowerCase();
|
|
500
|
-
});
|
|
501
|
-
|
|
502
|
-
if (!selectedPlant) {
|
|
503
|
-
_context10.next = 10;
|
|
504
|
-
break;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
return _context10.abrupt("return", selectedPlant.availableInEcho3DWebReveal);
|
|
508
|
-
|
|
509
|
-
case 10:
|
|
510
|
-
plantsAvailableIn3d = plantsOnSelectedInstallation.filter(function (plant) {
|
|
511
|
-
return plant.availableInEcho3DWebReveal === true;
|
|
512
|
-
});
|
|
513
|
-
return _context10.abrupt("return", plantsAvailableIn3d.length > 0);
|
|
514
|
-
|
|
515
|
-
case 12:
|
|
516
|
-
case "end":
|
|
517
|
-
return _context10.stop();
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}, _callee10);
|
|
521
|
-
}));
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
exports.check3dAccessForInstCodeOrPlantCode = check3dAccessForInstCodeOrPlantCode;
|
|
525
|
-
exports.check3dPermissionForPlantCode = check3dPermissionForPlantCode;
|
|
526
|
-
exports.check3dPermissionOnInstallation = check3dPermissionOnInstallation;
|
|
527
|
-
exports.checkPlantAvailableIn3d = checkPlantAvailableIn3d;
|
|
528
|
-
exports.checkPlantAvailableIn3dWeb = checkPlantAvailableIn3dWeb;
|
|
529
|
-
exports.getAllPlants = getAllPlants;
|
|
530
|
-
exports.getCachedPlantInfo = getCachedPlantInfo;
|
|
531
|
-
exports.getPlant = getPlant;
|
|
532
|
-
exports.getPlantBySapId = getPlantBySapId;
|
|
533
|
-
exports.getPlantCodesOnInstallation = getPlantCodesOnInstallation;
|
|
534
|
-
exports.getPlantsOnInstallation = getPlantsOnInstallation;
|
|
535
|
-
exports.setPlantInfo = setPlantInfo;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, '__esModule', {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
var EchoUtils = require('@equinor/echo-utils');
|
|
10
|
-
|
|
11
|
-
function _interopDefaultLegacy(e) {
|
|
12
|
-
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
13
|
-
'default': e
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
var EchoUtils__default = /*#__PURE__*/_interopDefaultLegacy(EchoUtils);
|
|
18
|
-
/**
|
|
19
|
-
* Function for comparing our local plant list with the API plant list.
|
|
20
|
-
* Returns true if they are not equal, returns false otherwise.
|
|
21
|
-
* @param {Plant[]} apiPlants
|
|
22
|
-
* @param {Plant[]} localStoragePlants
|
|
23
|
-
* @return {*} {boolean}
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var checkIsPlantsListUpdated = function checkIsPlantsListUpdated(apiPlants, localStoragePlants) {
|
|
28
|
-
if (!localStoragePlants || localStoragePlants.length === 0 || !EchoUtils__default["default"].Utils.arraysIsEqual(localStoragePlants, apiPlants)) {
|
|
29
|
-
return true;
|
|
30
|
-
} else {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
exports.checkIsPlantsListUpdated = checkIsPlantsListUpdated;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
function filterProjectsStartsWithFirst(data, filter) {
|
|
8
|
-
var startsWithData = data.filter(function (item) {
|
|
9
|
-
return item.toLowerCase().startsWith(filter.toLowerCase());
|
|
10
|
-
});
|
|
11
|
-
var includesData = data.filter(function (item) {
|
|
12
|
-
return item.toLowerCase().includes(filter.toLowerCase());
|
|
13
|
-
}).filter(function (item) {
|
|
14
|
-
return !startsWithData.includes(item);
|
|
15
|
-
});
|
|
16
|
-
return startsWithData.concat(includesData);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
exports.filterProjectsStartsWithFirst = filterProjectsStartsWithFirst;
|