@equinor/echo-framework 0.8.6 → 0.9.0
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/_virtual/_tslib.js +1 -1
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkButtons.helpers.d.ts +46 -0
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkButtons.helpers.test.d.ts +1 -0
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToCommApp.d.ts +14 -0
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToMcApp.d.ts +3 -1
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToProCoSys.d.ts +1 -2
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToSap.d.ts +3 -0
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToSemiDoc.d.ts +4 -0
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToTr2000.d.ts +2 -0
- package/dist/components/contextualAppLinks/externalLinkButtons/iconButtonSpinner.d.ts +18 -0
- package/dist/components/contextualAppLinks/externalLinkButtons/index.d.ts +1 -0
- package/dist/components/externalLinkButton/externalLinkButton.d.ts +16 -7
- package/dist/components/panel/corePanelLeft.d.ts +1 -4
- package/dist/components/panel/corePanelRight.d.ts +1 -4
- package/dist/components/realTimeData/components/contextButton/RealTimeContextButton.d.ts +1 -0
- package/dist/components/realTimeData/components/contextPopover/Popover.d.ts +4 -1
- package/dist/components/realTimeData/hooks/useSignalR.d.ts +3 -2
- package/dist/coreApplication/EchoContent.d.ts +0 -1
- package/dist/coreApplication/index.d.ts +0 -1
- package/dist/hooks/hookLibrary.d.ts +3 -9
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/useSemi.d.ts +11 -7
- package/dist/hooks/useTagDetails.d.ts +10 -3
- package/dist/index.d.ts +12 -7
- package/dist/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +2 -2
- package/dist/node_modules/@microsoft/signalr/dist/esm/Errors.js +3 -3
- package/dist/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +6 -4
- package/dist/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +16 -14
- package/dist/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +14 -10
- package/dist/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +14 -10
- package/dist/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +8 -5
- package/dist/node_modules/@microsoft/signalr/dist/esm/Utils.js +5 -3
- package/dist/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +6 -5
- package/dist/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +2 -2
- package/dist/services/api/api-manager.d.ts +1 -1
- package/dist/services/api/api-tag-details.d.ts +17 -0
- package/dist/services/api/api-tag-details.test.d.ts +1 -0
- package/dist/services/api/api-tags.d.ts +17 -0
- package/dist/services/api/api-tags.test.d.ts +1 -0
- package/dist/services/api/index.d.ts +1 -0
- package/dist/services/echopediaAnalyticsModule/echopediaAnalyticsModule.d.ts +1 -0
- package/dist/services/eventCallbacks/plantChanged.d.ts +1 -1
- package/dist/src/components/containers/layout.module.css.js +1 -4
- package/dist/src/components/containers/layouts.js +10 -122
- package/dist/src/components/contextualAppLinks/externalAppsMenu.js +4 -4
- package/dist/src/components/contextualAppLinks/externalLinkButtons/allExternalLinks.js +66 -11
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkButtons.helpers.js +169 -0
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToCommApp.js +95 -0
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToMcApp.js +62 -5
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToProCoSys.js +45 -11
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSafeX.js +1 -1
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSap.js +60 -11
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSemiDoc.js +16 -5
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToStid.js +1 -1
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToTr2000.js +67 -16
- package/dist/src/components/contextualAppLinks/externalLinkButtons/iconButtonSpinner.js +44 -0
- package/dist/src/components/contextualAppLinks/externalLinkButtons/iconButtonSpinner.module.css.js +15 -0
- package/dist/src/components/errorBoundary/errorBoundary.js +2 -2
- package/dist/src/components/externalLinkButton/externalLinkButton.js +99 -36
- package/dist/src/components/externalLinkButton/externalLinkButton.module.css.js +5 -2
- package/dist/src/components/footer/footer.module.css.js +1 -1
- package/dist/src/components/pageMenu/version/version.js +4 -2
- package/dist/src/components/panel/corePanelLeft.js +2 -5
- package/dist/src/components/panel/corePanelLeft.module.css.js +1 -1
- package/dist/src/components/panel/corePanelRight.js +2 -5
- package/dist/src/components/panel/corePanelRight.module.css.js +1 -1
- package/dist/src/components/plantSelector/plantSelector.js +4 -2
- package/dist/src/components/projectSelector/ProcosysProjectSelector.js +4 -2
- package/dist/src/components/realTimeData/RealTimePopoverButton.js +18 -2
- package/dist/src/components/realTimeData/components/connectorForIMSTag/IMSConnector.module.css.js +3 -2
- package/dist/src/components/realTimeData/components/connectorForIMSTag/RealTimeConnectorForIMSTag.js +46 -7
- package/dist/src/components/realTimeData/components/contextButton/RealTimeContextButton.js +4 -4
- package/dist/src/components/realTimeData/hooks/useRealTimeHub.js +4 -2
- package/dist/src/components/realTimeData/hooks/useSignalR.js +24 -8
- package/dist/src/coreApplication/EchoContent.js +2 -11
- package/dist/src/globalStyles.css.js +1 -1
- package/dist/src/hooks/hookLibrary.js +0 -9
- package/dist/src/hooks/index.js +0 -3
- package/dist/src/hooks/useSemi.js +40 -14
- package/dist/src/hooks/useTagDetails.js +118 -45
- package/dist/src/icons/common/CommissionApp-icon.png.js +7 -0
- package/dist/src/icons/common/Evision.svg.js +4 -4
- package/dist/src/icons/common/Fusion.svg.js +31 -27
- package/dist/src/icons/common/McApp.svg.js +11 -8
- package/dist/src/icons/common/Notification.svg.js +81 -0
- package/dist/src/icons/common/ProCoSysIcon.svg.js +4 -4
- package/dist/src/icons/common/Robim.svg.js +66 -0
- package/dist/src/icons/common/SapLogo.svg.js +6 -6
- package/dist/src/icons/common/SemiIcon.svg.js +12 -13
- package/dist/src/icons/common/Stid.svg.js +4 -4
- package/dist/src/icons/common/TR2000.svg.js +9 -8
- package/dist/src/icons/common/WorkOrder.svg.js +71 -0
- package/dist/src/icons/common/Yammer.svg.js +3 -3
- package/dist/src/icons/common/satos-logo.png.js +7 -0
- package/dist/src/index.js +38 -73
- package/dist/src/index2.js +201 -0
- package/dist/src/services/api/api-manager.js +6 -4
- package/dist/src/services/api/api-plantinfo.js +10 -6
- package/dist/src/services/api/api-plants.js +6 -2
- package/dist/src/services/api/api-realtimedata.js +9 -3
- package/dist/src/services/api/api-tag-details.js +69 -0
- package/dist/src/services/api/api-tags.js +29 -0
- package/dist/src/services/api/api-version.js +8 -4
- package/dist/src/services/echopediaAnalyticsModule/echopediaAnalyticsModule.js +10 -0
- package/dist/src/services/eventCallbacks/plantChanged.js +6 -2
- package/dist/src/types/pingableSources.js +1 -0
- package/dist/src/utils/copyText.js +6 -2
- package/dist/src/utils/navigationUtils.js +28 -0
- package/dist/src/utils/plantInfo.js +25 -20
- package/dist/src/utils/startup.js +6 -4
- package/dist/types/api-proCoSysTagResponse.d.ts +8 -0
- package/dist/types/hookLibrary.d.ts +0 -4
- package/dist/types/pingableSources.d.ts +2 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/navigationUtils.d.ts +7 -0
- package/dist/utils/navigationUtils.test.d.ts +1 -0
- package/dist/utils/plantInfo.d.ts +6 -0
- package/dist/utils/plantInfo.test.d.ts +1 -0
- package/package.json +34 -33
- package/dist/coreApplication/EchoBarComponent.d.ts +0 -6
- package/dist/hooks/useScreenOrientation.d.ts +0 -1
- package/dist/src/coreApplication/EchoBarComponent.js +0 -190
- package/dist/src/coreApplication/EchoContent.module.css.js +0 -21
- package/dist/src/hooks/useScreenOrientation.js +0 -50
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, '__esModule', {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
var _tslib = require('../../../../_virtual/_tslib.js');
|
|
12
|
+
|
|
13
|
+
var EchoCore = require('@equinor/echo-core');
|
|
14
|
+
|
|
15
|
+
var React = require('react');
|
|
16
|
+
|
|
17
|
+
var externalLinkButton = require('../../externalLinkButton/externalLinkButton.js');
|
|
18
|
+
|
|
19
|
+
var externalLinkButtons_helpers = require('./externalLinkButtons.helpers.js');
|
|
20
|
+
|
|
21
|
+
function _interopDefaultLegacy(e) {
|
|
22
|
+
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
23
|
+
'default': e
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
28
|
+
/**
|
|
29
|
+
* External link button to Commissioning web app.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} tagNo The tag's number to open in the Comm app.
|
|
32
|
+
* @param {string} instCode Plant installation code.
|
|
33
|
+
* @returns {React.FC<ExternalLinkToMcAppProps>} React component.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
var ExternalLinkToCommApp = function ExternalLinkToCommApp(_ref) {
|
|
38
|
+
var tagNo = _ref.tagNo,
|
|
39
|
+
instCode = _ref.instCode;
|
|
40
|
+
var proCoSysPlantCode = EchoCore.useProCoSysPlantId();
|
|
41
|
+
|
|
42
|
+
function createUrl(params) {
|
|
43
|
+
return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
44
|
+
var _yield$externalLinkBu, tagDetails, proCoSysTag, hasError;
|
|
45
|
+
|
|
46
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
47
|
+
while (1) {
|
|
48
|
+
switch (_context.prev = _context.next) {
|
|
49
|
+
case 0:
|
|
50
|
+
_context.next = 2;
|
|
51
|
+
return externalLinkButtons_helpers.getTagDetailsAndProCoSysData(Object.assign({}, params));
|
|
52
|
+
|
|
53
|
+
case 2:
|
|
54
|
+
_yield$externalLinkBu = _context.sent;
|
|
55
|
+
tagDetails = _yield$externalLinkBu.tagDetails;
|
|
56
|
+
proCoSysTag = _yield$externalLinkBu.proCoSysTag;
|
|
57
|
+
hasError = _yield$externalLinkBu.hasError;
|
|
58
|
+
return _context.abrupt("return", hasError ? undefined : "https://apps.procosys.com/comm/".concat(proCoSysPlantCode, "/").concat(tagDetails === null || tagDetails === void 0 ? void 0 : tagDetails.projectCode, "/Tag/").concat(proCoSysTag === null || proCoSysTag === void 0 ? void 0 : proCoSysTag.id));
|
|
59
|
+
|
|
60
|
+
case 7:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context.stop();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, _callee);
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return /*#__PURE__*/React__default["default"].createElement(externalLinkButton.ExternalLinkButton, {
|
|
70
|
+
buttonName: "Comm App",
|
|
71
|
+
buttonIcon: "CommApp",
|
|
72
|
+
getUrlToOpen: function getUrlToOpen() {
|
|
73
|
+
return _tslib.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
74
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
75
|
+
while (1) {
|
|
76
|
+
switch (_context2.prev = _context2.next) {
|
|
77
|
+
case 0:
|
|
78
|
+
return _context2.abrupt("return", createUrl({
|
|
79
|
+
tagNo: tagNo,
|
|
80
|
+
instCode: instCode
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
case 1:
|
|
84
|
+
case "end":
|
|
85
|
+
return _context2.stop();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, _callee2);
|
|
89
|
+
}));
|
|
90
|
+
},
|
|
91
|
+
buttonStyle: externalLinkButton.ExternalLinkButtonStyle.Rounded
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
exports.ExternalLinkToCommApp = ExternalLinkToCommApp;
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
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; }
|
|
4
|
+
|
|
3
5
|
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
6
|
|
|
5
7
|
Object.defineProperty(exports, '__esModule', {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
|
|
11
|
+
var _tslib = require('../../../../_virtual/_tslib.js');
|
|
12
|
+
|
|
13
|
+
var EchoCore = require('@equinor/echo-core');
|
|
14
|
+
|
|
9
15
|
var React = require('react');
|
|
10
16
|
|
|
11
17
|
var externalLinkButton = require('../../externalLinkButton/externalLinkButton.js');
|
|
12
18
|
|
|
19
|
+
var externalLinkButtons_helpers = require('./externalLinkButtons.helpers.js');
|
|
20
|
+
|
|
13
21
|
function _interopDefaultLegacy(e) {
|
|
14
22
|
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
15
23
|
'default': e
|
|
@@ -18,19 +26,68 @@ function _interopDefaultLegacy(e) {
|
|
|
18
26
|
|
|
19
27
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
20
28
|
/**
|
|
21
|
-
* External link button to
|
|
29
|
+
* External link button to Mechanical Completion web app.
|
|
22
30
|
*
|
|
23
31
|
* @param {string} tagNo The tag's number to open in McApp.
|
|
32
|
+
* @param {string} instCode Plant installation code.
|
|
24
33
|
* @returns {React.FC<ExternalLinkToMcAppProps>} React component.
|
|
25
34
|
*/
|
|
26
35
|
|
|
27
36
|
|
|
28
37
|
var ExternalLinkToMcApp = function ExternalLinkToMcApp(_ref) {
|
|
29
|
-
var tagNo = _ref.tagNo
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
var tagNo = _ref.tagNo,
|
|
39
|
+
instCode = _ref.instCode;
|
|
40
|
+
var proCoSysPlantCode = EchoCore.useProCoSysPlantId();
|
|
41
|
+
|
|
42
|
+
function createUrl(params) {
|
|
43
|
+
return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
44
|
+
var _yield$externalLinkBu, tagDetails, proCoSysTag, hasError;
|
|
45
|
+
|
|
46
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
47
|
+
while (1) {
|
|
48
|
+
switch (_context.prev = _context.next) {
|
|
49
|
+
case 0:
|
|
50
|
+
_context.next = 2;
|
|
51
|
+
return externalLinkButtons_helpers.getTagDetailsAndProCoSysData(Object.assign({}, params));
|
|
52
|
+
|
|
53
|
+
case 2:
|
|
54
|
+
_yield$externalLinkBu = _context.sent;
|
|
55
|
+
tagDetails = _yield$externalLinkBu.tagDetails;
|
|
56
|
+
proCoSysTag = _yield$externalLinkBu.proCoSysTag;
|
|
57
|
+
hasError = _yield$externalLinkBu.hasError;
|
|
58
|
+
return _context.abrupt("return", hasError ? undefined : "https://apps.procosys.com/mc/".concat(proCoSysPlantCode, "/").concat(tagDetails === null || tagDetails === void 0 ? void 0 : tagDetails.projectCode, "/Tag/").concat(proCoSysTag === null || proCoSysTag === void 0 ? void 0 : proCoSysTag.id));
|
|
59
|
+
|
|
60
|
+
case 7:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context.stop();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, _callee);
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return /*#__PURE__*/React__default["default"].createElement(externalLinkButton.ExternalLinkButton, {
|
|
70
|
+
buttonName: "Mc App",
|
|
32
71
|
buttonIcon: "McApp",
|
|
33
|
-
|
|
72
|
+
getUrlToOpen: function getUrlToOpen() {
|
|
73
|
+
return _tslib.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
74
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
75
|
+
while (1) {
|
|
76
|
+
switch (_context2.prev = _context2.next) {
|
|
77
|
+
case 0:
|
|
78
|
+
return _context2.abrupt("return", createUrl({
|
|
79
|
+
tagNo: tagNo,
|
|
80
|
+
instCode: instCode
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
case 1:
|
|
84
|
+
case "end":
|
|
85
|
+
return _context2.stop();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, _callee2);
|
|
89
|
+
}));
|
|
90
|
+
},
|
|
34
91
|
buttonStyle: externalLinkButton.ExternalLinkButtonStyle.Rounded
|
|
35
92
|
});
|
|
36
93
|
};
|
package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToProCoSys.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
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; }
|
|
4
|
+
|
|
3
5
|
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
6
|
|
|
5
7
|
Object.defineProperty(exports, '__esModule', {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
|
|
11
|
+
var _tslib = require('../../../../_virtual/_tslib.js');
|
|
12
|
+
|
|
9
13
|
var EchoCore = require('@equinor/echo-core');
|
|
10
14
|
|
|
11
15
|
var React = require('react');
|
|
12
16
|
|
|
13
|
-
var useTagDetails = require('../../../hooks/useTagDetails.js');
|
|
14
|
-
|
|
15
17
|
var externalLinkButton = require('../../externalLinkButton/externalLinkButton.js');
|
|
16
18
|
|
|
19
|
+
var externalLinkButtons_helpers = require('./externalLinkButtons.helpers.js');
|
|
20
|
+
|
|
17
21
|
function _interopDefaultLegacy(e) {
|
|
18
22
|
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
19
23
|
'default': e
|
|
@@ -23,10 +27,9 @@ function _interopDefaultLegacy(e) {
|
|
|
23
27
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
28
|
/**
|
|
25
29
|
* External link button to ProCoSys.
|
|
26
|
-
* Will only render if the passed tagNo has any tag details in the actually selected plant.
|
|
27
30
|
*
|
|
28
31
|
* @param {string} tagNo The tag's number to open in ProCoSys.
|
|
29
|
-
* @param {
|
|
32
|
+
* @param {TagDetailsDto} tagDetails The given tags detailed information.
|
|
30
33
|
* @returns {React.FC<ExternalLinkToProCoSysProps>} React component.
|
|
31
34
|
*/
|
|
32
35
|
|
|
@@ -34,17 +37,48 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
34
37
|
var ExternalLinkToProCoSys = function ExternalLinkToProCoSys(_ref) {
|
|
35
38
|
var tagNo = _ref.tagNo,
|
|
36
39
|
instCode = _ref.instCode;
|
|
37
|
-
var tagDetails = useTagDetails.useTagDetails({
|
|
38
|
-
tagNo: tagNo,
|
|
39
|
-
instCode: instCode
|
|
40
|
-
});
|
|
41
40
|
var proCoSysPlantCode = EchoCore.useProCoSysPlantId();
|
|
42
|
-
|
|
41
|
+
|
|
42
|
+
function createUrl(params) {
|
|
43
|
+
return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
44
|
+
var _yield$externalLinkBu, tagDetails, hasError;
|
|
45
|
+
|
|
46
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
47
|
+
while (1) {
|
|
48
|
+
switch (_context.prev = _context.next) {
|
|
49
|
+
case 0:
|
|
50
|
+
_context.next = 2;
|
|
51
|
+
return externalLinkButtons_helpers.getTagDetailsWithErrorHandling({
|
|
52
|
+
tagNo: params.tagNo,
|
|
53
|
+
instCode: params.instCode
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
case 2:
|
|
57
|
+
_yield$externalLinkBu = _context.sent;
|
|
58
|
+
tagDetails = _yield$externalLinkBu.tagDetails;
|
|
59
|
+
hasError = _yield$externalLinkBu.hasError;
|
|
60
|
+
return _context.abrupt("return", hasError ? undefined : "https://procosys.equinor.com/".concat(proCoSysPlantCode, "/Link/TAG?TagNo=").concat(tagNo, "&project=").concat(tagDetails === null || tagDetails === void 0 ? void 0 : tagDetails.projectCode));
|
|
61
|
+
|
|
62
|
+
case 6:
|
|
63
|
+
case "end":
|
|
64
|
+
return _context.stop();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, _callee);
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return /*#__PURE__*/React__default["default"].createElement(externalLinkButton.ExternalLinkButton, {
|
|
43
72
|
buttonName: "ProCoSys",
|
|
44
73
|
buttonIcon: "ProCoSys",
|
|
45
|
-
|
|
74
|
+
getUrlToOpen: function getUrlToOpen() {
|
|
75
|
+
return createUrl({
|
|
76
|
+
tagNo: tagNo,
|
|
77
|
+
instCode: instCode
|
|
78
|
+
});
|
|
79
|
+
},
|
|
46
80
|
buttonStyle: externalLinkButton.ExternalLinkButtonStyle.Rounded
|
|
47
|
-
})
|
|
81
|
+
});
|
|
48
82
|
};
|
|
49
83
|
|
|
50
84
|
exports.ExternalLinkToProCoSys = ExternalLinkToProCoSys;
|
|
@@ -27,7 +27,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
27
27
|
|
|
28
28
|
var ExternalLinkToSafeX = function ExternalLinkToSafeX(_ref) {
|
|
29
29
|
var tag = _ref.tag;
|
|
30
|
-
return /*#__PURE__*/React__default["default"].createElement(externalLinkButton
|
|
30
|
+
return /*#__PURE__*/React__default["default"].createElement(externalLinkButton.ExternalLinkButton, {
|
|
31
31
|
buttonName: "SafeX",
|
|
32
32
|
buttonIcon: "SafeX",
|
|
33
33
|
linkTo: "https://safex.equinor.com/search?keyword=".concat(tag.description),
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
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; }
|
|
4
|
+
|
|
3
5
|
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
6
|
|
|
5
7
|
Object.defineProperty(exports, '__esModule', {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
|
|
11
|
+
var _tslib = require('../../../../_virtual/_tslib.js');
|
|
12
|
+
|
|
9
13
|
var EchoUtils = require('@equinor/echo-utils');
|
|
10
14
|
|
|
11
15
|
var React = require('react');
|
|
12
16
|
|
|
13
|
-
var useTagDetails = require('../../../hooks/useTagDetails.js');
|
|
14
|
-
|
|
15
17
|
var pingableSources = require('../../../types/pingableSources.js');
|
|
16
18
|
|
|
17
19
|
var externalLinkButton = require('../../externalLinkButton/externalLinkButton.js');
|
|
18
20
|
|
|
21
|
+
var externalLinkButtons_helpers = require('./externalLinkButtons.helpers.js');
|
|
22
|
+
|
|
19
23
|
function _interopDefaultLegacy(e) {
|
|
20
24
|
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
21
25
|
'default': e
|
|
@@ -28,34 +32,79 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
28
32
|
/**
|
|
29
33
|
* External link button to SAP.
|
|
30
34
|
* Will only render if the passed tagNo has any tag details in the actually selected plant and SAP is available.
|
|
35
|
+
* It pings SAP to determine whether is available or not.
|
|
31
36
|
*
|
|
32
37
|
* @param {string} tagNo The tag's number to open in SAP.
|
|
33
38
|
* @param {string} instCode Plant installation code.
|
|
39
|
+
* @param {(isLoading: boolean) => void} loadingStatusCallback Callback which provides an 'isLoading' param reflecting the actual loading state of the ping to SAP.
|
|
34
40
|
* @returns {React.FC<ExternalLinkToSapProps>} React component.
|
|
35
41
|
*/
|
|
36
42
|
|
|
37
43
|
|
|
38
44
|
var ExternalLinkToSap = function ExternalLinkToSap(_ref) {
|
|
39
45
|
var tagNo = _ref.tagNo,
|
|
40
|
-
instCode = _ref.instCode
|
|
46
|
+
instCode = _ref.instCode,
|
|
47
|
+
loadingStatusCallback = _ref.loadingStatusCallback;
|
|
41
48
|
var _EchoUtils__default$d = EchoUtils__default["default"].Hooks,
|
|
42
49
|
usePing = _EchoUtils__default$d.usePing,
|
|
43
50
|
useIsIosDevice = _EchoUtils__default$d.useIsIosDevice;
|
|
44
|
-
var tagDetails = useTagDetails.useTagDetails({
|
|
45
|
-
tagNo: tagNo,
|
|
46
|
-
instCode: instCode
|
|
47
|
-
});
|
|
48
51
|
|
|
49
52
|
var _usePing = usePing(pingableSources.PingableSources.Sap),
|
|
50
|
-
isSourceAvailable = _usePing.isSourceAvailable
|
|
53
|
+
isSourceAvailable = _usePing.isSourceAvailable,
|
|
54
|
+
isPingLoading = _usePing.isPingLoading;
|
|
51
55
|
|
|
52
56
|
var isIosDevice = useIsIosDevice();
|
|
53
|
-
|
|
57
|
+
|
|
58
|
+
function createUrl(params) {
|
|
59
|
+
return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
60
|
+
var _yield$externalLinkBu, tagDetails, hasError;
|
|
61
|
+
|
|
62
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
63
|
+
while (1) {
|
|
64
|
+
switch (_context.prev = _context.next) {
|
|
65
|
+
case 0:
|
|
66
|
+
_context.next = 2;
|
|
67
|
+
return externalLinkButtons_helpers.getTagDetailsWithErrorHandling({
|
|
68
|
+
tagNo: params.tagNo,
|
|
69
|
+
instCode: params.instCode
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
case 2:
|
|
73
|
+
_yield$externalLinkBu = _context.sent;
|
|
74
|
+
tagDetails = _yield$externalLinkBu.tagDetails;
|
|
75
|
+
hasError = _yield$externalLinkBu.hasError;
|
|
76
|
+
return _context.abrupt("return", hasError ? undefined : "https://p03web.statoil.no/sap/bc/gui/sap/its/webgui?sap-client=505&sap-language=EN&~transaction=*ih06%20STRNO-LOW=".concat(tagDetails === null || tagDetails === void 0 ? void 0 : tagDetails.plantNo, "-").concat(tagNo, "#"));
|
|
77
|
+
|
|
78
|
+
case 6:
|
|
79
|
+
case "end":
|
|
80
|
+
return _context.stop();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, _callee);
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
React.useEffect(function () {
|
|
88
|
+
if (!!loadingStatusCallback) {
|
|
89
|
+
loadingStatusCallback(isPingLoading);
|
|
90
|
+
}
|
|
91
|
+
}, [isPingLoading, loadingStatusCallback]);
|
|
92
|
+
|
|
93
|
+
if (!isIosDevice && !isSourceAvailable) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return /*#__PURE__*/React__default["default"].createElement(externalLinkButton.ExternalLinkButton, {
|
|
54
98
|
buttonName: "Sap",
|
|
55
99
|
buttonIcon: "Sap",
|
|
56
|
-
|
|
100
|
+
getUrlToOpen: function getUrlToOpen() {
|
|
101
|
+
return createUrl({
|
|
102
|
+
tagNo: tagNo,
|
|
103
|
+
instCode: instCode
|
|
104
|
+
});
|
|
105
|
+
},
|
|
57
106
|
buttonStyle: externalLinkButton.ExternalLinkButtonStyle.Rounded
|
|
58
|
-
})
|
|
107
|
+
});
|
|
59
108
|
};
|
|
60
109
|
|
|
61
110
|
exports.ExternalLinkToSap = ExternalLinkToSap;
|
|
@@ -24,20 +24,31 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
24
24
|
* Will only render if Semi is available for the passed tagNo.
|
|
25
25
|
*
|
|
26
26
|
* @param {string} tagNo The tag's number to open in Semi.
|
|
27
|
+
* @param {string} instCode Plant installation code.
|
|
28
|
+
* @param {(isLoading: boolean) => void} loadingStatusCallback Callback which provides an 'isLoading' param reflecting the actual API call state for checking Semi availability.
|
|
27
29
|
* @returns {React.FC<ExternalLinkToSemiDocProps>} React component.
|
|
28
30
|
*/
|
|
29
31
|
|
|
30
32
|
|
|
31
33
|
var ExternalLinkToSemiDoc = function ExternalLinkToSemiDoc(_ref) {
|
|
32
|
-
var tagNo = _ref.tagNo
|
|
34
|
+
var tagNo = _ref.tagNo,
|
|
35
|
+
instCode = _ref.instCode,
|
|
36
|
+
loadingStatusCallback = _ref.loadingStatusCallback;
|
|
33
37
|
|
|
34
38
|
var _useSemi$useSemi = useSemi.useSemi({
|
|
35
|
-
tagNo: tagNo
|
|
39
|
+
tagNo: tagNo,
|
|
40
|
+
instCode: instCode
|
|
36
41
|
}),
|
|
37
42
|
isSemiDocumentAvailable = _useSemi$useSemi.isSemiDocumentAvailable,
|
|
38
|
-
semiDocumentId = _useSemi$useSemi.semiDocumentId
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
semiDocumentId = _useSemi$useSemi.semiDocumentId,
|
|
44
|
+
isSemiLoading = _useSemi$useSemi.isSemiLoading;
|
|
45
|
+
|
|
46
|
+
React.useEffect(function () {
|
|
47
|
+
if (!!loadingStatusCallback) {
|
|
48
|
+
loadingStatusCallback(isSemiLoading);
|
|
49
|
+
}
|
|
50
|
+
}, [isSemiLoading, loadingStatusCallback]);
|
|
51
|
+
return isSemiDocumentAvailable && !isSemiLoading ? /*#__PURE__*/React__default["default"].createElement(externalLinkButton.ExternalLinkButton, {
|
|
41
52
|
buttonName: "Semi",
|
|
42
53
|
buttonIcon: "Semi",
|
|
43
54
|
linkTo: "https://semi.equinor.com/uploaddocumentation?semiId=".concat(semiDocumentId),
|
|
@@ -29,7 +29,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
29
29
|
var ExternalLinkToStid = function ExternalLinkToStid(_ref) {
|
|
30
30
|
var tagNo = _ref.tagNo,
|
|
31
31
|
instCode = _ref.instCode;
|
|
32
|
-
return /*#__PURE__*/React__default["default"].createElement(externalLinkButton
|
|
32
|
+
return /*#__PURE__*/React__default["default"].createElement(externalLinkButton.ExternalLinkButton, {
|
|
33
33
|
buttonName: "STID",
|
|
34
34
|
buttonIcon: "Stid",
|
|
35
35
|
linkTo: "https://stid.equinor.com/".concat(instCode, "/tag/").concat(tagNo),
|