@raketa-cloud/admin 0.0.91 → 0.0.92

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-cloud/admin",
3
- "version": "0.0.91",
3
+ "version": "0.0.92",
4
4
  "main": "src/index.js",
5
5
  "scripts": {
6
6
  "dev": "npx tailwindcss -i ./src/styles/application.css -o ../../apps/admin/static/application.css --watch",
@@ -18,6 +18,7 @@ const create_form = async (ctx) => {
18
18
  visibility: revision.visibility,
19
19
  username: revision.settings?.credentials?.user,
20
20
  password: revision.settings?.credentials?.password,
21
+ type: "now",
21
22
  },
22
23
  visibilityOptions: ctx.client.articles.visibilityOptions(),
23
24
  errors: {},
@@ -49,7 +50,7 @@ function publishArticleParams(
49
50
  }
50
51
 
51
52
  async function publishRevision(ctx, revision, publishing) {
52
- if (publishing.mergeAt) {
53
+ if (publishing.mergeAt && publishing.type === "later") {
53
54
  return await ctx.client.articleRevisions.schedule(
54
55
  revision.id,
55
56
  ctx.locale,
@@ -15,6 +15,7 @@ const create_form = async (ctx) => {
15
15
  visibility: revision.visibility,
16
16
  username: revision.settings?.credentials?.user,
17
17
  password: revision.settings?.credentials?.password,
18
+ type: "now",
18
19
  },
19
20
  visibilityOptions: ctx.client.events.visibilityOptions(),
20
21
  errors: {},
@@ -46,7 +47,7 @@ function publishEventParams(
46
47
  }
47
48
 
48
49
  async function publishRevision(ctx, revision, publishing) {
49
- if (publishing.mergeAt) {
50
+ if (publishing.mergeAt && publishing.type === "later") {
50
51
  return await ctx.client.eventRevisions.schedule(
51
52
  revision.id,
52
53
  ctx.locale,
@@ -15,6 +15,7 @@ const create_form = async (ctx) => {
15
15
  visibility: revision.visibility,
16
16
  username: revision.settings?.credentials?.user,
17
17
  password: revision.settings?.credentials?.password,
18
+ type: "now",
18
19
  },
19
20
  visibilityOptions: ctx.client.pages.visibilityOptions(),
20
21
  errors: {},
@@ -46,7 +47,7 @@ function publishPageParams(
46
47
  }
47
48
 
48
49
  async function publishRevision(ctx, revision, publishing) {
49
- if (publishing.mergeAt) {
50
+ if (publishing.mergeAt && publishing.type === "later") {
50
51
  return await ctx.client.pageRevisions.schedule(
51
52
  revision.id,
52
53
  ctx.locale,
@@ -29,6 +29,7 @@ describe("Publish article revision", () => {
29
29
  visibility: "protected",
30
30
  username: "admin",
31
31
  password: "admin123!@#",
32
+ type: "now",
32
33
  };
33
34
 
34
35
  const ctx = buildCtx(revision, {
@@ -86,6 +87,7 @@ describe("Publish article revision", () => {
86
87
  title: "A new revision!",
87
88
  description: "Nice!",
88
89
  visibility: "public",
90
+ type: "now",
89
91
  };
90
92
 
91
93
  const ctx = buildCtx(revision, {
@@ -128,6 +130,7 @@ describe("Publish article revision", () => {
128
130
  visibility: publishing.visibility,
129
131
  username: publishing.username,
130
132
  password: publishing.password,
133
+ type: publishing.type,
131
134
  },
132
135
  visibilityOptions: ctx.client.articles.visibilityOptions(),
133
136
  errors: {
@@ -149,6 +152,7 @@ describe("Publish article revision", () => {
149
152
  visibility: "protected",
150
153
  username: "admin",
151
154
  password: "admin123!@#",
155
+ type: "later",
152
156
  };
153
157
 
154
158
  const ctx = buildCtx(revision, {
@@ -204,6 +208,7 @@ describe("Publish article revision", () => {
204
208
  title: "A new revision!",
205
209
  description: "Nice!",
206
210
  visibility: "public",
211
+ type: "later",
207
212
  };
208
213
 
209
214
  const ctx = buildCtx(revision, {
@@ -249,6 +254,7 @@ describe("Publish article revision", () => {
249
254
  visibility: publishing.visibility,
250
255
  username: publishing.username,
251
256
  password: publishing.password,
257
+ type: publishing.type,
252
258
  },
253
259
  visibilityOptions: ctx.client.articles.visibilityOptions(),
254
260
  articleErrors: {
@@ -267,6 +273,7 @@ describe("Publish article revision", () => {
267
273
  title: "A new revision!",
268
274
  description: "Nice!",
269
275
  visibility: "public",
276
+ type: "later",
270
277
  };
271
278
 
272
279
  const ctx = buildCtx(revision, {
@@ -312,6 +319,7 @@ describe("Publish article revision", () => {
312
319
  visibility: publishing.visibility,
313
320
  username: publishing.username,
314
321
  password: publishing.password,
322
+ type: publishing.type,
315
323
  },
316
324
  visibilityOptions: ctx.client.articles.visibilityOptions(),
317
325
  errors: {
@@ -37,6 +37,7 @@ describe("Publish article revision", () => {
37
37
  visibility: revision.visibility,
38
38
  username: revision.settings?.credentials?.user,
39
39
  password: revision.settings?.credentials?.password,
40
+ type: "now",
40
41
  },
41
42
  visibilityOptions: ctx.client.articles.visibilityOptions(),
42
43
  errors: {},
@@ -29,6 +29,7 @@ describe("Publish event revision", () => {
29
29
  visibility: "protected",
30
30
  username: "admin",
31
31
  password: "admin123!@#",
32
+ type: "now",
32
33
  };
33
34
 
34
35
  const ctx = buildCtx(revision, {
@@ -86,6 +87,7 @@ describe("Publish event revision", () => {
86
87
  title: "A new revision!",
87
88
  description: "Nice!",
88
89
  visibility: "public",
90
+ type: "now",
89
91
  };
90
92
 
91
93
  const ctx = buildCtx(revision, {
@@ -128,6 +130,7 @@ describe("Publish event revision", () => {
128
130
  visibility: publishing.visibility,
129
131
  username: publishing.username,
130
132
  password: publishing.password,
133
+ type: publishing.type,
131
134
  },
132
135
  visibilityOptions: ctx.client.events.visibilityOptions(),
133
136
  errors: {
@@ -149,6 +152,7 @@ describe("Publish event revision", () => {
149
152
  visibility: "protected",
150
153
  username: "admin",
151
154
  password: "admin123!@#",
155
+ type: "later",
152
156
  };
153
157
 
154
158
  const ctx = buildCtx(revision, {
@@ -204,6 +208,7 @@ describe("Publish event revision", () => {
204
208
  title: "A new revision!",
205
209
  description: "Nice!",
206
210
  visibility: "public",
211
+ type: "later",
207
212
  };
208
213
 
209
214
  const ctx = buildCtx(revision, {
@@ -249,6 +254,7 @@ describe("Publish event revision", () => {
249
254
  visibility: publishing.visibility,
250
255
  username: publishing.username,
251
256
  password: publishing.password,
257
+ type: publishing.type,
252
258
  },
253
259
  visibilityOptions: ctx.client.events.visibilityOptions(),
254
260
  eventErrors: {
@@ -267,6 +273,7 @@ describe("Publish event revision", () => {
267
273
  title: "A new revision!",
268
274
  description: "Nice!",
269
275
  visibility: "public",
276
+ type: "later",
270
277
  };
271
278
 
272
279
  const ctx = buildCtx(revision, {
@@ -312,6 +319,7 @@ describe("Publish event revision", () => {
312
319
  visibility: publishing.visibility,
313
320
  username: publishing.username,
314
321
  password: publishing.password,
322
+ type: publishing.type,
315
323
  },
316
324
  visibilityOptions: ctx.client.events.visibilityOptions(),
317
325
  errors: {
@@ -37,6 +37,7 @@ describe("Publish event revision", () => {
37
37
  visibility: revision.visibility,
38
38
  username: revision.settings?.credentials?.user,
39
39
  password: revision.settings?.credentials?.password,
40
+ type: "now",
40
41
  },
41
42
  visibilityOptions: ctx.client.events.visibilityOptions(),
42
43
  errors: {},
@@ -29,6 +29,7 @@ describe("Publish page revision", () => {
29
29
  visibility: "protected",
30
30
  username: "admin",
31
31
  password: "admin123!@#",
32
+ type: "now",
32
33
  };
33
34
 
34
35
  const ctx = buildCtx(revision, {
@@ -86,6 +87,7 @@ describe("Publish page revision", () => {
86
87
  title: "A new revision!",
87
88
  description: "Nice!",
88
89
  visibility: "public",
90
+ type: "now",
89
91
  };
90
92
 
91
93
  const ctx = buildCtx(revision, {
@@ -128,6 +130,7 @@ describe("Publish page revision", () => {
128
130
  visibility: publishing.visibility,
129
131
  username: publishing.username,
130
132
  password: publishing.password,
133
+ type: publishing.type,
131
134
  },
132
135
  visibilityOptions: ctx.client.pages.visibilityOptions(),
133
136
  errors: {
@@ -149,6 +152,7 @@ describe("Publish page revision", () => {
149
152
  visibility: "protected",
150
153
  username: "admin",
151
154
  password: "admin123!@#",
155
+ type: "later",
152
156
  };
153
157
 
154
158
  const ctx = buildCtx(revision, {
@@ -204,6 +208,7 @@ describe("Publish page revision", () => {
204
208
  title: "A new revision!",
205
209
  description: "Nice!",
206
210
  visibility: "public",
211
+ type: "later",
207
212
  };
208
213
 
209
214
  const ctx = buildCtx(revision, {
@@ -249,6 +254,7 @@ describe("Publish page revision", () => {
249
254
  visibility: publishing.visibility,
250
255
  username: publishing.username,
251
256
  password: publishing.password,
257
+ type: publishing.type,
252
258
  },
253
259
  visibilityOptions: ctx.client.pages.visibilityOptions(),
254
260
  pageErrors: {
@@ -267,6 +273,7 @@ describe("Publish page revision", () => {
267
273
  title: "A new revision!",
268
274
  description: "Nice!",
269
275
  visibility: "public",
276
+ type: "later",
270
277
  };
271
278
 
272
279
  const ctx = buildCtx(revision, {
@@ -312,6 +319,7 @@ describe("Publish page revision", () => {
312
319
  visibility: publishing.visibility,
313
320
  username: publishing.username,
314
321
  password: publishing.password,
322
+ type: publishing.type,
315
323
  },
316
324
  visibilityOptions: ctx.client.pages.visibilityOptions(),
317
325
  errors: {
@@ -37,6 +37,7 @@ describe("Publish page revision", () => {
37
37
  visibility: revision.visibility,
38
38
  username: revision.settings?.credentials?.user,
39
39
  password: revision.settings?.credentials?.password,
40
+ type: "now",
40
41
  },
41
42
  visibilityOptions: ctx.client.pages.visibilityOptions(),
42
43
  errors: {},
@@ -4,11 +4,11 @@
4
4
  <div class="mb-4 text-red-500">A page with this URL already exists</div>
5
5
  <% } %>
6
6
 
7
- <%- f.field('publishing.title'), { required: true, hint: "Appears in the history of changes" } %>
8
- <%- f.field('publishing.description', { as: "textarea", hint: "Provide optional details" }) %>
9
-
7
+ <%- f.field('publishing.type', { as: 'radio_group', options: [["now", "Publish now"], ["later", "Schedule for a date"]] }) %>
10
8
  <%- f.field('publishing.mergeAt', { type: 'datetime-local', label: 'Publish revision at (UTC)' }) %>
11
9
 
10
+ <%- f.field('publishing.title'), { required: true, hint: "Appears in the history of changes" } %>
11
+ <%- f.field('publishing.description', { as: "textarea", hint: "Provide optional details" }) %>
12
12
  <%- f.field('publishing.visibility', { as: 'select', required: true, options: visibilityOptions }) %>
13
13
  <%- f.field('publishing.username', { required: true }) %>
14
14
  <%- f.field('publishing.password', { required: true }) %>
@@ -23,6 +23,33 @@
23
23
  </form>
24
24
  <% }) %>
25
25
 
26
+ <script>
27
+ // Takes care of the publishint time!
28
+ const typeEl = document.getElementById("f_publishing_type")
29
+ const mergeAtEl = document.getElementById("f_publishing_mergeAt")
30
+
31
+ function radioGroupValue(radioGroup) {
32
+ let val = "";
33
+ radioGroup.querySelectorAll('input[type="radio"]').forEach(input => {
34
+ if (input.checked) {
35
+ val = input.value
36
+ }
37
+ })
38
+ return val;
39
+ }
40
+
41
+ function handleTypeChange(value) {
42
+ const shouldShowMergeAt = value === "later"
43
+ if (shouldShowMergeAt) {
44
+ mergeAtEl.parentNode.classList.remove('hidden')
45
+ } else {
46
+ mergeAtEl.parentNode.classList.add('hidden')
47
+ }
48
+ }
49
+ typeEl.addEventListener("change", (e) => handleTypeChange(e.target.value))
50
+ handleTypeChange(radioGroupValue(typeEl))
51
+ </script>
52
+
26
53
  <script>
27
54
  const visibilityEl = document.getElementById("f_publishing_visibility");
28
55
  const usernameEl = document.getElementById("f_publishing_username").parentElement;
@@ -4,11 +4,11 @@
4
4
  <div class="mb-4 text-red-500">A page with this URL already exists</div>
5
5
  <% } %>
6
6
 
7
- <%- f.field('publishing.title'), { required: true, hint: "Appears in the history of changes" } %>
8
- <%- f.field('publishing.description', { as: "textarea", hint: "Provide optional details" }) %>
9
-
7
+ <%- f.field('publishing.type', { as: 'radio_group', options: [["now", "Publish now"], ["later", "Schedule for a date"]] }) %>
10
8
  <%- f.field('publishing.mergeAt', { type: 'datetime-local', label: 'Publish revision at (UTC)' }) %>
11
9
 
10
+ <%- f.field('publishing.title'), { required: true, hint: "Appears in the history of changes" } %>
11
+ <%- f.field('publishing.description', { as: "textarea", hint: "Provide optional details" }) %>
12
12
  <%- f.field('publishing.visibility', { as: 'select', required: true, options: visibilityOptions }) %>
13
13
  <%- f.field('publishing.username', { required: true }) %>
14
14
  <%- f.field('publishing.password', { required: true }) %>
@@ -23,6 +23,40 @@
23
23
  </form>
24
24
  <% }) %>
25
25
 
26
+
27
+ <script>
28
+ // Takes care of the publishint time!
29
+ const typeEl = document.getElementById("f_publishing_type")
30
+ const mergeAtEl = document.getElementById("f_publishing_mergeAt")
31
+
32
+ function radioGroupValue(radioGroup) {
33
+ let val = "";
34
+
35
+ radioGroup.querySelectorAll('input[type="radio"]').forEach(input => {
36
+
37
+ if (input.checked) {
38
+ val = input.value
39
+ }
40
+
41
+ })
42
+
43
+ return val;
44
+ }
45
+
46
+ function handleTypeChange(value) {
47
+ const shouldShowMergeAt = value === "later"
48
+
49
+ if (shouldShowMergeAt) {
50
+ mergeAtEl.parentNode.classList.remove('hidden')
51
+ } else {
52
+ mergeAtEl.parentNode.classList.add('hidden')
53
+ }
54
+ }
55
+
56
+ typeEl.addEventListener("change", (e) => handleTypeChange(e.target.value))
57
+ handleTypeChange(radioGroupValue(typeEl))
58
+ </script>
59
+
26
60
  <script>
27
61
  const visibilityEl = document.getElementById("f_publishing_visibility");
28
62
  const usernameEl = document.getElementById("f_publishing_username").parentElement;
@@ -4,11 +4,11 @@
4
4
  <div class="mb-4 text-red-500">A page with this URL already exists</div>
5
5
  <% } %>
6
6
 
7
- <%- f.field('publishing.title'), { required: true, hint: "Appears in the history of changes" } %>
8
- <%- f.field('publishing.description', { as: "textarea", hint: "Provide optional details" }) %>
9
-
7
+ <%- f.field('publishing.type', { as: 'radio_group', options: [["now", "Publish now"], ["later", "Schedule for a date"]] }) %>
10
8
  <%- f.field('publishing.mergeAt', { type: 'datetime-local', label: 'Publish revision at (UTC)' }) %>
11
9
 
10
+ <%- f.field('publishing.title'), { required: true, hint: "Appears in the history of changes" } %>
11
+ <%- f.field('publishing.description', { as: "textarea", hint: "Provide optional details" }) %>
12
12
  <%- f.field('publishing.visibility', { as: 'select', required: true, options: visibilityOptions }) %>
13
13
  <%- f.field('publishing.username', { required: true }) %>
14
14
  <%- f.field('publishing.password', { required: true }) %>
@@ -23,6 +23,39 @@
23
23
  </form>
24
24
  <% }) %>
25
25
 
26
+ <script>
27
+ // Takes care of the publishint time!
28
+ const typeEl = document.getElementById("f_publishing_type")
29
+ const mergeAtEl = document.getElementById("f_publishing_mergeAt")
30
+
31
+ function radioGroupValue(radioGroup) {
32
+ let val = "";
33
+
34
+ radioGroup.querySelectorAll('input[type="radio"]').forEach(input => {
35
+
36
+ if (input.checked) {
37
+ val = input.value
38
+ }
39
+
40
+ })
41
+
42
+ return val;
43
+ }
44
+
45
+ function handleTypeChange(value) {
46
+ const shouldShowMergeAt = value === "later"
47
+
48
+ if (shouldShowMergeAt) {
49
+ mergeAtEl.parentNode.classList.remove('hidden')
50
+ } else {
51
+ mergeAtEl.parentNode.classList.add('hidden')
52
+ }
53
+ }
54
+
55
+ typeEl.addEventListener("change", (e) => handleTypeChange(e.target.value))
56
+ handleTypeChange(radioGroupValue(typeEl))
57
+ </script>
58
+
26
59
  <script>
27
60
  const visibilityEl = document.getElementById("f_publishing_visibility");
28
61
  const usernameEl = document.getElementById("f_publishing_username").parentElement;