@raketa-cloud/admin 1.9.6 → 1.9.7
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/application.css
CHANGED
|
@@ -3523,6 +3523,10 @@ body {
|
|
|
3523
3523
|
background-color: rgb(124 45 18 / 0.5);
|
|
3524
3524
|
}
|
|
3525
3525
|
|
|
3526
|
+
.dark\:bg-orange-950\/40:where(.dark, .dark *) {
|
|
3527
|
+
background-color: rgb(67 20 7 / 0.4);
|
|
3528
|
+
}
|
|
3529
|
+
|
|
3526
3530
|
.dark\:bg-raketa-primary\/15:where(.dark, .dark *) {
|
|
3527
3531
|
background-color: rgba(var(--primary), 0.15);
|
|
3528
3532
|
}
|
package/package.json
CHANGED
|
@@ -23,3 +23,27 @@ export const buildResourceUrl = (resource, globalConfig) => {
|
|
|
23
23
|
|
|
24
24
|
return `/${locale}/${route}/${id}`;
|
|
25
25
|
};
|
|
26
|
+
|
|
27
|
+
export const hasUnattachedKeys = (task) => {
|
|
28
|
+
if (!task || task.completedAt || task.failedAt) return false;
|
|
29
|
+
|
|
30
|
+
const unattachedKeys = task.lokaliseWorkflow?.settings?.unattached_keys;
|
|
31
|
+
const ids = unattachedKeys?.ids;
|
|
32
|
+
|
|
33
|
+
if (Array.isArray(ids)) {
|
|
34
|
+
return ids.length > 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return Boolean(ids);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const unattachedKeyIds = (task) => {
|
|
41
|
+
const unattachedKeys = task?.lokaliseWorkflow?.settings?.unattached_keys;
|
|
42
|
+
const ids = unattachedKeys?.ids;
|
|
43
|
+
|
|
44
|
+
if (Array.isArray(ids)) {
|
|
45
|
+
return ids.join(", ");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return ids ? String(ids) : "";
|
|
49
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
workflowsMap,
|
|
3
3
|
buildResourceUrl,
|
|
4
|
+
hasUnattachedKeys,
|
|
5
|
+
unattachedKeyIds,
|
|
4
6
|
} from "../../helpers/content_tasks_helper";
|
|
5
7
|
|
|
6
8
|
describe("content_tasks_helper", () => {
|
|
@@ -65,4 +67,107 @@ describe("content_tasks_helper", () => {
|
|
|
65
67
|
);
|
|
66
68
|
});
|
|
67
69
|
});
|
|
70
|
+
|
|
71
|
+
describe("hasUnattachedKeys", () => {
|
|
72
|
+
test("returns false when task is null or undefined", () => {
|
|
73
|
+
expect(hasUnattachedKeys(null)).toBe(false);
|
|
74
|
+
expect(hasUnattachedKeys(undefined)).toBe(false);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test("returns false when task is completed or failed", () => {
|
|
78
|
+
expect(
|
|
79
|
+
hasUnattachedKeys({
|
|
80
|
+
completedAt: "2024-01-01T00:00:00Z",
|
|
81
|
+
lokaliseWorkflow: { settings: { unattached_keys: { ids: [1, 2] } } },
|
|
82
|
+
}),
|
|
83
|
+
).toBe(false);
|
|
84
|
+
|
|
85
|
+
expect(
|
|
86
|
+
hasUnattachedKeys({
|
|
87
|
+
failedAt: "2024-01-01T00:00:00Z",
|
|
88
|
+
lokaliseWorkflow: { settings: { unattached_keys: { ids: [1, 2] } } },
|
|
89
|
+
}),
|
|
90
|
+
).toBe(false);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("returns false when task has no lokaliseWorkflow or settings", () => {
|
|
94
|
+
expect(hasUnattachedKeys({ completedAt: null, failedAt: null })).toBe(
|
|
95
|
+
false,
|
|
96
|
+
);
|
|
97
|
+
expect(
|
|
98
|
+
hasUnattachedKeys({
|
|
99
|
+
completedAt: null,
|
|
100
|
+
failedAt: null,
|
|
101
|
+
lokaliseWorkflow: {},
|
|
102
|
+
}),
|
|
103
|
+
).toBe(false);
|
|
104
|
+
expect(
|
|
105
|
+
hasUnattachedKeys({
|
|
106
|
+
completedAt: null,
|
|
107
|
+
failedAt: null,
|
|
108
|
+
lokaliseWorkflow: { settings: {} },
|
|
109
|
+
}),
|
|
110
|
+
).toBe(false);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test("returns false when unattached_keys has empty ids array or null", () => {
|
|
114
|
+
expect(
|
|
115
|
+
hasUnattachedKeys({
|
|
116
|
+
completedAt: null,
|
|
117
|
+
failedAt: null,
|
|
118
|
+
lokaliseWorkflow: { settings: { unattached_keys: { ids: [] } } },
|
|
119
|
+
}),
|
|
120
|
+
).toBe(false);
|
|
121
|
+
|
|
122
|
+
expect(
|
|
123
|
+
hasUnattachedKeys({
|
|
124
|
+
completedAt: null,
|
|
125
|
+
failedAt: null,
|
|
126
|
+
lokaliseWorkflow: { settings: { unattached_keys: null } },
|
|
127
|
+
}),
|
|
128
|
+
).toBe(false);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test("returns true when task is in progress and has unattached key ids", () => {
|
|
132
|
+
expect(
|
|
133
|
+
hasUnattachedKeys({
|
|
134
|
+
completedAt: null,
|
|
135
|
+
failedAt: null,
|
|
136
|
+
lokaliseWorkflow: {
|
|
137
|
+
settings: { unattached_keys: { ids: [101, 102] } },
|
|
138
|
+
},
|
|
139
|
+
}),
|
|
140
|
+
).toBe(true);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
describe("unattachedKeyIds", () => {
|
|
145
|
+
test("returns empty string when no unattached keys exist", () => {
|
|
146
|
+
expect(unattachedKeyIds(null)).toBe("");
|
|
147
|
+
expect(unattachedKeyIds({})).toBe("");
|
|
148
|
+
expect(
|
|
149
|
+
unattachedKeyIds({
|
|
150
|
+
lokaliseWorkflow: { settings: { unattached_keys: {} } },
|
|
151
|
+
}),
|
|
152
|
+
).toBe("");
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test("returns comma separated string of ids", () => {
|
|
156
|
+
expect(
|
|
157
|
+
unattachedKeyIds({
|
|
158
|
+
lokaliseWorkflow: {
|
|
159
|
+
settings: { unattached_keys: { ids: [101, 102, 103] } },
|
|
160
|
+
},
|
|
161
|
+
}),
|
|
162
|
+
).toBe("101, 102, 103");
|
|
163
|
+
|
|
164
|
+
expect(
|
|
165
|
+
unattachedKeyIds({
|
|
166
|
+
lokaliseWorkflow: {
|
|
167
|
+
settings: { unattached_keys: { ids: ["key_a", "key_b"] } },
|
|
168
|
+
},
|
|
169
|
+
}),
|
|
170
|
+
).toBe("key_a, key_b");
|
|
171
|
+
});
|
|
172
|
+
});
|
|
68
173
|
});
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
<tbody>
|
|
20
20
|
<% tasks.forEach(task => { %>
|
|
21
21
|
<% const resources = task.resources || []; %>
|
|
22
|
+
<% const isMarked = showAllDetails && content_tasks.hasUnattachedKeys(task); %>
|
|
22
23
|
|
|
23
|
-
<tr>
|
|
24
|
+
<tr class="<%= isMarked ? 'bg-orange-100 dark:bg-orange-950/40' : '' %>">
|
|
24
25
|
<% if (showAllDetails) { %>
|
|
25
26
|
<td class="w-1/3">
|
|
26
27
|
<% if (resources && resources.length > 0) { %>
|
|
@@ -62,6 +63,12 @@
|
|
|
62
63
|
<span class="body-2">
|
|
63
64
|
<%= content_tasks.workflowsMap(task.workflow) %>
|
|
64
65
|
</span>
|
|
66
|
+
|
|
67
|
+
<% if (isMarked) { %>
|
|
68
|
+
<div class="body-3 text-raketa-foreground/50">
|
|
69
|
+
<%= content_tasks.unattachedKeyIds(task) %>
|
|
70
|
+
</div>
|
|
71
|
+
<% } %>
|
|
65
72
|
</td>
|
|
66
73
|
|
|
67
74
|
<td>
|