strapi-plugin-navigation 1.1.3 → 2.0.0-beta.4
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/README.md +61 -87
- package/admin/src/components/EmptyView/index.js +7 -16
- package/admin/src/components/Item/ItemCardBadge/index.js +8 -0
- package/admin/src/components/Item/ItemCardHeader/Wrapper.js +21 -0
- package/admin/src/components/Item/ItemCardHeader/index.js +59 -0
- package/admin/src/components/Item/Wrapper.js +39 -0
- package/admin/src/components/Item/index.js +78 -124
- package/admin/src/components/NavigationItemList/Wrapper.js +22 -0
- package/admin/src/components/NavigationItemList/index.js +56 -0
- package/admin/src/components/PluginIcon/index.js +6 -0
- package/admin/src/components/Search/index.js +46 -83
- package/admin/src/index.js +49 -45
- package/admin/src/pages/App/index.js +31 -0
- package/admin/src/{containers → pages}/DataManagerProvider/actions.js +0 -0
- package/admin/src/{containers → pages}/DataManagerProvider/index.js +77 -84
- package/admin/src/{containers → pages}/DataManagerProvider/init.js +0 -0
- package/admin/src/pages/DataManagerProvider/reducer.js +125 -0
- package/admin/src/pages/View/components/NavigationContentHeader/index.js +18 -0
- package/admin/src/pages/View/components/NavigationHeader/index.js +60 -0
- package/admin/src/pages/View/components/NavigationItemForm/index.js +403 -0
- package/admin/src/{containers → pages}/View/components/NavigationItemForm/utils/form.js +2 -2
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupFooter.js +40 -0
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupHeader.js +20 -0
- package/admin/src/{containers → pages}/View/components/NavigationItemPopup/index.js +16 -16
- package/admin/src/pages/View/index.js +221 -0
- package/admin/src/{containers → pages}/View/utils/enums.js +0 -0
- package/admin/src/{containers → pages}/View/utils/form.js +1 -1
- package/admin/src/{containers → pages}/View/utils/index.js +0 -0
- package/admin/src/{containers → pages}/View/utils/parsers.js +13 -12
- package/admin/src/pluginId.js +3 -2
- package/admin/src/translations/en.json +47 -38
- package/admin/src/translations/fr.json +7 -1
- package/admin/src/utils/getTrad.js +2 -2
- package/package.json +18 -7
- package/server/bootstrap.js +41 -0
- package/server/config/index.js +8 -0
- package/server/config.js +8 -0
- package/server/content-types/audience/index.js +9 -0
- package/{models/audience.js → server/content-types/audience/lifecycle.js} +0 -0
- package/{models/audience.settings.json → server/content-types/audience/schema.json} +4 -2
- package/server/content-types/index.js +13 -0
- package/server/content-types/navigation/index.js +9 -0
- package/{models/navigation.js → server/content-types/navigation/lifecycle.js} +0 -0
- package/server/content-types/navigation/schema.js +45 -0
- package/server/content-types/navigation-item/index.js +9 -0
- package/{models/navigationItem.js → server/content-types/navigation-item/lifecycle.js} +0 -0
- package/{models/navigationItem.settings.json → server/content-types/navigation-item/schema.json} +16 -12
- package/server/content-types/navigations-items-related/index.js +9 -0
- package/{models/navigations_items_related.js → server/content-types/navigations-items-related/lifecycle.js} +0 -0
- package/{models/navigations_items_related.settings.json → server/content-types/navigations-items-related/schema.json} +4 -2
- package/server/controllers/index.js +7 -0
- package/{controllers → server/controllers}/navigation.js +20 -31
- package/server/graphql/index.js +23 -0
- package/server/graphql/queries/index.js +17 -0
- package/server/graphql/queries/render-navigation-child.js +16 -0
- package/server/graphql/queries/render-navigation.js +15 -0
- package/server/graphql/resolvers-config.js +4 -0
- package/server/graphql/types/content-types-name-fields.js +8 -0
- package/server/graphql/types/content-types.js +16 -0
- package/server/graphql/types/create-navigation-item.js +17 -0
- package/server/graphql/types/create-navigation-related.js +8 -0
- package/server/graphql/types/create-navigation.js +7 -0
- package/server/graphql/types/index.js +15 -0
- package/server/graphql/types/navigation-config.js +9 -0
- package/server/graphql/types/navigation-details.js +10 -0
- package/server/graphql/types/navigation-item.js +29 -0
- package/server/graphql/types/navigation-related.js +23 -0
- package/server/graphql/types/navigation-render-type.js +4 -0
- package/server/graphql/types/navigation.js +9 -0
- package/server/register.js +5 -0
- package/server/routes/admin.js +38 -0
- package/server/routes/client.js +21 -0
- package/server/routes/index.js +4 -0
- package/{services → server/services}/__tests__/navigation.test.js +0 -0
- package/server/services/index.js +7 -0
- package/server/services/navigation.js +729 -0
- package/{services → server/services}/utils/constant.js +3 -1
- package/server/services/utils/functions.js +185 -0
- package/strapi-admin.js +1 -0
- package/strapi-server.js +20 -0
- package/__mocks__/helpers/another-plugin/blog-post.settings.json +0 -31
- package/__mocks__/helpers/another-plugin/pages.settings.json +0 -28
- package/__mocks__/helpers/blog-post.settings.json +0 -31
- package/__mocks__/helpers/home-page.settings.json +0 -4
- package/__mocks__/helpers/my-homepage.settings.json +0 -27
- package/__mocks__/helpers/pages.settings.json +0 -27
- package/__mocks__/helpers/strapi.js +0 -101
- package/admin/src/assets/images/icon-cross-blue.svg +0 -1
- package/admin/src/assets/images/icon_remove.svg +0 -19
- package/admin/src/components/Container/index.js +0 -7
- package/admin/src/components/Input/index.js +0 -41
- package/admin/src/components/Item/CardItem.js +0 -46
- package/admin/src/components/Item/CardItemLevelAdd.js +0 -41
- package/admin/src/components/Item/CardItemLevelWrapper.js +0 -27
- package/admin/src/components/Item/CardItemPath.js +0 -9
- package/admin/src/components/Item/CardItemRestore.js +0 -19
- package/admin/src/components/Item/CardItemTitle.js +0 -5
- package/admin/src/components/Item/CardWrapper.js +0 -78
- package/admin/src/components/ItemFooter/CardItemError.js +0 -11
- package/admin/src/components/ItemFooter/CardItemRelation.js +0 -18
- package/admin/src/components/ItemFooter/CardItemRelationStatus.js +0 -17
- package/admin/src/components/ItemFooter/CardItemType.js +0 -18
- package/admin/src/components/ItemFooter/Wrapper.js +0 -26
- package/admin/src/components/ItemFooter/index.js +0 -66
- package/admin/src/components/ItemOrdering/CardOrderingButton.js +0 -24
- package/admin/src/components/ItemOrdering/Wrapper.js +0 -24
- package/admin/src/components/ItemOrdering/index.js +0 -36
- package/admin/src/components/List/Container.js +0 -34
- package/admin/src/components/List/ListLevelRoot.js +0 -18
- package/admin/src/components/List/index.js +0 -81
- package/admin/src/components/Option/OptionButton.js +0 -18
- package/admin/src/components/Option/OptionSet.js +0 -14
- package/admin/src/components/Option/Wrapper.js +0 -15
- package/admin/src/components/Option/index.js +0 -47
- package/admin/src/components/Select/ClearIndicator.js +0 -15
- package/admin/src/components/Select/DropdownIndicator.js +0 -39
- package/admin/src/components/Select/ErrorMessage.js +0 -10
- package/admin/src/components/Select/IndicatorSeparator.js +0 -3
- package/admin/src/components/Select/MultiValueContainer.js +0 -43
- package/admin/src/components/Select/StyledOption.js +0 -11
- package/admin/src/components/Select/index.js +0 -68
- package/admin/src/components/Select/utils/styles.js +0 -92
- package/admin/src/containers/App/Wrapper.js +0 -14
- package/admin/src/containers/App/index.js +0 -34
- package/admin/src/containers/DataManagerProvider/reducer.js +0 -136
- package/admin/src/containers/DetailsView/Wrapper.js +0 -21
- package/admin/src/containers/DetailsView/index.js +0 -111
- package/admin/src/containers/Initializer/index.js +0 -26
- package/admin/src/containers/ListView/Footer.js +0 -56
- package/admin/src/containers/ListView/components.js +0 -138
- package/admin/src/containers/ListView/index.js +0 -54
- package/admin/src/containers/View/FadedWrapper.js +0 -51
- package/admin/src/containers/View/HeaderForm.js +0 -9
- package/admin/src/containers/View/HeaderFormCell.js +0 -25
- package/admin/src/containers/View/Wrapper.js +0 -17
- package/admin/src/containers/View/components/NavigationItemForm/ModalFooter.js +0 -45
- package/admin/src/containers/View/components/NavigationItemForm/index.js +0 -427
- package/admin/src/containers/View/components/NavigationItemPopup/MediumPopup.js +0 -6
- package/admin/src/containers/View/index.js +0 -240
- package/admin/src/lifecycles.js +0 -3
- package/admin/src/permissions.js +0 -14
- package/config/functions/bootstrap.js +0 -138
- package/config/routes.json +0 -60
- package/config/schema.graphql.js +0 -209
- package/examples/audit-log-integrations.js.md +0 -38
- package/models/navigation.settings.json +0 -43
- package/public/assets/preview.png +0 -0
- package/services/navigation.js +0 -732
- package/services/utils/functions.js +0 -186
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
collectionName: "navigations",
|
|
3
|
+
info: {
|
|
4
|
+
singularName: "navigation",
|
|
5
|
+
pluralName: "navigations",
|
|
6
|
+
displayName: "Navigation",
|
|
7
|
+
name: "navigation"
|
|
8
|
+
},
|
|
9
|
+
options: {
|
|
10
|
+
increments: true,
|
|
11
|
+
comment: ""
|
|
12
|
+
},
|
|
13
|
+
pluginOptions: {
|
|
14
|
+
"content-manager": {
|
|
15
|
+
visible: true
|
|
16
|
+
},
|
|
17
|
+
"content-type-builder": {
|
|
18
|
+
visible: false
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
attributes: {
|
|
22
|
+
name: {
|
|
23
|
+
type: "text",
|
|
24
|
+
configurable: false,
|
|
25
|
+
required: true
|
|
26
|
+
},
|
|
27
|
+
slug: {
|
|
28
|
+
type: "uid",
|
|
29
|
+
target: "name",
|
|
30
|
+
configurable: false,
|
|
31
|
+
required: true
|
|
32
|
+
},
|
|
33
|
+
visible: {
|
|
34
|
+
type: "boolean",
|
|
35
|
+
default: false,
|
|
36
|
+
configurable: false
|
|
37
|
+
},
|
|
38
|
+
items: {
|
|
39
|
+
type: "relation",
|
|
40
|
+
relation: "oneToMany",
|
|
41
|
+
target: "plugin::navigation.navigation-item",
|
|
42
|
+
configurable: false
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
File without changes
|
package/{models/navigationItem.settings.json → server/content-types/navigation-item/schema.json}
RENAMED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"collectionName": "navigations_items",
|
|
3
3
|
"info": {
|
|
4
|
-
"
|
|
5
|
-
"
|
|
4
|
+
"singularName": "navigation-item",
|
|
5
|
+
"pluralName": "navigation-items",
|
|
6
|
+
"displayName": "Navigation Item",
|
|
7
|
+
"tableName": "navigation-item"
|
|
6
8
|
},
|
|
7
9
|
"options": {
|
|
8
10
|
"increments": true,
|
|
@@ -64,26 +66,28 @@
|
|
|
64
66
|
"configurable": false
|
|
65
67
|
},
|
|
66
68
|
"related": {
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
+
"type": "relation",
|
|
70
|
+
"relation": "oneToOne",
|
|
71
|
+
"target": "plugin::navigation.navigations-items-related",
|
|
69
72
|
"configurable": false
|
|
70
73
|
},
|
|
71
74
|
"parent": {
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
+
"type": "relation",
|
|
76
|
+
"relation": "oneToOne",
|
|
77
|
+
"target": "plugin::navigation.navigation-item",
|
|
75
78
|
"configurable": false,
|
|
76
79
|
"default": null
|
|
77
80
|
},
|
|
78
81
|
"master": {
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
+
"type": "relation",
|
|
83
|
+
"relation": "manyToOne",
|
|
84
|
+
"target": "plugin::navigation.navigation",
|
|
82
85
|
"configurable": false
|
|
83
86
|
},
|
|
84
87
|
"audience": {
|
|
85
|
-
"
|
|
86
|
-
"
|
|
88
|
+
"type": "relation",
|
|
89
|
+
"relation": "oneToMany",
|
|
90
|
+
"target": "plugin::navigation.audience"
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
93
|
}
|
|
File without changes
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"collectionName": "navigations_items_related",
|
|
3
3
|
"info": {
|
|
4
|
-
"
|
|
5
|
-
"
|
|
4
|
+
"singularName": "navigations-items-related",
|
|
5
|
+
"pluralName": "navigations-items-relateds",
|
|
6
|
+
"displayName": "Navigations Items Related",
|
|
7
|
+
"name": "navigations_items_related"
|
|
6
8
|
},
|
|
7
9
|
"options": {
|
|
8
10
|
"increments": true,
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
const { NavigationError } = require('../../utils/NavigationError');
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
/**
|
|
5
|
-
* navigation.js controller
|
|
6
|
-
*
|
|
7
|
-
* @description: A set of functions called "actions" of the `navigation` plugin.
|
|
8
|
-
*/
|
|
3
|
+
const getService = () => strapi.plugin('navigation').service('navigation');
|
|
9
4
|
|
|
10
5
|
const parseParams = (params) =>
|
|
11
6
|
Object.keys(params).reduce((prev, curr) => {
|
|
@@ -23,28 +18,36 @@ const errorHandler = (ctx) => (error) => {
|
|
|
23
18
|
}
|
|
24
19
|
throw error;
|
|
25
20
|
};
|
|
26
|
-
const getService = () => strapi.plugins.navigation.services.navigation;
|
|
27
21
|
|
|
28
22
|
module.exports = {
|
|
29
|
-
/**
|
|
30
|
-
* Default action.
|
|
31
|
-
*
|
|
32
|
-
* @return {Object}
|
|
33
|
-
*/
|
|
34
23
|
async config() {
|
|
35
24
|
return getService().config();
|
|
36
25
|
},
|
|
37
|
-
|
|
38
26
|
async get() {
|
|
39
27
|
return getService().get();
|
|
40
28
|
},
|
|
41
|
-
|
|
42
29
|
async getById(ctx) {
|
|
43
30
|
const { params } = ctx;
|
|
44
31
|
const { id } = parseParams(params);
|
|
45
32
|
return getService().getById(id);
|
|
46
33
|
},
|
|
47
|
-
|
|
34
|
+
async getContentTypeItems(ctx) {
|
|
35
|
+
const { params } = ctx;
|
|
36
|
+
const { model } = parseParams(params);
|
|
37
|
+
return getService().getContentTypeItems(model)
|
|
38
|
+
},
|
|
39
|
+
post(ctx) {
|
|
40
|
+
const { auditLog } = ctx;
|
|
41
|
+
const { body = {} } = ctx.request;
|
|
42
|
+
return getService().post(body, auditLog);
|
|
43
|
+
},
|
|
44
|
+
put(ctx) {
|
|
45
|
+
const { params, auditLog } = ctx;
|
|
46
|
+
const { id } = parseParams(params);
|
|
47
|
+
const { body = {} } = ctx.request;
|
|
48
|
+
return getService().put(id, body, auditLog)
|
|
49
|
+
.catch(errorHandler(ctx));
|
|
50
|
+
},
|
|
48
51
|
async render(ctx) {
|
|
49
52
|
const { params, query = {} } = ctx;
|
|
50
53
|
const { type, menu: menuOnly } = query;
|
|
@@ -66,18 +69,4 @@ module.exports = {
|
|
|
66
69
|
menuOnly
|
|
67
70
|
);
|
|
68
71
|
},
|
|
69
|
-
|
|
70
|
-
post(ctx) {
|
|
71
|
-
const { auditLog } = ctx;
|
|
72
|
-
const { body = {} } = ctx.request;
|
|
73
|
-
return getService().post(body, auditLog);
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
put(ctx) {
|
|
77
|
-
const { params, auditLog } = ctx;
|
|
78
|
-
const { id } = parseParams(params);
|
|
79
|
-
const { body = {} } = ctx.request;
|
|
80
|
-
return getService().put(id, body, auditLog)
|
|
81
|
-
.catch(errorHandler(ctx));
|
|
82
|
-
},
|
|
83
|
-
};
|
|
72
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const getTypes = require('./types');
|
|
2
|
+
const getQueries = require('./queries');
|
|
3
|
+
const getResolversConfig = require('./resolvers-config');
|
|
4
|
+
|
|
5
|
+
module.exports = () => {
|
|
6
|
+
const extensionService = strapi.plugin('graphql').service('extension');
|
|
7
|
+
|
|
8
|
+
extensionService.shadowCRUD('plugin::navigation.audience').disable();
|
|
9
|
+
extensionService.shadowCRUD('plugin::navigation.navigation').disable();
|
|
10
|
+
extensionService.shadowCRUD('plugin::navigation.navigation-item').disable();
|
|
11
|
+
extensionService.shadowCRUD('plugin::navigation.navigations-items-related').disable();
|
|
12
|
+
|
|
13
|
+
extensionService.use(({ nexus }) => {
|
|
14
|
+
const types = getTypes({ strapi, nexus });
|
|
15
|
+
const queries = getQueries({ strapi, nexus });
|
|
16
|
+
const resolversConfig = getResolversConfig({ strapi });
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
types: [types, queries],
|
|
20
|
+
resolversConfig,
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module.exports = (context) => {
|
|
2
|
+
const queries = {
|
|
3
|
+
renderNavigationChild: require('./render-navigation-child'),
|
|
4
|
+
renderNavigation: require('./render-navigation'),
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
return context.nexus.extendType({
|
|
8
|
+
type: 'Query',
|
|
9
|
+
definition(t) {
|
|
10
|
+
for (const [name, configFactory] of Object.entries(queries)) {
|
|
11
|
+
const config = configFactory(context);
|
|
12
|
+
|
|
13
|
+
t.field(name, config);
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = ({ strapi, nexus }) => {
|
|
2
|
+
const { nonNull, list, stringArg, booleanArg } = nexus;
|
|
3
|
+
return {
|
|
4
|
+
type: nonNull(list('NavigationItem')),
|
|
5
|
+
args: {
|
|
6
|
+
id: nonNull(stringArg()),
|
|
7
|
+
childUiKey: nonNull(stringArg()),
|
|
8
|
+
type: 'NavigationRenderType',
|
|
9
|
+
menuOnly: booleanArg()
|
|
10
|
+
},
|
|
11
|
+
resolve(obj, args) {
|
|
12
|
+
const { id, childUIKey, type, menuOnly } = args;
|
|
13
|
+
return strapi.plugin('navigation').service('navigation').renderChildren(id, childUIKey, type, menuOnly);
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = ({ strapi, nexus }) => {
|
|
2
|
+
const { nonNull, list, stringArg, booleanArg } = nexus;
|
|
3
|
+
return {
|
|
4
|
+
type: nonNull(list('NavigationItem')),
|
|
5
|
+
args: {
|
|
6
|
+
navigationIdOrSlug: nonNull(stringArg()),
|
|
7
|
+
type: 'NavigationRenderType',
|
|
8
|
+
menuOnly: booleanArg()
|
|
9
|
+
},
|
|
10
|
+
resolve(obj, args) {
|
|
11
|
+
const { navigationIdOrSlug, type, menuOnly } = args;
|
|
12
|
+
return strapi.plugin('navigation').service('navigation').render(navigationIdOrSlug, type, menuOnly);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
module.exports = ({ nexus }) => nexus.objectType({
|
|
2
|
+
name: "ContentTypesNameFields",
|
|
3
|
+
definition(t) {
|
|
4
|
+
t.nonNull.list.nonNull.string("default")
|
|
5
|
+
const contentTypesNameFields = strapi.plugin('navigation').config('contentTypesNameFields')
|
|
6
|
+
Object.keys(contentTypesNameFields || {}).forEach(key => t.nonNull.list.string(key))
|
|
7
|
+
}
|
|
8
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = ({ nexus }) => nexus.objectType({
|
|
2
|
+
name: "ContentTypes",
|
|
3
|
+
definition(t) {
|
|
4
|
+
t.nonNull.string("uid")
|
|
5
|
+
t.nonNull.string("name")
|
|
6
|
+
t.nonNull.boolean("isSingle")
|
|
7
|
+
t.nonNull.string("collectionName")
|
|
8
|
+
t.nonNull.string("contentTypeName")
|
|
9
|
+
t.nonNull.string("label")
|
|
10
|
+
t.nonNull.string("relatedField")
|
|
11
|
+
t.nonNull.string("labelSingular")
|
|
12
|
+
t.nonNull.string("endpoint")
|
|
13
|
+
t.nonNull.boolean("available")
|
|
14
|
+
t.nonNull.boolean("visible")
|
|
15
|
+
}
|
|
16
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module.exports = ({ nexus }) => nexus.inputObjectType({
|
|
2
|
+
name: "CreateNavigationItem",
|
|
3
|
+
definition(t) {
|
|
4
|
+
t.nonNull.string("title")
|
|
5
|
+
t.nonNull.string("type")
|
|
6
|
+
t.string("path")
|
|
7
|
+
t.string("externalPath")
|
|
8
|
+
t.nonNull.string("uiRouterKey")
|
|
9
|
+
t.nonNull.boolean("menuAttached")
|
|
10
|
+
t.nonNull.int("order")
|
|
11
|
+
t.int("parent")
|
|
12
|
+
t.int("master")
|
|
13
|
+
t.list.field("items", { type: 'CreateNavigationItem' })
|
|
14
|
+
t.list.string("audience")
|
|
15
|
+
t.field("related", { type: 'CreateNavigationRelated' })
|
|
16
|
+
}
|
|
17
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const typesFactories = [
|
|
2
|
+
require('./navigation-item'),
|
|
3
|
+
require('./navigation-related'),
|
|
4
|
+
require('./navigation-render-type'),
|
|
5
|
+
require('./navigation'),
|
|
6
|
+
require('./navigation-details'),
|
|
7
|
+
require('./content-types-name-fields'),
|
|
8
|
+
require('./content-types'),
|
|
9
|
+
require('./navigation-config'),
|
|
10
|
+
require('./create-navigation-related'),
|
|
11
|
+
require('./create-navigation-item'),
|
|
12
|
+
require('./create-navigation'),
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
module.exports = context => typesFactories.map(factory => factory(context));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
module.exports = ({ nexus }) => nexus.objectType({
|
|
2
|
+
name: "NavigationConfig",
|
|
3
|
+
definition(t) {
|
|
4
|
+
t.int("allowedLevels");
|
|
5
|
+
t.nonNull.list.string("additionalFields");
|
|
6
|
+
t.field("contentTypesNameFields", { type: 'ContentTypesNameFields' });
|
|
7
|
+
t.list.field("contentTypes", { type: 'ContentTypes' });
|
|
8
|
+
}
|
|
9
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
module.exports = ({ nexus }) => nexus.objectType({
|
|
2
|
+
name: "NavigationDetails",
|
|
3
|
+
definition(t) {
|
|
4
|
+
t.nonNull.string("id")
|
|
5
|
+
t.nonNull.string("name")
|
|
6
|
+
t.nonNull.string("slug")
|
|
7
|
+
t.nonNull.boolean("visible")
|
|
8
|
+
t.nonNull.list.field("items", { type: 'NavigationItem' })
|
|
9
|
+
}
|
|
10
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module.exports = ({ nexus }) =>
|
|
2
|
+
nexus.objectType({
|
|
3
|
+
name: "NavigationItem",
|
|
4
|
+
definition(t) {
|
|
5
|
+
t.nonNull.int("id")
|
|
6
|
+
t.nonNull.string("title")
|
|
7
|
+
t.nonNull.string("type")
|
|
8
|
+
t.string("path")
|
|
9
|
+
t.string("externalPath")
|
|
10
|
+
t.nonNull.string("uiRouterKey")
|
|
11
|
+
t.nonNull.boolean("menuAttached")
|
|
12
|
+
t.nonNull.int("order")
|
|
13
|
+
t.int("parent")
|
|
14
|
+
t.int("master")
|
|
15
|
+
t.list.field("items", { type: 'NavigationItem' })
|
|
16
|
+
t.list.field("related", { type: 'NavigationRelated' })
|
|
17
|
+
t.list.string("audience")
|
|
18
|
+
// SQL
|
|
19
|
+
t.string("created_at")
|
|
20
|
+
t.string("updated_at")
|
|
21
|
+
t.string("created_by")
|
|
22
|
+
t.string("updated_by")
|
|
23
|
+
// MONGO
|
|
24
|
+
t.string("createdAt")
|
|
25
|
+
t.string("updatedAt")
|
|
26
|
+
t.string("createdBy")
|
|
27
|
+
t.string("updatedBy")
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module.exports = ({ strapi, nexus }) => {
|
|
2
|
+
const related = strapi.plugin('navigation').config('gql').navigationItemRelated;
|
|
3
|
+
const name = "NavigationRelated";
|
|
4
|
+
|
|
5
|
+
if (related?.length) {
|
|
6
|
+
return nexus.unionType({
|
|
7
|
+
name,
|
|
8
|
+
definition(t) {
|
|
9
|
+
t.members(...related)
|
|
10
|
+
},
|
|
11
|
+
resolveType: (item) => strapi.contentTypes[item.__contentType]?.globalId
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return nexus.objectType({
|
|
16
|
+
name,
|
|
17
|
+
definition(t) {
|
|
18
|
+
t.int("id")
|
|
19
|
+
t.string("title")
|
|
20
|
+
t.string("name")
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
type: 'admin',
|
|
3
|
+
routes: [
|
|
4
|
+
{
|
|
5
|
+
method: 'GET',
|
|
6
|
+
path: '/',
|
|
7
|
+
handler: 'navigation.get',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
method: 'POST',
|
|
11
|
+
path: '/',
|
|
12
|
+
handler: 'navigation.post',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
method: 'GET',
|
|
16
|
+
path: '/config',
|
|
17
|
+
handler: 'navigation.config',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
method: 'GET',
|
|
21
|
+
path: '/:id',
|
|
22
|
+
handler: 'navigation.getById',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
method: 'PUT',
|
|
26
|
+
path: '/:id',
|
|
27
|
+
handler: 'navigation.put',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
method: 'GET',
|
|
31
|
+
path: '/content-type-items/:model',
|
|
32
|
+
handler: 'navigation.getContentTypeItems',
|
|
33
|
+
policies: [
|
|
34
|
+
'admin::isAuthenticatedAdmin'
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
type: 'content-api',
|
|
3
|
+
routes: [
|
|
4
|
+
{
|
|
5
|
+
method: "GET",
|
|
6
|
+
path: "/render/:idOrSlug",
|
|
7
|
+
handler: "navigation.render",
|
|
8
|
+
config: {
|
|
9
|
+
policies: []
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
method: "GET",
|
|
14
|
+
path: "/render/:idOrSlug/:childUIKey",
|
|
15
|
+
handler: "navigation.renderChild",
|
|
16
|
+
config: {
|
|
17
|
+
policies: []
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
File without changes
|