UNPKG

@cardonexinc/freelens-argo-rollouts-extension

Version:
166 lines (165 loc) 7.02 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const _freelensapp_extensions = require("../../../_virtual/@freelensapp_extensions.js"); const mobx = require("../../../_virtual/mobx.js"); var _Common$Store$Extensi; let _initProto, _init_dashboardUrls; function _applyDecs(e, t, r, n, o, a) { function i(e2, t2, r2) { return function(n2, o2) { return r2 && r2(n2), e2[t2].call(n2, o2); }; } function c(e2, t2) { for (var r2 = 0; r2 < e2.length; r2++) e2[r2].call(t2); return t2; } function s(e2, t2, r2, n2) { if ("function" != typeof e2 && (n2 || void 0 !== e2)) throw new TypeError(t2 + " must " + (r2 || "be") + " a function" + (n2 ? "" : " or undefined")); return e2; } function applyDec(e2, t2, r2, n2, o2, a2, c2, u2, l2, f2, p2, d, h) { function m(e3) { if (!h(e3)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t2[0], g = t2[3], b = !u2; if (!b) { r2 || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o2 ? "get" : 4 === o2 || d ? "set" : "value"; f2 ? (p2 || d ? w = { get: _setFunctionName(function() { return g(this); }, n2, "get"), set: function(e3) { t2[4](this, e3); } } : w[A] = g, p2 || _setFunctionName(w[A], n2, 2 === o2 ? "" : A)) : p2 || (w = Object.getOwnPropertyDescriptor(e2, n2)); } for (var P = e2, j = v.length - 1; j >= 0; j -= r2 ? 2 : 1) { var D = v[j], E = r2 ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o2], name: n2, metadata: a2, addInitializer: function(e3, t3) { if (e3.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t3, "An initializer", "be", true), c2.push(t3); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y); else { var k, F; O.static = l2, O.private = f2, f2 ? 2 === o2 ? k = function(e3) { return m(e3), w.value; } : (o2 < 4 && (k = i(w, "get", m)), 3 !== o2 && (F = i(w, "set", m))) : (k = function(e3) { return e3[n2]; }, (o2 < 2 || 4 === o2) && (F = function(e3, t3) { e3[n2] = t3; })); var N = O.access = { has: f2 ? h.bind() : function(e3) { return n2 in e3; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y); else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p2 ? "field" : "method") + " decorators", "return") && (p2 ? S.push(P) : w[A] = P); } } finally { I.v = true; } } return (p2 || d) && u2.push(function(e3, t3) { for (var r3 = S.length - 1; r3 >= 0; r3--) t3 = S[r3].call(e3, t3); return t3; }), p2 || b || (f2 ? d ? u2.push(i(w, "get"), i(w, "set")) : u2.push(2 === o2 ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e2, n2, w)), P; } function u(e2, t2) { return Object.defineProperty(e2, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: true, enumerable: true, value: t2 }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function(e2, t2, r2, n2) { var o2, a2, i2 = [], s2 = function(t3) { return _checkInRHS(t3) === e2; }, u2 = /* @__PURE__ */ new Map(); function l2(e3) { e3 && i2.push(c.bind(null, e3)); } for (var f2 = 0; f2 < t2.length; f2++) { var p2 = t2[f2]; if (Array.isArray(p2)) { var d = p2[1], h = p2[2], m = p2.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u2.get(b); if (true === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u2.set(b, !(d > 2) || d); } applyDec(v ? e2 : e2.prototype, p2, y, m ? "#" + h : _toPropertyKey(h), d, n2, v ? a2 = a2 || [] : o2 = o2 || [], i2, v, m, g, 1 === d, v && m ? s2 : r2); } } return l2(o2), l2(a2), i2; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t2 = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t2), f), c.bind(null, t2, e)]; } }; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); } function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: true, value: n ? n + " " + t : t }); } catch (e2) { } return e; } function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; } class ArgoRolloutsPreferencesStore extends (_Common$Store$Extensi = _freelensapp_extensions._freelensapp_extensionsExports.Common.Store.ExtensionStore) { static { [_init_dashboardUrls, _initProto] = _applyDecs(this, [[mobx.mobxExports.observable, 1, "dashboardUrls"]], [], 0, void 0, _Common$Store$Extensi).e; } setDashboardUrl(clusterId, value) { let dashboardUrls = JSON.parse(this.dashboardUrls); dashboardUrls[clusterId] = value; this.dashboardUrls = JSON.stringify(dashboardUrls); } getDashboardUrl(clusterId) { const dashboardUrls = JSON.parse(this.dashboardUrls); return dashboardUrls[clusterId] || ""; } // Persistent #A = (_initProto(this), _init_dashboardUrls(this, "{}")); get dashboardUrls() { return this.#A; } set dashboardUrls(v) { this.#A = v; } constructor() { super({ configName: "argo-rollouts-preferences-store", defaults: { dashboardUrls: "{}" } }); mobx.mobxExports.makeObservable(this); } fromStore = (model) => { this.dashboardUrls = model.dashboardUrls; }; toJSON = () => { const value = { dashboardUrls: this.dashboardUrls }; return mobx.mobxExports.toJS(value); }; } exports.ArgoRolloutsPreferencesStore = ArgoRolloutsPreferencesStore; //# sourceMappingURL=argo-rollouts-store.js.map