@gameap/frontend 4.1.0-dev1 → 4.1.0-dev2

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