@bigbinary/neeto-redirect-urls-frontend 2.2.9 → 2.2.10
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/app/javascript/src/translations/de.json +54 -0
- package/app/javascript/src/translations/en.json +2 -1
- package/app/javascript/src/translations/es.json +54 -0
- package/app/javascript/src/translations/fr.json +54 -0
- package/dist/RedirectUrls.js +158 -109
- package/dist/RedirectUrls.js.map +1 -1
- package/dist/cjs/RedirectUrls.js +159 -110
- package/dist/cjs/RedirectUrls.js.map +1 -1
- package/dist/cjs/index.js +4 -4
- package/dist/index.js +4 -4
- package/package.json +9 -9
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"neetoRedirectUrls": {
|
|
3
|
+
"titles": {
|
|
4
|
+
"dashboard": "Dashboard"
|
|
5
|
+
},
|
|
6
|
+
"common": {
|
|
7
|
+
"delete": "Löschen",
|
|
8
|
+
"edit": "Bearbeiten",
|
|
9
|
+
"placeholder": {
|
|
10
|
+
"relativeUrl": "/articles/welcome",
|
|
11
|
+
"url": "https://example.com"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"settings": {
|
|
15
|
+
"title": "Admin-Panel",
|
|
16
|
+
"redirecturl": {
|
|
17
|
+
"title": "Weiterleitungs-URLs",
|
|
18
|
+
"description": "Weiterleitungs-URLs anzeigen und verwalten"
|
|
19
|
+
},
|
|
20
|
+
"general": {
|
|
21
|
+
"title": "Allgemein"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"emptyState": {
|
|
25
|
+
"redirectURLs": {
|
|
26
|
+
"title": "Es gibt keine Weiterleitungs-URLs anzuzeigen.",
|
|
27
|
+
"description": "Hier ist, wie Sie <helpLink>Weiterleitungs-URLs</helpLink> erstellen können."
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"alerts": {
|
|
31
|
+
"delete": {
|
|
32
|
+
"title": "Weiterleitungs-URL löschen?",
|
|
33
|
+
"confirm": "Sie löschen die Weiterleitung von <strong>{{ from_path }}</strong> zu <strong>{{ to_path }}</strong> dauerhaft. Dies kann nicht rückgängig gemacht werden."
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"redirect": {
|
|
37
|
+
"source": "Quelle",
|
|
38
|
+
"destination": "Ziel",
|
|
39
|
+
"add": "Neue Weiterleitungs-URL hinzufügen",
|
|
40
|
+
"edit": "Weiterleitungs-URL bearbeiten",
|
|
41
|
+
"search": "Weiterleitungs-URL suchen",
|
|
42
|
+
"domainLevelRedirect": {
|
|
43
|
+
"label": "Domainebene-Weiterleitung hinzufügen",
|
|
44
|
+
"description": "Dieses Feature ermöglicht es Ihnen, alle Ihre {{entity}} URLs von {{app, anyCase}} auf eine neue Domain umzuleiten. <Link>Hilfeartikel anzeigen</Link> für weitere Informationen."
|
|
45
|
+
},
|
|
46
|
+
"validations": {
|
|
47
|
+
"source": "Der Quellpfad muss gültig sein",
|
|
48
|
+
"destination": "Die Ziel-URL muss gültig sein",
|
|
49
|
+
"required": "{{entity}} ist erforderlich",
|
|
50
|
+
"duplicateDomain": "Die gleiche Domain kann nicht für die Weiterleitung verwendet werden"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"source": "Source path must be valid",
|
|
48
48
|
"destination": "Destination url must be valid",
|
|
49
49
|
"required": "{{entity}} is required",
|
|
50
|
-
"duplicateDomain": "Cannot use same domain for redirection"
|
|
50
|
+
"duplicateDomain": "Cannot use same domain for redirection",
|
|
51
|
+
"samePaths": "Source and destination paths cannot be the same"
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"neetoRedirectUrls": {
|
|
3
|
+
"titles": {
|
|
4
|
+
"dashboard": "Tablero"
|
|
5
|
+
},
|
|
6
|
+
"common": {
|
|
7
|
+
"delete": "Eliminar",
|
|
8
|
+
"edit": "Editar",
|
|
9
|
+
"placeholder": {
|
|
10
|
+
"relativeUrl": "/articles/welcome",
|
|
11
|
+
"url": "https://example.com"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"settings": {
|
|
15
|
+
"title": "Panel de administración",
|
|
16
|
+
"redirecturl": {
|
|
17
|
+
"title": "URLs de redirección",
|
|
18
|
+
"description": "Ver y gestionar URLs de redirección"
|
|
19
|
+
},
|
|
20
|
+
"general": {
|
|
21
|
+
"title": "General"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"emptyState": {
|
|
25
|
+
"redirectURLs": {
|
|
26
|
+
"title": "No hay URLs de redirección para mostrar.",
|
|
27
|
+
"description": "Así es como puedes crear <helpLink>URLs de redirección</helpLink>."
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"alerts": {
|
|
31
|
+
"delete": {
|
|
32
|
+
"title": "¿Eliminar URL de redirección?",
|
|
33
|
+
"confirm": "Estás eliminando permanentemente la redirección de <strong>{{ from_path }}</strong> a <strong>{{ to_path }}</strong>. Esto no se puede deshacer."
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"redirect": {
|
|
37
|
+
"source": "Fuente",
|
|
38
|
+
"destination": "Destino",
|
|
39
|
+
"add": "Agregar nueva URL de redirección",
|
|
40
|
+
"edit": "Editar URL de redirección",
|
|
41
|
+
"search": "Buscar URL de redirección",
|
|
42
|
+
"domainLevelRedirect": {
|
|
43
|
+
"label": "Agregar redirección a nivel de dominio",
|
|
44
|
+
"description": "Esta función te permite redirigir todas tus URLs de {{entity}} de {{app, anyCase}} a un nuevo dominio. <Link>Ver artículo de ayuda</Link> para más información."
|
|
45
|
+
},
|
|
46
|
+
"validations": {
|
|
47
|
+
"source": "La ruta de la fuente debe ser válida",
|
|
48
|
+
"destination": "La URL de destino debe ser válida",
|
|
49
|
+
"required": "{{entity}} es requerido",
|
|
50
|
+
"duplicateDomain": "No se puede usar el mismo dominio para la redirección"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"neetoRedirectUrls": {
|
|
3
|
+
"titles": {
|
|
4
|
+
"dashboard": "Tableau de bord"
|
|
5
|
+
},
|
|
6
|
+
"common": {
|
|
7
|
+
"delete": "Supprimer",
|
|
8
|
+
"edit": "Modifier",
|
|
9
|
+
"placeholder": {
|
|
10
|
+
"relativeUrl": "/articles/welcome",
|
|
11
|
+
"url": "https://example.com"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"settings": {
|
|
15
|
+
"title": "Panneau d'administration",
|
|
16
|
+
"redirecturl": {
|
|
17
|
+
"title": "URLs de redirection",
|
|
18
|
+
"description": "Voir et gérer les URL de redirection"
|
|
19
|
+
},
|
|
20
|
+
"general": {
|
|
21
|
+
"title": "Général"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"emptyState": {
|
|
25
|
+
"redirectURLs": {
|
|
26
|
+
"title": "Il n'y a pas d'URLs de redirection à afficher.",
|
|
27
|
+
"description": "Voici comment vous pouvez créer <helpLink>des URLs de redirection</helpLink>."
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"alerts": {
|
|
31
|
+
"delete": {
|
|
32
|
+
"title": "Supprimer l'URL de redirection ?",
|
|
33
|
+
"confirm": "Vous êtes en train de supprimer définitivement la redirection de <strong>{{ from_path }}</strong> à <strong>{{ to_path }}</strong>. Cela ne peut pas être annulé."
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"redirect": {
|
|
37
|
+
"source": "Source",
|
|
38
|
+
"destination": "Destination",
|
|
39
|
+
"add": "Ajouter une nouvelle URL de redirection",
|
|
40
|
+
"edit": "Modifier l'URL de redirection",
|
|
41
|
+
"search": "Rechercher l'URL de redirection",
|
|
42
|
+
"domainLevelRedirect": {
|
|
43
|
+
"label": "Ajouter une redirection au niveau du domaine",
|
|
44
|
+
"description": "Cette fonctionnalité vous permet de rediriger toutes vos URL {{entity}} de {{app, anyCase}} vers un nouveau domaine. <Link>Voir l'article d'aide</Link> pour plus d'informations."
|
|
45
|
+
},
|
|
46
|
+
"validations": {
|
|
47
|
+
"source": "Le chemin source doit être valide",
|
|
48
|
+
"destination": "L'URL de destination doit être valide",
|
|
49
|
+
"required": "{{entity}} est requis",
|
|
50
|
+
"duplicateDomain": "Impossible d'utiliser le même domaine pour la redirection"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
package/dist/RedirectUrls.js
CHANGED
|
@@ -3,6 +3,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
3
3
|
import { useState, useEffect, useRef } from 'react';
|
|
4
4
|
import { noop, isPresent } from '@bigbinary/neeto-cist';
|
|
5
5
|
import { useMutationWithInvalidation, useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
6
|
+
import { buildUrl, showThumbsUpToastr } from '@bigbinary/neeto-commons-frontend/utils';
|
|
6
7
|
import Container from '@bigbinary/neeto-molecules/Container';
|
|
7
8
|
import Header from '@bigbinary/neeto-molecules/Header';
|
|
8
9
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
@@ -17,7 +18,10 @@ import Typography from '@bigbinary/neetoui/Typography';
|
|
|
17
18
|
import Input from '@bigbinary/neetoui/formik/Input';
|
|
18
19
|
import Form from '@bigbinary/neetoui/formik/Form';
|
|
19
20
|
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
20
|
-
import
|
|
21
|
+
import { t } from 'i18next';
|
|
22
|
+
import { VALID_URL_REGEX, DEFAULT_PAGE_SIZE } from '@bigbinary/neeto-commons-frontend/constants';
|
|
23
|
+
import * as yup from 'yup';
|
|
24
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
21
25
|
import { useQuery } from '@tanstack/react-query';
|
|
22
26
|
import axios from 'axios';
|
|
23
27
|
import Edit from '@bigbinary/neeto-icons/Edit';
|
|
@@ -25,13 +29,9 @@ import CardLayout from '@bigbinary/neeto-molecules/CardLayout';
|
|
|
25
29
|
import { FormikInlineInput } from '@bigbinary/neeto-molecules/InlineInput';
|
|
26
30
|
import Label from '@bigbinary/neetoui/Label';
|
|
27
31
|
import Switch from '@bigbinary/neetoui/formik/Switch';
|
|
28
|
-
import { t } from 'i18next';
|
|
29
|
-
import { DEFAULT_PAGE_SIZE } from '@bigbinary/neeto-commons-frontend/constants';
|
|
30
32
|
import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
31
33
|
import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
|
|
32
34
|
import Table from '@bigbinary/neetoui/Table';
|
|
33
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
34
|
-
import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
35
35
|
|
|
36
36
|
var DeleteRedirectUrlModal = function DeleteRedirectUrlModal(_ref) {
|
|
37
37
|
var handleClose = _ref.handleClose,
|
|
@@ -63,9 +63,21 @@ var DeleteRedirectUrlModal = function DeleteRedirectUrlModal(_ref) {
|
|
|
63
63
|
});
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
var URL_WITH_PROTOCOL_REGEX = /^(http(s)?):\/\/[(www.)?a-zA-Z0-9@:%._+~#=-]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)$/g;
|
|
67
66
|
var URL_PATHNAME_REGEX = /^\/[-a-zA-Z0-9@:%_+.~#?&//=]*$/g;
|
|
68
67
|
|
|
68
|
+
var REDIRECT_URL_VALIDATION_SCHEMA = yup.object().shape({
|
|
69
|
+
fromPath: yup.string().required(t("neetoRedirectUrls.redirect.validations.required", {
|
|
70
|
+
entity: "Source"
|
|
71
|
+
})).matches(URL_PATHNAME_REGEX, t("neetoRedirectUrls.redirect.validations.source")),
|
|
72
|
+
toPath: yup.string().required(t("neetoRedirectUrls.redirect.validations.required", {
|
|
73
|
+
entity: "Destination"
|
|
74
|
+
})).matches(new RegExp("".concat(VALID_URL_REGEX.source, "|").concat(URL_PATHNAME_REGEX.source)), t("neetoRedirectUrls.redirect.validations.destination")).test("paths-not-same", t("neetoRedirectUrls.redirect.validations.samePaths"), function (value, context) {
|
|
75
|
+
var fromPath = context.parent.fromPath;
|
|
76
|
+
if (!value || !fromPath) return true;
|
|
77
|
+
return value !== fromPath;
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
|
|
69
81
|
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
70
82
|
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
71
83
|
var RedirectUrlPane = function RedirectUrlPane(_ref) {
|
|
@@ -90,16 +102,9 @@ var RedirectUrlPane = function RedirectUrlPane(_ref) {
|
|
|
90
102
|
fromPath: "",
|
|
91
103
|
toPath: ""
|
|
92
104
|
},
|
|
93
|
-
validationSchema:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
})).matches(URL_PATHNAME_REGEX, t("neetoRedirectUrls.redirect.validations.source")),
|
|
97
|
-
toPath: Yup.string().required(t("neetoRedirectUrls.redirect.validations.required", {
|
|
98
|
-
entity: "Destination"
|
|
99
|
-
})).matches(new RegExp("".concat(URL_WITH_PROTOCOL_REGEX.source, "|").concat(URL_PATHNAME_REGEX.source)), t("neetoRedirectUrls.redirect.validations.destination"))
|
|
100
|
-
}),
|
|
101
|
-
onSubmit: function onSubmit(values) {
|
|
102
|
-
handleSubmit(_objectSpread$2({}, values));
|
|
105
|
+
validationSchema: REDIRECT_URL_VALIDATION_SCHEMA,
|
|
106
|
+
onSubmit: function onSubmit(values, formikBag) {
|
|
107
|
+
handleSubmit(_objectSpread$2({}, values), formikBag);
|
|
103
108
|
}
|
|
104
109
|
},
|
|
105
110
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -133,6 +138,89 @@ var RedirectUrlPane = function RedirectUrlPane(_ref) {
|
|
|
133
138
|
});
|
|
134
139
|
};
|
|
135
140
|
|
|
141
|
+
var SETTINGS_CATEGORIES = {
|
|
142
|
+
GENERAL: "GENERAL"
|
|
143
|
+
};
|
|
144
|
+
var SETTINGS_CATEGORIES_LABELS = _defineProperty({}, SETTINGS_CATEGORIES.GENERAL, t("neetoRedirectUrls.settings.general.title"));
|
|
145
|
+
var SHOW_TOASTR_CONFIG = {
|
|
146
|
+
showToastr: false
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
var routes = {
|
|
150
|
+
admin: {
|
|
151
|
+
index: "/admin",
|
|
152
|
+
courses: {
|
|
153
|
+
chapters: {
|
|
154
|
+
show: "/admin/courses/:courseId/chapters/:chapterId",
|
|
155
|
+
chapterVersions: {
|
|
156
|
+
show: "/admin/courses/:courseId/chapters/:chapterId/chapter-versions/:chapterVersionId"
|
|
157
|
+
},
|
|
158
|
+
pages: {
|
|
159
|
+
show: "/admin/courses/:courseId/chapters/:chapterId/pages/:pageId",
|
|
160
|
+
pageVersions: {
|
|
161
|
+
show: "/admin/courses/:courseId/chapters/:chapterId/pages/:pageId/page-versions/:pageVersionId"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
index: "/admin/courses",
|
|
166
|
+
show: "/admin/courses/:courseId",
|
|
167
|
+
deployments: {
|
|
168
|
+
index: "/admin/courses/:courseId/deployments",
|
|
169
|
+
show: "/admin/courses/:courseId/deployments/:deploymentId"
|
|
170
|
+
},
|
|
171
|
+
configure: {
|
|
172
|
+
index: "/admin/courses/:courseId/configure",
|
|
173
|
+
security: "/admin/courses/:courseId/configure/security",
|
|
174
|
+
certificateConfiguration: "/admin/courses/:courseId/configure/certificate_configuration"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
pullRequestApps: {
|
|
178
|
+
index: "/admin/pull_request_apps",
|
|
179
|
+
show: "/admin/pull_request_apps/:pullRequestAppId",
|
|
180
|
+
courseDeployments: {
|
|
181
|
+
show: "/admin/pull_request_apps/:pullRequestAppId/course-deployments/:courseDeploymentId"
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
members: "/admin/members",
|
|
185
|
+
adminPanel: "/admin/admin-panel",
|
|
186
|
+
reports: {
|
|
187
|
+
index: "/admin/reports",
|
|
188
|
+
invalidUrls: "/admin/reports/invalid-urls"
|
|
189
|
+
},
|
|
190
|
+
assets: {
|
|
191
|
+
index: "/admin/assets",
|
|
192
|
+
databases: "/admin/assets/databases",
|
|
193
|
+
videos: "/admin/assets/videos",
|
|
194
|
+
audios: "/admin/assets/audios",
|
|
195
|
+
resources: "/admin/assets/resources"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
home: "/"
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
var buildSettingsBreadcrumbs = function buildSettingsBreadcrumbs(category, pageTitle) {
|
|
202
|
+
return [{
|
|
203
|
+
link: routes.admin.adminPanel,
|
|
204
|
+
text: t("neetoRedirectUrls.settings.title")
|
|
205
|
+
}, {
|
|
206
|
+
link: buildUrl(routes.admin.adminPanel, {
|
|
207
|
+
category: category.toLowerCase()
|
|
208
|
+
}),
|
|
209
|
+
text: SETTINGS_CATEGORIES_LABELS[category]
|
|
210
|
+
}].concat(_toConsumableArray(pageTitle ? [{
|
|
211
|
+
text: pageTitle
|
|
212
|
+
}] : []));
|
|
213
|
+
};
|
|
214
|
+
var normalizeURL = function normalizeURL(url) {
|
|
215
|
+
return url ? url.replace(/\/+$/, "") : "";
|
|
216
|
+
};
|
|
217
|
+
var handleError = function handleError(setStatus, error) {
|
|
218
|
+
var response = error.response;
|
|
219
|
+
if (response && response.data && response.data.errors) {
|
|
220
|
+
setStatus(response.data.errors);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
|
|
136
224
|
var REDIRECT_URLS_BASE_URL = "/neeto_redirect_urls_engine/api/v1/redirect_urls";
|
|
137
225
|
|
|
138
226
|
var fetch = function fetch() {
|
|
@@ -141,13 +229,16 @@ var fetch = function fetch() {
|
|
|
141
229
|
var fetchAll = function fetchAll(params) {
|
|
142
230
|
return axios.get(REDIRECT_URLS_BASE_URL, params);
|
|
143
231
|
};
|
|
144
|
-
var create = function create(
|
|
145
|
-
|
|
232
|
+
var create = function create(_ref) {
|
|
233
|
+
var payload = _ref.payload,
|
|
234
|
+
config = _ref.config;
|
|
235
|
+
return axios.post(REDIRECT_URLS_BASE_URL, payload, config);
|
|
146
236
|
};
|
|
147
|
-
var update = function update(
|
|
148
|
-
var id =
|
|
149
|
-
payload =
|
|
150
|
-
|
|
237
|
+
var update = function update(_ref2) {
|
|
238
|
+
var id = _ref2.id,
|
|
239
|
+
payload = _ref2.payload,
|
|
240
|
+
config = _ref2.config;
|
|
241
|
+
return axios.put("".concat(REDIRECT_URLS_BASE_URL, "/").concat(id), payload, config);
|
|
151
242
|
};
|
|
152
243
|
var destroy = function destroy(id) {
|
|
153
244
|
return axios["delete"]("".concat(REDIRECT_URLS_BASE_URL, "/").concat(id));
|
|
@@ -194,18 +285,22 @@ var DOC_BASE_URL = "https://help.".concat(globalProps.appName.toLowerCase(), ".c
|
|
|
194
285
|
var CREATE_REDIRECT_URL_HELP_DOC_URL = "".concat(DOC_BASE_URL, "/creating-a-redirect-url");
|
|
195
286
|
var DOMAIN_LEVEL_REDIRECT_HELP_DOC_URL = "".concat(DOC_BASE_URL, "/domain-level-redirection");
|
|
196
287
|
|
|
197
|
-
var DOMAIN_REDIRECTION_VALIDATION_SCHEMA =
|
|
198
|
-
toPath:
|
|
288
|
+
var DOMAIN_REDIRECTION_VALIDATION_SCHEMA = yup.object().shape({
|
|
289
|
+
toPath: yup.string().nullable().when("domainRedirectionActive", {
|
|
199
290
|
is: true,
|
|
200
|
-
then:
|
|
291
|
+
then: yup.string().required(t("neetoRedirectUrls.redirect.validations.required", {
|
|
201
292
|
entity: "Destination"
|
|
202
|
-
})).matches(
|
|
293
|
+
})).matches(VALID_URL_REGEX, t("neetoRedirectUrls.redirect.validations.destination")).test("not-duplicate-domain", t("neetoRedirectUrls.redirect.validations.duplicateDomain"), function (value) {
|
|
294
|
+
if (!value) return true;
|
|
295
|
+
return normalizeURL(value) !== normalizeURL(location.origin);
|
|
296
|
+
})
|
|
203
297
|
})
|
|
204
298
|
});
|
|
205
299
|
|
|
206
300
|
var DomainRedirection = function DomainRedirection(_ref) {
|
|
207
301
|
var domainRedirectUrl = _ref.domainRedirectUrl,
|
|
208
|
-
entity = _ref.entity
|
|
302
|
+
entity = _ref.entity,
|
|
303
|
+
helpDocUrls = _ref.helpDocUrls;
|
|
209
304
|
var _useState = useState(true),
|
|
210
305
|
_useState2 = _slicedToArray(_useState, 2),
|
|
211
306
|
isEditingDomainRedirect = _useState2[0],
|
|
@@ -230,7 +325,9 @@ var DomainRedirection = function DomainRedirection(_ref) {
|
|
|
230
325
|
return domainRedirectUrl ? updateLink({
|
|
231
326
|
id: domainRedirectUrl.id,
|
|
232
327
|
payload: payload
|
|
233
|
-
}) : createLink(
|
|
328
|
+
}) : createLink({
|
|
329
|
+
payload: payload
|
|
330
|
+
});
|
|
234
331
|
};
|
|
235
332
|
var handleRemoveRedirection = function handleRemoveRedirection(domainLinkActive) {
|
|
236
333
|
if (!(domainLinkActive && domainRedirectUrl)) {
|
|
@@ -289,9 +386,9 @@ var DomainRedirection = function DomainRedirection(_ref) {
|
|
|
289
386
|
Link: /*#__PURE__*/jsx(Button, {
|
|
290
387
|
className: "text-sm",
|
|
291
388
|
"data-cy": "domain-level-redirections-help-button",
|
|
292
|
-
href: DOMAIN_LEVEL_REDIRECT_HELP_DOC_URL,
|
|
293
389
|
style: "link",
|
|
294
|
-
target: "_blank"
|
|
390
|
+
target: "_blank",
|
|
391
|
+
href: helpDocUrls.domainLevelRedirectUrl || DOMAIN_LEVEL_REDIRECT_HELP_DOC_URL
|
|
295
392
|
})
|
|
296
393
|
}
|
|
297
394
|
})
|
|
@@ -332,77 +429,6 @@ var DomainRedirection = function DomainRedirection(_ref) {
|
|
|
332
429
|
});
|
|
333
430
|
};
|
|
334
431
|
|
|
335
|
-
var SETTINGS_CATEGORIES = {
|
|
336
|
-
GENERAL: "GENERAL"
|
|
337
|
-
};
|
|
338
|
-
var SETTINGS_CATEGORIES_LABELS = _defineProperty({}, SETTINGS_CATEGORIES.GENERAL, t("neetoRedirectUrls.settings.general.title"));
|
|
339
|
-
|
|
340
|
-
var routes = {
|
|
341
|
-
admin: {
|
|
342
|
-
index: "/admin",
|
|
343
|
-
courses: {
|
|
344
|
-
chapters: {
|
|
345
|
-
show: "/admin/courses/:courseId/chapters/:chapterId",
|
|
346
|
-
chapterVersions: {
|
|
347
|
-
show: "/admin/courses/:courseId/chapters/:chapterId/chapter-versions/:chapterVersionId"
|
|
348
|
-
},
|
|
349
|
-
pages: {
|
|
350
|
-
show: "/admin/courses/:courseId/chapters/:chapterId/pages/:pageId",
|
|
351
|
-
pageVersions: {
|
|
352
|
-
show: "/admin/courses/:courseId/chapters/:chapterId/pages/:pageId/page-versions/:pageVersionId"
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
},
|
|
356
|
-
index: "/admin/courses",
|
|
357
|
-
show: "/admin/courses/:courseId",
|
|
358
|
-
deployments: {
|
|
359
|
-
index: "/admin/courses/:courseId/deployments",
|
|
360
|
-
show: "/admin/courses/:courseId/deployments/:deploymentId"
|
|
361
|
-
},
|
|
362
|
-
configure: {
|
|
363
|
-
index: "/admin/courses/:courseId/configure",
|
|
364
|
-
security: "/admin/courses/:courseId/configure/security",
|
|
365
|
-
certificateConfiguration: "/admin/courses/:courseId/configure/certificate_configuration"
|
|
366
|
-
}
|
|
367
|
-
},
|
|
368
|
-
pullRequestApps: {
|
|
369
|
-
index: "/admin/pull_request_apps",
|
|
370
|
-
show: "/admin/pull_request_apps/:pullRequestAppId",
|
|
371
|
-
courseDeployments: {
|
|
372
|
-
show: "/admin/pull_request_apps/:pullRequestAppId/course-deployments/:courseDeploymentId"
|
|
373
|
-
}
|
|
374
|
-
},
|
|
375
|
-
members: "/admin/members",
|
|
376
|
-
adminPanel: "/admin/admin-panel",
|
|
377
|
-
reports: {
|
|
378
|
-
index: "/admin/reports",
|
|
379
|
-
invalidUrls: "/admin/reports/invalid-urls"
|
|
380
|
-
},
|
|
381
|
-
assets: {
|
|
382
|
-
index: "/admin/assets",
|
|
383
|
-
databases: "/admin/assets/databases",
|
|
384
|
-
videos: "/admin/assets/videos",
|
|
385
|
-
audios: "/admin/assets/audios",
|
|
386
|
-
resources: "/admin/assets/resources"
|
|
387
|
-
}
|
|
388
|
-
},
|
|
389
|
-
home: "/"
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
var buildSettingsBreadcrumbs = function buildSettingsBreadcrumbs(category, pageTitle) {
|
|
393
|
-
return [{
|
|
394
|
-
link: routes.admin.adminPanel,
|
|
395
|
-
text: t("neetoRedirectUrls.settings.title")
|
|
396
|
-
}, {
|
|
397
|
-
link: buildUrl(routes.admin.adminPanel, {
|
|
398
|
-
category: category.toLowerCase()
|
|
399
|
-
}),
|
|
400
|
-
text: SETTINGS_CATEGORIES_LABELS[category]
|
|
401
|
-
}].concat(_toConsumableArray(pageTitle ? [{
|
|
402
|
-
text: pageTitle
|
|
403
|
-
}] : []));
|
|
404
|
-
};
|
|
405
|
-
|
|
406
432
|
var buildBreadcrumbs = function buildBreadcrumbs(pageTitle) {
|
|
407
433
|
return buildSettingsBreadcrumbs(SETTINGS_CATEGORIES.GENERAL, pageTitle);
|
|
408
434
|
};
|
|
@@ -506,7 +532,9 @@ var RedirectUrlsTable = function RedirectUrlsTable(_ref) {
|
|
|
506
532
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
507
533
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
508
534
|
var RedirectUrls = function RedirectUrls(_ref) {
|
|
509
|
-
var entity = _ref.entity
|
|
535
|
+
var entity = _ref.entity,
|
|
536
|
+
_ref$helpDocUrls = _ref.helpDocUrls,
|
|
537
|
+
helpDocUrls = _ref$helpDocUrls === void 0 ? {} : _ref$helpDocUrls;
|
|
510
538
|
var _useTranslation = useTranslation(),
|
|
511
539
|
t = _useTranslation.t;
|
|
512
540
|
var _useQueryParams = useQueryParams(),
|
|
@@ -551,18 +579,38 @@ var RedirectUrls = function RedirectUrls(_ref) {
|
|
|
551
579
|
updateRedirectUrl = _useUpdateRedirectUrl.mutate;
|
|
552
580
|
var _useDestroyRedirectUr = useDestroyRedirectUrl(),
|
|
553
581
|
deleteRedirectUrl = _useDestroyRedirectUr.mutate;
|
|
554
|
-
var handleCreateRedirectUrl = function handleCreateRedirectUrl(redirectUrl) {
|
|
555
|
-
|
|
582
|
+
var handleCreateRedirectUrl = function handleCreateRedirectUrl(redirectUrl, _ref2) {
|
|
583
|
+
var setSubmitting = _ref2.setSubmitting,
|
|
584
|
+
setStatus = _ref2.setStatus;
|
|
585
|
+
createRedirectUrl({
|
|
586
|
+
payload: redirectUrl,
|
|
587
|
+
config: SHOW_TOASTR_CONFIG
|
|
588
|
+
}, {
|
|
589
|
+
onError: function onError(error) {
|
|
590
|
+
handleError(setStatus, error);
|
|
591
|
+
setSubmitting(false);
|
|
592
|
+
},
|
|
556
593
|
onSuccess: function onSuccess() {
|
|
594
|
+
showThumbsUpToastr();
|
|
557
595
|
setIsModalOpen(false);
|
|
558
596
|
}
|
|
559
597
|
});
|
|
560
598
|
};
|
|
561
|
-
var handleRedirectUrlUpdate = function handleRedirectUrlUpdate(redirectUrl) {
|
|
599
|
+
var handleRedirectUrlUpdate = function handleRedirectUrlUpdate(redirectUrl, _ref3) {
|
|
600
|
+
var setSubmitting = _ref3.setSubmitting,
|
|
601
|
+
setStatus = _ref3.setStatus;
|
|
562
602
|
updateRedirectUrl({
|
|
563
603
|
id: redirectUrl.id,
|
|
564
|
-
payload: redirectUrl
|
|
604
|
+
payload: redirectUrl,
|
|
605
|
+
config: SHOW_TOASTR_CONFIG
|
|
565
606
|
}, {
|
|
607
|
+
onError: function onError(error) {
|
|
608
|
+
handleError(setStatus, error);
|
|
609
|
+
setSubmitting(false);
|
|
610
|
+
},
|
|
611
|
+
onSuccess: function onSuccess() {
|
|
612
|
+
showThumbsUpToastr();
|
|
613
|
+
},
|
|
566
614
|
onSettled: function onSettled() {
|
|
567
615
|
setUrlDetailsToEdit(null);
|
|
568
616
|
}
|
|
@@ -604,9 +652,9 @@ var RedirectUrls = function RedirectUrls(_ref) {
|
|
|
604
652
|
i18nKey: "neetoRedirectUrls.emptyState.redirectURLs.description",
|
|
605
653
|
components: {
|
|
606
654
|
helpLink: /*#__PURE__*/jsx(Button, {
|
|
607
|
-
href: CREATE_REDIRECT_URL_HELP_DOC_URL,
|
|
608
655
|
style: "link",
|
|
609
|
-
target: "_blank"
|
|
656
|
+
target: "_blank",
|
|
657
|
+
href: helpDocUrls.createRedirectUrl || CREATE_REDIRECT_URL_HELP_DOC_URL
|
|
610
658
|
})
|
|
611
659
|
}
|
|
612
660
|
}),
|
|
@@ -622,7 +670,8 @@ var RedirectUrls = function RedirectUrls(_ref) {
|
|
|
622
670
|
className: "w-full",
|
|
623
671
|
children: /*#__PURE__*/jsx(DomainRedirection, {
|
|
624
672
|
domainRedirectUrl: domainRedirectUrl,
|
|
625
|
-
entity: entity
|
|
673
|
+
entity: entity,
|
|
674
|
+
helpDocUrls: helpDocUrls
|
|
626
675
|
})
|
|
627
676
|
}), /*#__PURE__*/jsx(RedirectUrlsTable, {
|
|
628
677
|
currentPageNumber: currentPageNumber,
|