@gameap/frontend 4.1.0-dev1 → 4.1.0-dev10

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.
Files changed (72) hide show
  1. package/dist/AdminClientCertificatesView-Bg8X_Ouc.js +370 -0
  2. package/dist/AdminDaemonTaskListView-DbJp0aqQ.js +316 -0
  3. package/dist/AdminDaemonTaskOutputView-DNCHQfxx.js +87 -0
  4. package/dist/AdminGamesEdit-jco7cBfk.js +473 -0
  5. package/dist/AdminGamesList-CMjsgEpx.js +518 -0
  6. package/dist/AdminModEdit-BlRu_09M.js +529 -0
  7. package/dist/AdminNodeShowView-BHxJkjYJ.js +175 -0
  8. package/dist/AdminNodesCreateView-DihmM46W.js +87 -0
  9. package/dist/AdminNodesEditView-CVACSido.js +65 -0
  10. package/dist/AdminNodesView-CHtiU6dZ.js +167 -0
  11. package/dist/AdminPluginsView-CRjF3BPs.js +984 -0
  12. package/dist/AdminServersCreate-5f8x6eZO.js +342 -0
  13. package/dist/AdminServersEdit-CA7711nJ.js +400 -0
  14. package/dist/AdminServersList-De5ZMEGZ.js +168 -0
  15. package/dist/AdminUsersEditView-DeYo98vi.js +308 -0
  16. package/dist/AdminUsersView-C8fKEhpr.js +446 -0
  17. package/dist/CreateModForm-CqkvVLfN.js +123 -0
  18. package/dist/CreateNodeModal-DOXVtVLQ.js +100 -0
  19. package/dist/DsIpSelector-C676Y19X.js +90 -0
  20. package/dist/EmptyView-Bf6zmQQt.js +9 -0
  21. package/dist/FileManager-DSa9v4Ex.js +5932 -0
  22. package/dist/GameIcon-DaYNlnur.js +87 -0
  23. package/dist/GameModSelector-CQBT8ZLu.js +95 -0
  24. package/dist/InputManyList-DUOtepb8.js +110 -0
  25. package/dist/InputTextList-lPhVIV04.js +63 -0
  26. package/dist/PluginPendingView-DaDaN30Q.js +34 -0
  27. package/dist/ProfileView-Dw2T3X8m.js +295 -0
  28. package/dist/RconConsole-CvxNBv0B.js +74 -0
  29. package/dist/RconPlayers-odUKa0Ps.js +424 -0
  30. package/dist/ServerConsole-B9v2PcWb.js +99 -0
  31. package/dist/ServerControlButton-D_zJbxr6.js +186 -0
  32. package/dist/ServerIdView-_vGQRk7y.js +609 -0
  33. package/dist/ServerSelector-6fCqL3e9.js +52 -0
  34. package/dist/ServerSettings-C6-tkLTH.js +84 -0
  35. package/dist/ServerStatus-CcqB0h1r.js +63 -0
  36. package/dist/ServerTasks-BcaZzvz7.js +857 -0
  37. package/dist/ServersView-S_G_kuGj.js +313 -0
  38. package/dist/SettingsParameters-u3Awy4Vf.js +89 -0
  39. package/dist/SmartPortSelector-BRSQFVqT.js +174 -0
  40. package/dist/TokensView-C1RFJSB5.js +392 -0
  41. package/dist/UpdateNodeForm-BAhzQLt-.js +652 -0
  42. package/dist/UserServerPrivileges-Q2wQMyHi.js +319 -0
  43. package/dist/_createCompounder-CXjx5-CF.js +241 -0
  44. package/dist/camelCase-CSrB2MWj.js +8 -0
  45. package/dist/capitalize-BZSBvd6d.js +40 -0
  46. package/dist/clientCertificates-C0FlDwsb.js +53 -0
  47. package/dist/favicon-32x32.png +0 -0
  48. package/dist/favicon-96x96.png +0 -0
  49. package/dist/favicon.ico +0 -0
  50. package/dist/fonts/gicon.eot +0 -0
  51. package/dist/fonts/gicon.svg +33 -0
  52. package/dist/fonts/gicon.ttf +0 -0
  53. package/dist/fonts/gicon.woff +0 -0
  54. package/dist/fonts/gicon.woff2 +0 -0
  55. package/dist/frontend.css +6 -0
  56. package/dist/gameList-kucszmx0.js +115 -0
  57. package/dist/gameap.svg +3 -0
  58. package/dist/gameap_full.svg +9 -0
  59. package/dist/images/gap_logo_white.png +0 -0
  60. package/dist/images/gap_logo_white_mini.png +0 -0
  61. package/dist/images/gicon.svg +18 -0
  62. package/dist/images/icons/save-white.svg +1 -0
  63. package/dist/images/icons/save.svg +1 -0
  64. package/dist/index-9fvX7FD-.js +3840 -0
  65. package/dist/index.js +1 -0
  66. package/dist/isEmpty-D0Z8Rneq.js +263 -0
  67. package/dist/join-CmlzL0H9.js +7 -0
  68. package/dist/loader-qtG-Lf6M.js +131 -0
  69. package/dist/mockServiceWorker.js +349 -0
  70. package/dist/snakeCase-nnM4dAra.js +7 -0
  71. package/dist/validators-ChBGsKft.js +65 -0
  72. package/package.json +6 -4
