@orange-soft/strapi-deployment-trigger 1.1.0 → 1.1.2
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/admin/src/pages/HomePage.jsx +8 -1
- package/admin/src/pages/SettingsPage.jsx +7 -7
- package/dist/_chunks/{App-CuSCtdH7.js → App-CCbQMMHR.js} +11 -8
- package/dist/_chunks/{App-vakyp6FE.mjs → App-DRqMK_8x.mjs} +12 -9
- package/dist/_chunks/{index-DGatQB-9.js → index-SuWmJtOE.js} +1 -1
- package/dist/_chunks/{index-CZWWYGR3.mjs → index-vQ0KWcpU.mjs} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +4 -0
- package/dist/server/index.mjs +4 -0
- package/package.json +1 -1
- package/server/src/services/service.js +8 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {useState, useEffect} from 'react';
|
|
2
2
|
import {useIntl} from 'react-intl';
|
|
3
3
|
import {Layouts, useFetchClient} from '@strapi/strapi/admin';
|
|
4
|
-
import {Link} from 'react-router-dom';
|
|
4
|
+
import {Link, useLocation} from 'react-router-dom';
|
|
5
5
|
import {
|
|
6
6
|
Box,
|
|
7
7
|
Button,
|
|
@@ -24,6 +24,7 @@ import {getTranslation} from '../utils/getTranslation';
|
|
|
24
24
|
const HomePage = () => {
|
|
25
25
|
const {formatMessage} = useIntl();
|
|
26
26
|
const {get, post} = useFetchClient();
|
|
27
|
+
const location = useLocation();
|
|
27
28
|
const [status, setStatus] = useState(null);
|
|
28
29
|
const [loading, setLoading] = useState(true);
|
|
29
30
|
const [deployingTargetId, setDeployingTargetId] = useState(null);
|
|
@@ -31,6 +32,12 @@ const HomePage = () => {
|
|
|
31
32
|
|
|
32
33
|
useEffect(() => {
|
|
33
34
|
fetchStatus();
|
|
35
|
+
// Check for notification from navigation state (e.g., after saving settings)
|
|
36
|
+
if (location.state?.notification) {
|
|
37
|
+
setNotification(location.state.notification);
|
|
38
|
+
// Clear the state so notification doesn't reappear on refresh
|
|
39
|
+
window.history.replaceState({}, document.title);
|
|
40
|
+
}
|
|
34
41
|
}, []);
|
|
35
42
|
|
|
36
43
|
const fetchStatus = async () => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useNavigate } from 'react-router-dom';
|
|
2
3
|
import { useFetchClient, Layouts, BackButton } from '@strapi/strapi/admin';
|
|
3
4
|
import {
|
|
4
5
|
Box,
|
|
@@ -52,6 +53,7 @@ const validateWorkflow = (value) => {
|
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
const SettingsPage = () => {
|
|
56
|
+
const navigate = useNavigate();
|
|
55
57
|
const { get, put, post, del } = useFetchClient();
|
|
56
58
|
const [settings, setSettings] = useState({
|
|
57
59
|
githubToken: '',
|
|
@@ -122,17 +124,15 @@ const SettingsPage = () => {
|
|
|
122
124
|
|
|
123
125
|
const { data } = await put(`/${PLUGIN_ID}/settings`, { data: dataToSave });
|
|
124
126
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
setSettings(prev => ({ ...prev, githubToken: '' }));
|
|
130
|
-
setNotification({ type: 'success', message: 'Settings saved successfully' });
|
|
127
|
+
// Redirect to main page on success with notification
|
|
128
|
+
navigate(`/plugins/${PLUGIN_ID}`, {
|
|
129
|
+
state: { notification: { type: 'success', message: 'Settings saved successfully' } }
|
|
130
|
+
});
|
|
131
131
|
} catch (error) {
|
|
132
132
|
console.error('Error saving settings:', error);
|
|
133
133
|
setNotification({ type: 'danger', message: 'Failed to save settings' });
|
|
134
|
+
setSaving(false);
|
|
134
135
|
}
|
|
135
|
-
setSaving(false);
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
const handleChange = (field) => (e) => {
|
|
@@ -7,17 +7,22 @@ const react = require("react");
|
|
|
7
7
|
const reactIntl = require("react-intl");
|
|
8
8
|
const designSystem = require("@strapi/design-system");
|
|
9
9
|
const icons = require("@strapi/icons");
|
|
10
|
-
const index = require("./index-
|
|
10
|
+
const index = require("./index-SuWmJtOE.js");
|
|
11
11
|
const getTranslation = (id) => `${index.PLUGIN_ID}.${id}`;
|
|
12
12
|
const HomePage = () => {
|
|
13
13
|
const { formatMessage } = reactIntl.useIntl();
|
|
14
14
|
const { get, post } = admin.useFetchClient();
|
|
15
|
+
const location = reactRouterDom.useLocation();
|
|
15
16
|
const [status, setStatus] = react.useState(null);
|
|
16
17
|
const [loading, setLoading] = react.useState(true);
|
|
17
18
|
const [deployingTargetId, setDeployingTargetId] = react.useState(null);
|
|
18
19
|
const [notification, setNotification] = react.useState(null);
|
|
19
20
|
react.useEffect(() => {
|
|
20
21
|
fetchStatus();
|
|
22
|
+
if (location.state?.notification) {
|
|
23
|
+
setNotification(location.state.notification);
|
|
24
|
+
window.history.replaceState({}, document.title);
|
|
25
|
+
}
|
|
21
26
|
}, []);
|
|
22
27
|
const fetchStatus = async () => {
|
|
23
28
|
try {
|
|
@@ -228,6 +233,7 @@ const validateWorkflow = (value) => {
|
|
|
228
233
|
return null;
|
|
229
234
|
};
|
|
230
235
|
const SettingsPage = () => {
|
|
236
|
+
const navigate = reactRouterDom.useNavigate();
|
|
231
237
|
const { get, put, post, del } = admin.useFetchClient();
|
|
232
238
|
const [settings, setSettings] = react.useState({
|
|
233
239
|
githubToken: "",
|
|
@@ -288,17 +294,14 @@ const SettingsPage = () => {
|
|
|
288
294
|
dataToSave.githubToken = settings.githubToken;
|
|
289
295
|
}
|
|
290
296
|
const { data } = await put(`/${index.PLUGIN_ID}/settings`, { data: dataToSave });
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
setSettings((prev) => ({ ...prev, githubToken: "" }));
|
|
296
|
-
setNotification({ type: "success", message: "Settings saved successfully" });
|
|
297
|
+
navigate(`/plugins/${index.PLUGIN_ID}`, {
|
|
298
|
+
state: { notification: { type: "success", message: "Settings saved successfully" } }
|
|
299
|
+
});
|
|
297
300
|
} catch (error) {
|
|
298
301
|
console.error("Error saving settings:", error);
|
|
299
302
|
setNotification({ type: "danger", message: "Failed to save settings" });
|
|
303
|
+
setSaving(false);
|
|
300
304
|
}
|
|
301
|
-
setSaving(false);
|
|
302
305
|
};
|
|
303
306
|
const handleChange = (field) => (e) => {
|
|
304
307
|
const value = e.target.value;
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useFetchClient, Layouts, BackButton, Page } from "@strapi/strapi/admin";
|
|
3
|
-
import { Link, Routes, Route } from "react-router-dom";
|
|
3
|
+
import { useLocation, Link, useNavigate, Routes, Route } from "react-router-dom";
|
|
4
4
|
import { useState, useEffect } from "react";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { Flex, Loader, Button, Box, Alert, Typography, Table, Thead, Tr, Th, Tbody, Td, Field, Grid, IconButton, Dialog } from "@strapi/design-system";
|
|
7
7
|
import { Cog, Rocket, Check, Plus, Pencil, Trash } from "@strapi/icons";
|
|
8
|
-
import { P as PLUGIN_ID } from "./index-
|
|
8
|
+
import { P as PLUGIN_ID } from "./index-vQ0KWcpU.mjs";
|
|
9
9
|
const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
|
|
10
10
|
const HomePage = () => {
|
|
11
11
|
const { formatMessage } = useIntl();
|
|
12
12
|
const { get, post } = useFetchClient();
|
|
13
|
+
const location = useLocation();
|
|
13
14
|
const [status, setStatus] = useState(null);
|
|
14
15
|
const [loading, setLoading] = useState(true);
|
|
15
16
|
const [deployingTargetId, setDeployingTargetId] = useState(null);
|
|
16
17
|
const [notification, setNotification] = useState(null);
|
|
17
18
|
useEffect(() => {
|
|
18
19
|
fetchStatus();
|
|
20
|
+
if (location.state?.notification) {
|
|
21
|
+
setNotification(location.state.notification);
|
|
22
|
+
window.history.replaceState({}, document.title);
|
|
23
|
+
}
|
|
19
24
|
}, []);
|
|
20
25
|
const fetchStatus = async () => {
|
|
21
26
|
try {
|
|
@@ -226,6 +231,7 @@ const validateWorkflow = (value) => {
|
|
|
226
231
|
return null;
|
|
227
232
|
};
|
|
228
233
|
const SettingsPage = () => {
|
|
234
|
+
const navigate = useNavigate();
|
|
229
235
|
const { get, put, post, del } = useFetchClient();
|
|
230
236
|
const [settings, setSettings] = useState({
|
|
231
237
|
githubToken: "",
|
|
@@ -286,17 +292,14 @@ const SettingsPage = () => {
|
|
|
286
292
|
dataToSave.githubToken = settings.githubToken;
|
|
287
293
|
}
|
|
288
294
|
const { data } = await put(`/${PLUGIN_ID}/settings`, { data: dataToSave });
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
setSettings((prev) => ({ ...prev, githubToken: "" }));
|
|
294
|
-
setNotification({ type: "success", message: "Settings saved successfully" });
|
|
295
|
+
navigate(`/plugins/${PLUGIN_ID}`, {
|
|
296
|
+
state: { notification: { type: "success", message: "Settings saved successfully" } }
|
|
297
|
+
});
|
|
295
298
|
} catch (error) {
|
|
296
299
|
console.error("Error saving settings:", error);
|
|
297
300
|
setNotification({ type: "danger", message: "Failed to save settings" });
|
|
301
|
+
setSaving(false);
|
|
298
302
|
}
|
|
299
|
-
setSaving(false);
|
|
300
303
|
};
|
|
301
304
|
const handleChange = (field) => (e) => {
|
|
302
305
|
const value = e.target.value;
|
|
@@ -37,7 +37,7 @@ const index = {
|
|
|
37
37
|
defaultMessage: PLUGIN_ID
|
|
38
38
|
},
|
|
39
39
|
Component: async () => {
|
|
40
|
-
const { App } = await Promise.resolve().then(() => require("./App-
|
|
40
|
+
const { App } = await Promise.resolve().then(() => require("./App-CCbQMMHR.js"));
|
|
41
41
|
return App;
|
|
42
42
|
}
|
|
43
43
|
});
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -268,7 +268,11 @@ const service = ({ strapi }) => ({
|
|
|
268
268
|
async getSettings() {
|
|
269
269
|
const store = strapi.store({ type: "plugin", name: PLUGIN_ID });
|
|
270
270
|
let dbSettings = await store.get({ key: STORE_KEY });
|
|
271
|
+
const needsMigration = dbSettings && !Array.isArray(dbSettings.targets) && (dbSettings.workflow || dbSettings.branch);
|
|
271
272
|
dbSettings = this.migrateSettings(dbSettings);
|
|
273
|
+
if (needsMigration && dbSettings) {
|
|
274
|
+
await store.set({ key: STORE_KEY, value: dbSettings });
|
|
275
|
+
}
|
|
272
276
|
if (!dbSettings) {
|
|
273
277
|
return {
|
|
274
278
|
...DEFAULT_SETTINGS,
|
package/dist/server/index.mjs
CHANGED
|
@@ -267,7 +267,11 @@ const service = ({ strapi }) => ({
|
|
|
267
267
|
async getSettings() {
|
|
268
268
|
const store = strapi.store({ type: "plugin", name: PLUGIN_ID });
|
|
269
269
|
let dbSettings = await store.get({ key: STORE_KEY });
|
|
270
|
+
const needsMigration = dbSettings && !Array.isArray(dbSettings.targets) && (dbSettings.workflow || dbSettings.branch);
|
|
270
271
|
dbSettings = this.migrateSettings(dbSettings);
|
|
272
|
+
if (needsMigration && dbSettings) {
|
|
273
|
+
await store.set({ key: STORE_KEY, value: dbSettings });
|
|
274
|
+
}
|
|
271
275
|
if (!dbSettings) {
|
|
272
276
|
return {
|
|
273
277
|
...DEFAULT_SETTINGS,
|
package/package.json
CHANGED
|
@@ -65,9 +65,17 @@ const service = ({ strapi }) => ({
|
|
|
65
65
|
const store = strapi.store({ type: 'plugin', name: PLUGIN_ID });
|
|
66
66
|
let dbSettings = await store.get({ key: STORE_KEY });
|
|
67
67
|
|
|
68
|
+
// Check if migration is needed (old format has workflow/branch but no targets array)
|
|
69
|
+
const needsMigration = dbSettings && !Array.isArray(dbSettings.targets) && (dbSettings.workflow || dbSettings.branch);
|
|
70
|
+
|
|
68
71
|
// Migrate if needed
|
|
69
72
|
dbSettings = this.migrateSettings(dbSettings);
|
|
70
73
|
|
|
74
|
+
// Persist the migration so IDs remain stable
|
|
75
|
+
if (needsMigration && dbSettings) {
|
|
76
|
+
await store.set({ key: STORE_KEY, value: dbSettings });
|
|
77
|
+
}
|
|
78
|
+
|
|
71
79
|
if (!dbSettings) {
|
|
72
80
|
return {
|
|
73
81
|
...DEFAULT_SETTINGS,
|