@@ -0,0 +1,857 @@
1
+ import { NModal as $e, NSelect as ye, NDatePicker as ge, NRadio as Re, NInputNumber as be } from "naive-ui";
2
+ import { ref as P, computed as De, resolveComponent as pe, createElementBlock as z, openBlock as V, createElementVNode as h, createVNode as b, withCtx as q, createTextVNode as de, toDisplayString as $, Fragment as Me, renderList as Te, createCommentVNode as ne } from "vue";
3
+ import { defineStore as Se, storeToRefs as we } from "pinia";
4
+ import { u as te, b as ie, c as Ie, t as J, a as Ce, _ as Oe, p as Q, d as Ue, e as me } from "./index-9fvX7FD-.js";
5
+ function _e(e) {
6
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
7
+ }
8
+ var oe = { exports: {} }, Ye = oe.exports, ve;
9
+ function Pe() {
10
+ return ve || (ve = 1, (function(e, l) {
11
+ (function(C, I) {
12
+ e.exports = I();
13
+ })(Ye, (function() {
14
+ var C = 1e3, I = 6e4, j = 36e5, d = "millisecond", M = "second", f = "minute", c = "hour", k = "day", T = "week", y = "month", B = "quarter", m = "year", O = "date", i = "Invalid Date", S = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, A = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, x = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(n) {
15
+ var a = ["th", "st", "nd", "rd"], t = n % 100;
16
+ return "[" + n + (a[(t - 20) % 10] || a[t] || a[0]) + "]";
17
+ } }, U = function(n, a, t) {
18
+ var r = String(n);
19
+ return !r || r.length >= a ? n : "" + Array(a + 1 - r.length).join(t) + n;
20
+ }, se = { s: U, z: function(n) {
21
+ var a = -n.utcOffset(), t = Math.abs(a), r = Math.floor(t / 60), s = t % 60;
22
+ return (a <= 0 ? "+" : "-") + U(r, 2, "0") + ":" + U(s, 2, "0");
23
+ }, m: function n(a, t) {
24
+ if (a.date() < t.date()) return -n(t, a);
25
+ var r = 12 * (t.year() - a.year()) + (t.month() - a.month()), s = a.clone().add(r, y), o = t - s < 0, u = a.clone().add(r + (o ? -1 : 1), y);
26
+ return +(-(r + (t - s) / (o ? s - u : u - s)) || 0);
27
+ }, a: function(n) {
28
+ return n < 0 ? Math.ceil(n) || 0 : Math.floor(n);
29
+ }, p: function(n) {
30
+ return { M: y, y: m, w: T, d: k, D: O, h: c, m: f, s: M, ms: d, Q: B }[n] || String(n || "").toLowerCase().replace(/s$/, "");
31
+ }, u: function(n) {
32
+ return n === void 0;
33
+ } }, N = "en", H = {};
34
+ H[N] = x;
35
+ var G = "$isDayjsObject", K = function(n) {
36
+ return n instanceof ae || !(!n || !n[G]);
37
+ }, E = function n(a, t, r) {
38
+ var s;
39
+ if (!a) return N;
40
+ if (typeof a == "string") {
41
+ var o = a.toLowerCase();
42
+ H[o] && (s = o), t && (H[o] = t, s = o);
43
+ var u = a.split("-");
44
+ if (!s && u.length > 1) return n(u[0]);
45
+ } else {
46
+ var v = a.name;
47
+ H[v] = a, s = v;
48
+ }
49
+ return !r && s && (N = s), s || !r && N;
50
+ }, g = function(n, a) {
51
+ if (K(n)) return n.clone();
52
+ var t = typeof a == "object" ? a : {};
53
+ return t.date = n, t.args = arguments, new ae(t);
54
+ }, p = se;
55
+ p.l = E, p.i = K, p.w = function(n, a) {
56
+ return g(n, { locale: a.$L, utc: a.$u, x: a.$x, $offset: a.$offset });
57
+ };
58
+ var ae = (function() {
59
+ function n(t) {
60
+ this.$L = E(t.locale, null, !0), this.parse(t), this.$x = this.$x || t.x || {}, this[G] = !0;
61
+ }
62
+ var a = n.prototype;
63
+ return a.parse = function(t) {
64
+ this.$d = (function(r) {
65
+ var s = r.date, o = r.utc;
66
+ if (s === null) return /* @__PURE__ */ new Date(NaN);
67
+ if (p.u(s)) return /* @__PURE__ */ new Date();
68
+ if (s instanceof Date) return new Date(s);
69
+ if (typeof s == "string" && !/Z$/i.test(s)) {
70
+ var u = s.match(S);
71
+ if (u) {
72
+ var v = u[2] - 1 || 0, _ = (u[7] || "0").substring(0, 3);
73
+ return o ? new Date(Date.UTC(u[1], v, u[3] || 1, u[4] || 0, u[5] || 0, u[6] || 0, _)) : new Date(u[1], v, u[3] || 1, u[4] || 0, u[5] || 0, u[6] || 0, _);
74
+ }
75
+ }
76
+ return new Date(s);
77
+ })(t), this.init();
78
+ }, a.init = function() {
79
+ var t = this.$d;
80
+ this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds();
81
+ }, a.$utils = function() {
82
+ return p;
83
+ }, a.isValid = function() {
84
+ return this.$d.toString() !== i;
85
+ }, a.isSame = function(t, r) {
86
+ var s = g(t);
87
+ return this.startOf(r) <= s && s <= this.endOf(r);
88
+ }, a.isAfter = function(t, r) {
89
+ return g(t) < this.startOf(r);
90
+ }, a.isBefore = function(t, r) {
91
+ return this.endOf(r) < g(t);
92
+ }, a.$g = function(t, r, s) {
93
+ return p.u(t) ? this[r] : this.set(s, t);
94
+ }, a.unix = function() {
95
+ return Math.floor(this.valueOf() / 1e3);
96
+ }, a.valueOf = function() {
97
+ return this.$d.getTime();
98
+ }, a.startOf = function(t, r) {
99
+ var s = this, o = !!p.u(r) || r, u = p.p(t), v = function(W, w) {
100
+ var L = p.w(s.$u ? Date.UTC(s.$y, w, W) : new Date(s.$y, w, W), s);
101
+ return o ? L : L.endOf(k);
102
+ }, _ = function(W, w) {
103
+ return p.w(s.toDate()[W].apply(s.toDate("s"), (o ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(w)), s);
104
+ }, R = this.$W, D = this.$M, Y = this.$D, Z = "set" + (this.$u ? "UTC" : "");
105
+ switch (u) {
106
+ case m:
107
+ return o ? v(1, 0) : v(31, 11);
108
+ case y:
109
+ return o ? v(1, D) : v(0, D + 1);
110
+ case T:
111
+ var F = this.$locale().weekStart || 0, X = (R < F ? R + 7 : R) - F;
112
+ return v(o ? Y - X : Y + (6 - X), D);
113
+ case k:
114
+ case O:
115
+ return _(Z + "Hours", 0);
116
+ case c:
117
+ return _(Z + "Minutes", 1);
118
+ case f:
119
+ return _(Z + "Seconds", 2);
120
+ case M:
121
+ return _(Z + "Milliseconds", 3);
122
+ default:
123
+ return this.clone();
124
+ }
125
+ }, a.endOf = function(t) {
126
+ return this.startOf(t, !1);
127
+ }, a.$set = function(t, r) {
128
+ var s, o = p.p(t), u = "set" + (this.$u ? "UTC" : ""), v = (s = {}, s[k] = u + "Date", s[O] = u + "Date", s[y] = u + "Month", s[m] = u + "FullYear", s[c] = u + "Hours", s[f] = u + "Minutes", s[M] = u + "Seconds", s[d] = u + "Milliseconds", s)[o], _ = o === k ? this.$D + (r - this.$W) : r;
129
+ if (o === y || o === m) {
130
+ var R = this.clone().set(O, 1);
131
+ R.$d[v](_), R.init(), this.$d = R.set(O, Math.min(this.$D, R.daysInMonth())).$d;
132
+ } else v && this.$d[v](_);
133
+ return this.init(), this;
134
+ }, a.set = function(t, r) {
135
+ return this.clone().$set(t, r);
136
+ }, a.get = function(t) {
137
+ return this[p.p(t)]();
138
+ }, a.add = function(t, r) {
139
+ var s, o = this;
140
+ t = Number(t);
141
+ var u = p.p(r), v = function(D) {
142
+ var Y = g(o);
143
+ return p.w(Y.date(Y.date() + Math.round(D * t)), o);
144
+ };
145
+ if (u === y) return this.set(y, this.$M + t);
146
+ if (u === m) return this.set(m, this.$y + t);
147
+ if (u === k) return v(1);
148
+ if (u === T) return v(7);
149
+ var _ = (s = {}, s[f] = I, s[c] = j, s[M] = C, s)[u] || 1, R = this.$d.getTime() + t * _;
150
+ return p.w(R, this);
151
+ }, a.subtract = function(t, r) {
152
+ return this.add(-1 * t, r);
153
+ }, a.format = function(t) {
154
+ var r = this, s = this.$locale();
155
+ if (!this.isValid()) return s.invalidDate || i;
156
+ var o = t || "YYYY-MM-DDTHH:mm:ssZ", u = p.z(this), v = this.$H, _ = this.$m, R = this.$M, D = s.weekdays, Y = s.months, Z = s.meridiem, F = function(w, L, ee, re) {
157
+ return w && (w[L] || w(r, o)) || ee[L].slice(0, re);
158
+ }, X = function(w) {
159
+ return p.s(v % 12 || 12, w, "0");
160
+ }, W = Z || function(w, L, ee) {
161
+ var re = w < 12 ? "AM" : "PM";
162
+ return ee ? re.toLowerCase() : re;
163
+ };
164
+ return o.replace(A, (function(w, L) {
165
+ return L || (function(ee) {
166
+ switch (ee) {
167
+ case "YY":
168
+ return String(r.$y).slice(-2);
169
+ case "YYYY":
170
+ return p.s(r.$y, 4, "0");
171
+ case "M":
172
+ return R + 1;
173
+ case "MM":
174
+ return p.s(R + 1, 2, "0");
175
+ case "MMM":
176
+ return F(s.monthsShort, R, Y, 3);
177
+ case "MMMM":
178
+ return F(Y, R);
179
+ case "D":
180
+ return r.$D;
181
+ case "DD":
182
+ return p.s(r.$D, 2, "0");
183
+ case "d":
184
+ return String(r.$W);
185
+ case "dd":
186
+ return F(s.weekdaysMin, r.$W, D, 2);
187
+ case "ddd":
188
+ return F(s.weekdaysShort, r.$W, D, 3);
189
+ case "dddd":
190
+ return D[r.$W];
191
+ case "H":
192
+ return String(v);
193
+ case "HH":
194
+ return p.s(v, 2, "0");
195
+ case "h":
196
+ return X(1);
197
+ case "hh":
198
+ return X(2);
199
+ case "a":
200
+ return W(v, _, !0);
201
+ case "A":
202
+ return W(v, _, !1);
203
+ case "m":
204
+ return String(_);
205
+ case "mm":
206
+ return p.s(_, 2, "0");
207
+ case "s":
208
+ return String(r.$s);
209
+ case "ss":
210
+ return p.s(r.$s, 2, "0");
211
+ case "SSS":
212
+ return p.s(r.$ms, 3, "0");
213
+ case "Z":
214
+ return u;
215
+ }
216
+ return null;
217
+ })(w) || u.replace(":", "");
218
+ }));
219
+ }, a.utcOffset = function() {
220
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
221
+ }, a.diff = function(t, r, s) {
222
+ var o, u = this, v = p.p(r), _ = g(t), R = (_.utcOffset() - this.utcOffset()) * I, D = this - _, Y = function() {
223
+ return p.m(u, _);
224
+ };
225
+ switch (v) {
226
+ case m:
227
+ o = Y() / 12;
228
+ break;
229
+ case y:
230
+ o = Y();
231
+ break;
232
+ case B:
233
+ o = Y() / 3;
234
+ break;
235
+ case T:
236
+ o = (D - R) / 6048e5;
237
+ break;
238
+ case k:
239
+ o = (D - R) / 864e5;
240
+ break;
241
+ case c:
242
+ o = D / j;
243
+ break;
244
+ case f:
245
+ o = D / I;
246
+ break;
247
+ case M:
248
+ o = D / C;
249
+ break;
250
+ default:
251
+ o = D;
252
+ }
253
+ return s ? o : p.a(o);
254
+ }, a.daysInMonth = function() {
255
+ return this.endOf(y).$D;
256
+ }, a.$locale = function() {
257
+ return H[this.$L];
258
+ }, a.locale = function(t, r) {
259
+ if (!t) return this.$L;
260
+ var s = this.clone(), o = E(t, r, !0);
261
+ return o && (s.$L = o), s;
262
+ }, a.clone = function() {
263
+ return p.w(this.$d, this);
264
+ }, a.toDate = function() {
265
+ return new Date(this.valueOf());
266
+ }, a.toJSON = function() {
267
+ return this.isValid() ? this.toISOString() : null;
268
+ }, a.toISOString = function() {
269
+ return this.$d.toISOString();
270
+ }, a.toString = function() {
271
+ return this.$d.toUTCString();
272
+ }, n;
273
+ })(), fe = ae.prototype;
274
+ return g.prototype = fe, [["$ms", d], ["$s", M], ["$m", f], ["$H", c], ["$W", k], ["$M", y], ["$y", m], ["$D", O]].forEach((function(n) {
275
+ fe[n[1]] = function(a) {
276
+ return this.$g(a, n[0], n[1]);
277
+ };
278
+ })), g.extend = function(n, a) {
279
+ return n.$i || (n(a, ae, g), n.$i = !0), g;
280
+ }, g.locale = E, g.isDayjs = K, g.unix = function(n) {
281
+ return g(1e3 * n);
282
+ }, g.en = H[N], g.Ls = H, g.p = {}, g;
283
+ }));
284
+ })(oe)), oe.exports;
285
+ }
286
+ var He = Pe();
287
+ const ue = /* @__PURE__ */ _e(He);
288
+ var le = { exports: {} }, Ne = le.exports, ke;
289
+ function xe() {
290
+ return ke || (ke = 1, (function(e, l) {
291
+ (function(C, I) {
292
+ e.exports = I();
293
+ })(Ne, (function() {
294
+ var C = "minute", I = /[+-]\d\d(?::?\d\d)?/g, j = /([+-]|\d\d)/g;
295
+ return function(d, M, f) {
296
+ var c = M.prototype;
297
+ f.utc = function(i) {
298
+ var S = { date: i, utc: !0, args: arguments };
299
+ return new M(S);
300
+ }, c.utc = function(i) {
301
+ var S = f(this.toDate(), { locale: this.$L, utc: !0 });
302
+ return i ? S.add(this.utcOffset(), C) : S;
303
+ }, c.local = function() {
304
+ return f(this.toDate(), { locale: this.$L, utc: !1 });
305
+ };
306
+ var k = c.parse;
307
+ c.parse = function(i) {
308
+ i.utc && (this.$u = !0), this.$utils().u(i.$offset) || (this.$offset = i.$offset), k.call(this, i);
309
+ };
310
+ var T = c.init;
311
+ c.init = function() {
312
+ if (this.$u) {
313
+ var i = this.$d;
314
+ this.$y = i.getUTCFullYear(), this.$M = i.getUTCMonth(), this.$D = i.getUTCDate(), this.$W = i.getUTCDay(), this.$H = i.getUTCHours(), this.$m = i.getUTCMinutes(), this.$s = i.getUTCSeconds(), this.$ms = i.getUTCMilliseconds();
315
+ } else T.call(this);
316
+ };
317
+ var y = c.utcOffset;
318
+ c.utcOffset = function(i, S) {
319
+ var A = this.$utils().u;
320
+ if (A(i)) return this.$u ? 0 : A(this.$offset) ? y.call(this) : this.$offset;
321
+ if (typeof i == "string" && (i = (function(N) {
322
+ N === void 0 && (N = "");
323
+ var H = N.match(I);
324
+ if (!H) return null;
325
+ var G = ("" + H[0]).match(j) || ["-", 0, 0], K = G[0], E = 60 * +G[1] + +G[2];
326
+ return E === 0 ? 0 : K === "+" ? E : -E;
327
+ })(i), i === null)) return this;
328
+ var x = Math.abs(i) <= 16 ? 60 * i : i;
329
+ if (x === 0) return this.utc(S);
330
+ var U = this.clone();
331
+ if (S) return U.$offset = x, U.$u = !1, U;
332
+ var se = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
333
+ return (U = this.local().add(x + se, C)).$offset = x, U.$x.$localOffset = se, U;
334
+ };
335
+ var B = c.format;
336
+ c.format = function(i) {
337
+ var S = i || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
338
+ return B.call(this, S);
339
+ }, c.valueOf = function() {
340
+ var i = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
341
+ return this.$d.valueOf() - 6e4 * i;
342
+ }, c.isUTC = function() {
343
+ return !!this.$u;
344
+ }, c.toISOString = function() {
345
+ return this.toDate().toISOString();
346
+ }, c.toString = function() {
347
+ return this.toDate().toUTCString();
348
+ };
349
+ var m = c.toDate;
350
+ c.toDate = function(i) {
351
+ return i === "s" && this.$offset ? f(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : m.call(this);
352
+ };
353
+ var O = c.diff;
354
+ c.diff = function(i, S, A) {
355
+ if (i && this.$u === i.$u) return O.call(this, i, S, A);
356
+ var x = this.local(), U = f(i).local();
357
+ return O.call(x, U, S, A);
358
+ };
359
+ };
360
+ }));
361
+ })(le)), le.exports;
362
+ }
363
+ var Ee = xe();
364
+ const Le = /* @__PURE__ */ _e(Ee);
365
+ ue.extend(Le);
366
+ const je = Se("serverTasks", () => {
367
+ const e = P([]), l = P(0), C = De(() => l.value > 0);
368
+ async function I() {
369
+ const f = te();
370
+ if (!(f.serverId <= 0)) {
371
+ l.value++;
372
+ try {
373
+ const c = await ie.get("/api/servers/" + f.serverId + "/tasks");
374
+ e.value = c.data.map((k) => ({
375
+ ...k,
376
+ execute_date: ue.utc(k.execute_date).local().format("YYYY-MM-DD HH:mm:ss")
377
+ }));
378
+ } finally {
379
+ l.value--;
380
+ }
381
+ }
382
+ }
383
+ async function j(f) {
384
+ const c = te(), k = {
385
+ ...f,
386
+ execute_date: ue(f.execute_date).utc().format("YYYY-MM-DD HH:mm:ss")
387
+ };
388
+ l.value++;
389
+ try {
390
+ const T = await ie.post("/api/servers/" + c.serverId + "/tasks", k);
391
+ f.id = T.data.serverTaskId, e.value.push(f);
392
+ } finally {
393
+ l.value--;
394
+ }
395
+ }
396
+ async function d(f, c) {
397
+ const k = te(), T = e.value[f].id, y = {
398
+ ...c,
399
+ execute_date: ue(c.execute_date).utc().format("YYYY-MM-DD HH:mm:ss")
400
+ };
401
+ l.value++;
402
+ try {
403
+ await ie.put("/api/servers/" + k.serverId + "/tasks/" + T, y), e.value[f] = { ...e.value[f], ...c };
404
+ } finally {
405
+ l.value--;
406
+ }
407
+ }
408
+ async function M(f) {
409
+ const c = te();
410
+ if (c.serverId <= 0)
411
+ return;
412
+ const k = e.value[f].id;
413
+ l.value++;
414
+ try {
415
+ await ie.delete("/api/servers/" + c.serverId + "/tasks/" + k), e.value.splice(f, 1);
416
+ } finally {
417
+ l.value--;
418
+ }
419
+ }
420
+ return {
421
+ // State
422
+ tasks: e,
423
+ apiProcesses: l,
424
+ // Getters
425
+ loading: C,
426
+ // Actions
427
+ fetchTasks: I,
428
+ storeTask: j,
429
+ updateTask: d,
430
+ destroyTask: M
431
+ };
432
+ }), Ae = 0, ce = 1, he = "", Fe = {
433
+ components: { GButton: Oe, GIcon: Ce },
434
+ props: {
435
+ serverId: Number,
436
+ privileges: {
437
+ start: !0,
438
+ stop: !0,
439
+ restart: !0,
440
+ update: !0
441
+ }
442
+ },
443
+ setup() {
444
+ const e = te(), l = je(), { tasks: C } = we(l);
445
+ return {
446
+ serverStore: e,
447
+ tasksStore: l,
448
+ tasks: C
449
+ };
450
+ },
451
+ data: function() {
452
+ return {
453
+ command: P(""),
454
+ taskDate: P("2007-06-30 12:08:55"),
455
+ taskRepeatInput: P(1),
456
+ taskRepeatRadio: P(0),
457
+ taskRepeatPeriod: P(0),
458
+ taskRepeatUnit: P("hours"),
459
+ selectedTaskIndex: P(null),
460
+ errors: {},
461
+ modalEnabled: P(!1),
462
+ modalTitle: P(""),
463
+ buttonName: this.trans("main.create"),
464
+ segmented: {
465
+ content: "soft",
466
+ footer: "soft"
467
+ }
468
+ };
469
+ },
470
+ methods: {
471
+ trans: J,
472
+ createTask() {
473
+ this.command = null, this.taskDate = null, this.taskRepeatInput = 1, this.taskRepeatPeriod = 1, this.taskRepeatUnit = "hours", this.selectedTaskIndex = null, this.buttonName = this.trans("main.create"), this.modalTitle = this.trans("servers_tasks.new_task"), this.showModal();
474
+ },
475
+ editTask(e) {
476
+ if (this.command = this.tasks[e].command, this.taskDate = this.tasks[e].execute_date, this.taskRepeatInput = "", this.repeat = this.tasks[e].repeat, this.tasks[e].repeat_period) {
477
+ const l = this.tasks[e].repeat_period.split(" ");
478
+ this.taskRepeatPeriod = parseInt(l[0]), this.taskRepeatUnit = this.repeatUnitPlural(l[1]);
479
+ }
480
+ this.selectedTaskIndex = e, this.buttonName = this.trans("main.save"), this.modalTitle = this.trans("servers_tasks.edit_task"), this.showModal();
481
+ },
482
+ sendTaskForm() {
483
+ if (!this.checkForm())
484
+ return;
485
+ const e = {
486
+ server_id: this.serverId,
487
+ command: this.command,
488
+ execute_date: this.taskDate,
489
+ repeat: this.repeat
490
+ };
491
+ e.repeat_period = e.repeat !== 1 ? this.taskRepeatPeriod + " " + this.taskRepeatUnit : "", this.selectedTaskIndex === null ? this.tasksStore.storeTask(e).then(() => {
492
+ this.hideModal();
493
+ }).catch((l) => {
494
+ this.hideModal(), me(l);
495
+ }) : this.tasksStore.updateTask(this.selectedTaskIndex, e).then(() => {
496
+ this.hideModal();
497
+ }).catch((l) => {
498
+ this.hideModal(), me(l);
499
+ });
500
+ },
501
+ checkForm() {
502
+ this.resetErrors();
503
+ let e = !1;
504
+ return this.command || (e = !0, this.errors.task = this.trans("servers_tasks.errors.empty_task_command")), this.taskDate || (e = !0, this.errors.taskDate = this.trans("servers_tasks.errors.empty_task_date")), this.taskRepeatRadio === he && (isNaN(parseInt(this.taskRepeatInput)) || this.taskRepeatInput < 1 || this.taskRepeatInput > 255) && (e = !0, this.errors.taskRepeatInput = this.trans("servers_tasks.errors.invalid_repeat_value")), this.repeat !== ce && (this.taskRepeatUnit ? this.taskRepeatPeriod ? this.taskRepeatUnit === "minutes" && this.taskRepeatPeriod < 10 && (e = !0, this.errors.taskRepeatPeriod = this.trans("servers_tasks.errors.minimum_period")) : (e = !0, this.errors.taskRepeatPeriod = this.trans("servers_tasks.errors.empty_period")) : (e = !0, this.errors.taskRepeatPeriod = this.trans("servers_tasks.errors.empty_period_unit"))), !e;
505
+ },
506
+ resetErrors() {
507
+ this.errors = {
508
+ command: null,
509
+ taskDate: null,
510
+ taskRepeatRadio: null,
511
+ taskRepeatInput: null,
512
+ taskRepeatPeriod: null
513
+ };
514
+ },
515
+ onTaskRepeatRadioChange(e) {
516
+ this.taskRepeatRadio = e.target.value, this.formChange();
517
+ },
518
+ formChange() {
519
+ this.resetErrors();
520
+ },
521
+ deleteTask(e) {
522
+ Ue(this.trans("servers_tasks.confirm_remove"), () => {
523
+ this.tasksStore.destroyTask(e);
524
+ });
525
+ },
526
+ humanRepeatText(e) {
527
+ return e === Ae ? this.trans("servers_tasks.endlessly") : e === ce ? this.trans("servers_tasks.once") : e;
528
+ },
529
+ repeatUnitPlural(e) {
530
+ switch (e) {
531
+ case "m":
532
+ case "min":
533
+ case "minute":
534
+ return "minutes";
535
+ case "h":
536
+ case "hour":
537
+ return "hours";
538
+ case "d":
539
+ case "day":
540
+ return "days";
541
+ case "w":
542
+ case "week":
543
+ return "weeks";
544
+ case "month":
545
+ return "months";
546
+ case "y":
547
+ case "year":
548
+ return "years";
549
+ }
550
+ return e;
551
+ },
552
+ showModal() {
553
+ this.modalEnabled = !0;
554
+ },
555
+ hideModal() {
556
+ this.modalEnabled = !1;
557
+ }
558
+ },
559
+ computed: {
560
+ repeat: {
561
+ get() {
562
+ return parseInt(this.taskRepeatRadio === he ? this.taskRepeatInput : this.taskRepeatRadio);
563
+ },
564
+ set(e) {
565
+ e = parseInt(e), e <= 0 ? this.taskRepeatRadio = 0 : e === ce ? this.taskRepeatRadio = 1 : (this.taskRepeatRadio = he, this.taskRepeatInput = e);
566
+ }
567
+ },
568
+ repeatMin: {
569
+ get() {
570
+ return this.taskRepeatUnit === "minutes" ? 10 : 1;
571
+ }
572
+ },
573
+ unitOptions: {
574
+ get() {
575
+ return [
576
+ {
577
+ label: Q("minute", parseInt(this.taskRepeatPeriod)),
578
+ value: "minutes"
579
+ },
580
+ {
581
+ label: Q("hour", parseInt(this.taskRepeatPeriod)),
582
+ value: "hours"
583
+ },
584
+ {
585
+ label: Q("day", parseInt(this.taskRepeatPeriod)),
586
+ value: "days"
587
+ },
588
+ {
589
+ label: Q("week", parseInt(this.taskRepeatPeriod)),
590
+ value: "weeks"
591
+ },
592
+ {
593
+ label: Q("month", parseInt(this.taskRepeatPeriod)),
594
+ value: "months"
595
+ },
596
+ {
597
+ label: Q("year", parseInt(this.taskRepeatPeriod)),
598
+ value: "years"
599
+ }
600
+ ];
601
+ }
602
+ },
603
+ options: {
604
+ get() {
605
+ let e = [];
606
+ return this.privileges.restart && e.push({
607
+ label: J("servers.restart"),
608
+ value: "restart"
609
+ }), this.privileges.start && e.push({
610
+ label: J("servers.start"),
611
+ value: "start"
612
+ }), this.privileges.stop && e.push({
613
+ label: J("servers.stop"),
614
+ value: "stop"
615
+ }), this.privileges.update && e.push({
616
+ label: J("servers.update"),
617
+ value: "update"
618
+ }), this.privileges.update && e.push({
619
+ label: J("servers.reinstall"),
620
+ value: "reinstall"
621
+ }), e;
622
+ }
623
+ }
624
+ },
625
+ mounted() {
626
+ this.serverStore.setServerId(this.serverId), this.tasksStore.fetchTasks();
627
+ }
628
+ }, We = { id: "server-task-component" }, ze = { class: "mb-2" }, Ve = { class: "stone-table" }, qe = { class: "stone-table-header" }, Be = {
629
+ scope: "col",
630
+ class: "px-4 py-4"
631
+ }, Ge = {
632
+ scope: "col",
633
+ class: "px-4 py-4"
634
+ }, Ze = {
635
+ scope: "col",
636
+ class: "px-4 py-4"
637
+ }, Je = {
638
+ scope: "col",
639
+ class: "px-4 py-4"
640
+ }, Qe = { class: "stone-table-row" }, Ke = { class: "px-3 py-4" }, Xe = { class: "px-3 py-4" }, et = { class: "px-3 py-4" }, tt = { class: "px-3 py-4" }, st = { class: "hidden lg:inline" }, at = { class: "hidden lg:inline" }, rt = { class: "mb-3" }, nt = {
641
+ for: "task",
642
+ class: "control-label"
643
+ }, it = {
644
+ key: 0,
645
+ class: "help-block"
646
+ }, ot = { class: "text-red-600" }, ut = { class: "mb-3" }, lt = {
647
+ key: 0,
648
+ class: "help-block"
649
+ }, dt = { class: "text-red-600" }, ct = { class: "relative block mb-2" }, ht = { class: "relative block mb-2" }, ft = { class: "relative block mb-2" }, pt = { class: "mb-3" }, mt = {
650
+ for: "repeat",
651
+ class: "control-label"
652
+ }, vt = {
653
+ key: 0,
654
+ class: "help-block"
655
+ }, kt = { class: "text-red-600" }, _t = { class: "mb-3" }, $t = { class: "control-label" }, yt = { class: "flex flex-wrap" }, gt = { class: "md:w-1/3 pr-4 pl-4" }, Rt = { class: "md:w-2/3 pr-4 pl-4" }, bt = {
656
+ key: 0,
657
+ class: "help-block"
658
+ }, Dt = { class: "text-red-600" };
659
+ function Mt(e, l, C, I, j, d) {
660
+ const M = pe("GIcon"), f = pe("GButton"), c = ye, k = ge, T = Re, y = be, B = $e;
661
+ return V(), z("div", We, [
662
+ h("div", ze, [
663
+ b(f, {
664
+ color: "green",
665
+ size: "small",
666
+ onClick: l[0] || (l[0] = (m) => d.createTask())
667
+ }, {
668
+ default: q(() => [
669
+ b(M, { name: "add-square" }),
670
+ de(" " + $(d.trans("main.add")), 1)
671
+ ]),
672
+ _: 1
673
+ })
674
+ ]),
675
+ h("table", Ve, [
676
+ h("thead", qe, [
677
+ h("tr", null, [
678
+ h("th", Be, $(d.trans("servers_tasks.task")), 1),
679
+ h("th", Ge, $(d.trans("servers_tasks.date")), 1),
680
+ h("th", Ze, $(d.trans("servers_tasks.repeat")), 1),
681
+ h("th", Je, $(d.trans("main.actions")), 1)
682
+ ])
683
+ ]),
684
+ (V(!0), z(Me, null, Te(I.tasks, (m, O) => (V(), z("tbody", null, [
685
+ h("tr", Qe, [
686
+ h("td", Ke, $(m.command), 1),
687
+ h("td", Xe, $(m.execute_date), 1),
688
+ h("td", et, $(d.humanRepeatText(m.repeat)), 1),
689
+ h("td", tt, [
690
+ b(f, {
691
+ onClick: (i) => d.editTask(O),
692
+ color: "blue",
693
+ size: "small",
694
+ class: "mr-1"
695
+ }, {
696
+ default: q(() => [
697
+ b(M, { name: "edit" }),
698
+ h("span", st, " " + $(d.trans("main.edit")), 1)
699
+ ]),
700
+ _: 1
701
+ }, 8, ["onClick"]),
702
+ b(f, {
703
+ onClick: (i) => d.deleteTask(O),
704
+ color: "red",
705
+ size: "small"
706
+ }, {
707
+ default: q(() => [
708
+ b(M, { name: "delete" }),
709
+ h("span", at, " " + $(d.trans("main.delete")), 1)
710
+ ]),
711
+ _: 1
712
+ }, 8, ["onClick"])
713
+ ])
714
+ ])
715
+ ]))), 256))
716
+ ]),
717
+ b(B, {
718
+ show: e.modalEnabled,
719
+ "onUpdate:show": l[6] || (l[6] = (m) => e.modalEnabled = m),
720
+ class: "custom-card",
721
+ preset: "card",
722
+ title: e.modalTitle,
723
+ bordered: !1,
724
+ style: { width: "600px" },
725
+ segmented: e.segmented
726
+ }, {
727
+ footer: q(() => [
728
+ b(f, {
729
+ color: "blue",
730
+ onClick: d.sendTaskForm,
731
+ class: "mr-1"
732
+ }, {
733
+ default: q(() => [
734
+ de($(e.buttonName), 1)
735
+ ]),
736
+ _: 1
737
+ }, 8, ["onClick"]),
738
+ b(f, {
739
+ color: "white",
740
+ onClick: d.hideModal
741
+ }, {
742
+ default: q(() => [
743
+ de($(d.trans("main.close")), 1)
744
+ ]),
745
+ _: 1
746
+ }, 8, ["onClick"])
747
+ ]),
748
+ default: q(() => [
749
+ h("div", null, [
750
+ h("form", null, [
751
+ h("div", rt, [
752
+ h("label", nt, $(d.trans("servers_tasks.task")), 1),
753
+ b(c, {
754
+ value: e.command,
755
+ "onUpdate:value": l[1] || (l[1] = (m) => e.command = m),
756
+ options: d.options,
757
+ onUpdate: d.formChange
758
+ }, null, 8, ["value", "options", "onUpdate"]),
759
+ e.errors.command ? (V(), z("span", it, [
760
+ h("strong", ot, $(e.errors.command), 1)
761
+ ])) : ne("", !0)
762
+ ]),
763
+ h("div", ut, [
764
+ b(k, {
765
+ "formatted-value": e.taskDate,
766
+ "onUpdate:formattedValue": l[2] || (l[2] = (m) => e.taskDate = m),
767
+ "value-format": "yyyy-MM-dd HH:mm:ss",
768
+ type: "datetime",
769
+ onUpdate: d.formChange,
770
+ clearable: ""
771
+ }, null, 8, ["formatted-value", "onUpdate"]),
772
+ l[7] || (l[7] = h("br", null, null, -1)),
773
+ e.errors.taskDate ? (V(), z("span", lt, [
774
+ h("strong", dt, $(e.errors.taskDate), 1)
775
+ ])) : ne("", !0)
776
+ ]),
777
+ h("div", ct, [
778
+ b(T, {
779
+ checked: e.taskRepeatRadio === "1" || e.taskRepeatRadio === 1,
780
+ onChange: d.onTaskRepeatRadioChange,
781
+ name: "repeat",
782
+ label: d.trans("servers_tasks.no_repeat"),
783
+ value: "1"
784
+ }, null, 8, ["checked", "onChange", "label"])
785
+ ]),
786
+ h("div", ht, [
787
+ b(T, {
788
+ checked: e.taskRepeatRadio === "0" || e.taskRepeatRadio === 0,
789
+ onChange: d.onTaskRepeatRadioChange,
790
+ name: "repeat",
791
+ label: d.trans("servers_tasks.endlessly_repeat"),
792
+ value: "0"
793
+ }, null, 8, ["checked", "onChange", "label"])
794
+ ]),
795
+ h("div", ft, [
796
+ b(T, {
797
+ checked: e.taskRepeatRadio === "",
798
+ onChange: d.onTaskRepeatRadioChange,
799
+ name: "repeat",
800
+ label: d.trans("servers_tasks.custom_repeat"),
801
+ value: ""
802
+ }, null, 8, ["checked", "onChange", "label"])
803
+ ]),
804
+ h("div", pt, [
805
+ h("label", mt, $(d.trans("servers_tasks.repeat_num")), 1),
806
+ b(y, {
807
+ value: e.taskRepeatInput,
808
+ "onUpdate:value": l[3] || (l[3] = (m) => e.taskRepeatInput = m),
809
+ disabled: e.taskRepeatRadio !== "",
810
+ id: "repeat",
811
+ min: 1,
812
+ max: 255
813
+ }, null, 8, ["value", "disabled"]),
814
+ e.errors.taskRepeatInput ? (V(), z("span", vt, [
815
+ h("strong", kt, $(e.errors.taskRepeatInput), 1)
816
+ ])) : ne("", !0)
817
+ ]),
818
+ h("div", _t, [
819
+ h("label", $t, $(d.trans("servers_tasks.repeat_period")), 1),
820
+ h("div", yt, [
821
+ h("div", gt, [
822
+ b(y, {
823
+ value: e.taskRepeatPeriod,
824
+ "onUpdate:value": l[4] || (l[4] = (m) => e.taskRepeatPeriod = m),
825
+ disabled: d.repeat === 1,
826
+ onUpdate: d.formChange,
827
+ id: "repeat_period",
828
+ name: "repeat_period",
829
+ type: "number",
830
+ min: d.repeatMin
831
+ }, null, 8, ["value", "disabled", "onUpdate", "min"])
832
+ ]),
833
+ h("div", Rt, [
834
+ b(c, {
835
+ value: e.taskRepeatUnit,
836
+ "onUpdate:value": l[5] || (l[5] = (m) => e.taskRepeatUnit = m),
837
+ disabled: d.repeat === 1,
838
+ onUpdate: d.formChange,
839
+ options: d.unitOptions
840
+ }, null, 8, ["value", "disabled", "onUpdate", "options"])
841
+ ])
842
+ ]),
843
+ e.errors.taskRepeatPeriod ? (V(), z("span", bt, [
844
+ h("strong", Dt, $(e.errors.taskRepeatPeriod), 1)
845
+ ])) : ne("", !0)
846
+ ])
847
+ ])
848
+ ])
849
+ ]),
850
+ _: 1
851
+ }, 8, ["show", "title", "segmented"])
852
+ ]);
853
+ }
854
+ const Ct = /* @__PURE__ */ Ie(Fe, [["render", Mt]]);
855
+ export {
856
+ Ct as default
857
+ };