aboutsummaryrefslogtreecommitdiff
path: root/lib/admin
diff options
context:
space:
mode:
Diffstat (limited to 'lib/admin')
-rw-r--r--lib/admin/package-lock.json62
-rw-r--r--lib/admin/package.json4
-rw-r--r--lib/admin/src/channels/channels.ts5
-rw-r--r--lib/admin/src/channels/computedChannels.ts2
-rw-r--r--lib/admin/src/content/computedContent.ts2
-rw-r--r--lib/admin/src/content/useContent.ts6
-rw-r--r--lib/admin/src/feedProperties/index.ts2
-rw-r--r--lib/admin/src/helpers.ts2
-rw-r--r--lib/admin/src/index.ts27
-rw-r--r--lib/admin/src/ordering/index.ts2
-rw-r--r--lib/admin/src/posts/computedPosts.ts2
-rw-r--r--lib/admin/src/posts/usePost.ts6
-rw-r--r--lib/admin/src/types.ts2
13 files changed, 82 insertions, 42 deletions
diff --git a/lib/admin/package-lock.json b/lib/admin/package-lock.json
index 3cf7d81..ba65f79 100644
--- a/lib/admin/package-lock.json
+++ b/lib/admin/package-lock.json
@@ -1,16 +1,16 @@
{
"name": "@vnuge/cmnext-admin",
- "version": "0.1.0",
+ "version": "0.1.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@vnuge/cmnext-admin",
- "version": "0.1.0",
+ "version": "0.1.1",
"license": "agpl3",
"devDependencies": {
"@babel/types": "^7.x",
- "@types/lodash": "^4.14.194",
+ "@types/lodash-es": "^4.14.194",
"@typescript-eslint/eslint-plugin": "^5.59.1",
"axios": "^1.x",
"eslint": "^8.39.0",
@@ -21,7 +21,7 @@
"@vnuge/vnlib.browser": "https://www.vaughnnugent.com/public/resources/software/releases/vnlib-browser/v0.1.6.tgz",
"@vueuse/core": "^10.x",
"@vueuse/router": "^10.x",
- "lodash": "^4.x",
+ "lodash-es": "^4.x",
"vue": "^3.x"
}
},
@@ -53,9 +53,9 @@
}
},
"node_modules/@babel/parser": {
- "version": "7.22.7",
- "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.7.tgz",
- "integrity": "sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==",
+ "version": "7.22.10",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.10.tgz",
+ "integrity": "sha512-lNbdGsQb9ekfsnjFGhEiF4hfFqGgfOP3H3d27re3n+CGhNuTSUEQdfWk556sTLNTloczcdM5TYF2LhzmDQKyvQ==",
"peer": true,
"bin": {
"parser": "bin/babel-parser.js"
@@ -65,9 +65,9 @@
}
},
"node_modules/@babel/types": {
- "version": "7.22.5",
- "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.5.tgz",
- "integrity": "sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA==",
+ "version": "7.22.10",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.10.tgz",
+ "integrity": "sha512-obaoigiLrlDZ7TUQln/8m4mSqIW2QFeOrCQc9r+xsaHGNoplVNYlRVpsfE8Vj35GEm2ZH4ZhrNYogs/3fj85kg==",
"dev": true,
"dependencies": {
"@babel/helper-string-parser": "^7.22.5",
@@ -226,6 +226,15 @@
"integrity": "sha512-22y3o88f4a94mKljsZcanlNWPzO0uBsBdzLAngf2tp533LzZcQzb6+eZPJ+vCTt+bqF2XnvT9gejTLsAcJAJyQ==",
"dev": true
},
+ "node_modules/@types/lodash-es": {
+ "version": "4.17.8",
+ "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.8.tgz",
+ "integrity": "sha512-euY3XQcZmIzSy7YH5+Unb3b2X12Wtk54YWINBvvGQ5SmMvwb11JQskGsfkH/5HXK77Kr8GF0wkVDIxzAisWtog==",
+ "dev": true,
+ "dependencies": {
+ "@types/lodash": "*"
+ }
+ },
"node_modules/@types/semver": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz",
@@ -1552,6 +1561,12 @@
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"peer": true
},
+ "node_modules/lodash-es": {
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
+ "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==",
+ "peer": true
+ },
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@@ -2207,15 +2222,15 @@
"dev": true
},
"@babel/parser": {
- "version": "7.22.7",
- "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.7.tgz",
- "integrity": "sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==",
+ "version": "7.22.10",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.10.tgz",
+ "integrity": "sha512-lNbdGsQb9ekfsnjFGhEiF4hfFqGgfOP3H3d27re3n+CGhNuTSUEQdfWk556sTLNTloczcdM5TYF2LhzmDQKyvQ==",
"peer": true
},
"@babel/types": {
- "version": "7.22.5",
- "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.5.tgz",
- "integrity": "sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA==",
+ "version": "7.22.10",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.10.tgz",
+ "integrity": "sha512-obaoigiLrlDZ7TUQln/8m4mSqIW2QFeOrCQc9r+xsaHGNoplVNYlRVpsfE8Vj35GEm2ZH4ZhrNYogs/3fj85kg==",
"dev": true,
"requires": {
"@babel/helper-string-parser": "^7.22.5",
@@ -2334,6 +2349,15 @@
"integrity": "sha512-22y3o88f4a94mKljsZcanlNWPzO0uBsBdzLAngf2tp533LzZcQzb6+eZPJ+vCTt+bqF2XnvT9gejTLsAcJAJyQ==",
"dev": true
},
+ "@types/lodash-es": {
+ "version": "4.17.8",
+ "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.8.tgz",
+ "integrity": "sha512-euY3XQcZmIzSy7YH5+Unb3b2X12Wtk54YWINBvvGQ5SmMvwb11JQskGsfkH/5HXK77Kr8GF0wkVDIxzAisWtog==",
+ "dev": true,
+ "requires": {
+ "@types/lodash": "*"
+ }
+ },
"@types/semver": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz",
@@ -3280,6 +3304,12 @@
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"peer": true
},
+ "lodash-es": {
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
+ "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==",
+ "peer": true
+ },
"lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
diff --git a/lib/admin/package.json b/lib/admin/package.json
index 5dbbaa2..ee12700 100644
--- a/lib/admin/package.json
+++ b/lib/admin/package.json
@@ -16,7 +16,7 @@
"license": "agpl3",
"devDependencies": {
- "@types/lodash": "^4.14.194",
+ "@types/lodash-es": "^4.14.194",
"@babel/types":"^7.x",
"@typescript-eslint/eslint-plugin": "^5.59.1",
"eslint": "^8.39.0",
@@ -28,7 +28,7 @@
"peerDependencies": {
"@vueuse/core": "^10.x",
"@vueuse/router": "^10.x",
- "lodash": "^4.x",
+ "lodash-es": "^4.x",
"vue": "^3.x",
"@vnuge/vnlib.browser": "https://www.vaughnnugent.com/public/resources/software/releases/vnlib-browser/v0.1.6.tgz"
},
diff --git a/lib/admin/src/channels/channels.ts b/lib/admin/src/channels/channels.ts
index 3100963..3efb6b7 100644
--- a/lib/admin/src/channels/channels.ts
+++ b/lib/admin/src/channels/channels.ts
@@ -13,15 +13,14 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
-import { useAxios } from '@vnuge/vnlib.browser';
-import { isEqual, toSafeInteger } from 'lodash';
+import { isEqual, toSafeInteger } from 'lodash-es';
import { BlogChannel, ChannelFeed, ChannelApi, BlogAdminContext } from '../types.js'
/**
* Gets the channel helper api to manage content channels
*/
export const useChannels = (context: BlogAdminContext): ChannelApi => {
- const axios = useAxios(null);
+ const axios = context.getAxios();
const getUrl = (): string => context.getChannelUrl();
diff --git a/lib/admin/src/channels/computedChannels.ts b/lib/admin/src/channels/computedChannels.ts
index 2fb64f2..dbf7cd5 100644
--- a/lib/admin/src/channels/computedChannels.ts
+++ b/lib/admin/src/channels/computedChannels.ts
@@ -15,7 +15,7 @@
import { apiCall } from '@vnuge/vnlib.browser';
import { Ref, computed, ref, watch } from 'vue'
-import { find, isEmpty, isEqual } from 'lodash';
+import { find, isEmpty, isEqual } from 'lodash-es';
import { BlogChannel, ChannelApi, ComputedBlogApi, BlogAdminContext } from '../types.js'
import { useChannels } from './channels.js';
diff --git a/lib/admin/src/content/computedContent.ts b/lib/admin/src/content/computedContent.ts
index c4ca575..65c1537 100644
--- a/lib/admin/src/content/computedContent.ts
+++ b/lib/admin/src/content/computedContent.ts
@@ -14,7 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import { Ref, computed } from "vue";
-import { find, filter, includes, isEqual, isNil, toLower } from "lodash";
+import { find, filter, includes, isEqual, isNil, toLower } from 'lodash-es';
import { apiCall } from "@vnuge/vnlib.browser"
import { ContentMeta, BlogEntity, ContentApi, ComputedBlogApi, BlogAdminContext } from "../types.js";
import { watchAndCompute } from "../helpers.js";
diff --git a/lib/admin/src/content/useContent.ts b/lib/admin/src/content/useContent.ts
index 1493565..d23177c 100644
--- a/lib/admin/src/content/useContent.ts
+++ b/lib/admin/src/content/useContent.ts
@@ -13,8 +13,8 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
-import { includes, isEmpty } from "lodash";
-import { WebMessage, useAxios } from "@vnuge/vnlib.browser"
+import { includes, isEmpty } from 'lodash-es';
+import { WebMessage } from "@vnuge/vnlib.browser"
import { PostMeta, ContentMeta, ContentApi, BlogEntity, BlogAdminContext } from "../types.js";
@@ -25,7 +25,7 @@ import { PostMeta, ContentMeta, ContentApi, BlogEntity, BlogAdminContext } from
* @returns A content api object
*/
export const useContent = (context : BlogAdminContext): ContentApi => {
- const axios = useAxios(null);
+ const axios = context.getAxios();
const { channel } = context.getQuery();
diff --git a/lib/admin/src/feedProperties/index.ts b/lib/admin/src/feedProperties/index.ts
index 733acde..58ee179 100644
--- a/lib/admin/src/feedProperties/index.ts
+++ b/lib/admin/src/feedProperties/index.ts
@@ -13,7 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
-import { cloneDeep, filter, forEach, isEmpty, join, map } from 'lodash';
+import { cloneDeep, filter, forEach, isEmpty, join, map } from 'lodash-es';
import { watch, Ref, ref } from 'vue';
import { FeedProperty, XmlPropertyContainer } from '../types';
diff --git a/lib/admin/src/helpers.ts b/lib/admin/src/helpers.ts
index 9bb7197..d822200 100644
--- a/lib/admin/src/helpers.ts
+++ b/lib/admin/src/helpers.ts
@@ -14,7 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import { Ref, WatchSource, ref } from 'vue';
-import { throttle } from 'lodash';
+import { throttle } from 'lodash-es';
import { watchArray } from '@vueuse/core';
diff --git a/lib/admin/src/index.ts b/lib/admin/src/index.ts
index b5abe68..7733f5c 100644
--- a/lib/admin/src/index.ts
+++ b/lib/admin/src/index.ts
@@ -25,31 +25,37 @@ import { MaybeRef } from "vue";
import { get } from '@vueuse/core'
import { useRouteQuery } from "@vueuse/router";
import { QueryState, QueryType, SortType, BlogAdminContext } from "./types";
+import { RouteLocationNormalized, Router } from 'vue-router';
+import { AxiosInstance } from 'axios';
export interface BlogAdminConfig {
+ readonly axios: AxiosInstance;
+ readonly router: Router;
+ readonly route: RouteLocationNormalized;
readonly postUrl: MaybeRef<string>;
readonly contentUrl: MaybeRef<string>;
readonly channelUrl: MaybeRef<string>;
readonly defaultPageSize?: number;
}
-const createQueryState = (): QueryState => {
+const createQueryState = (router :Router , route : RouteLocationNormalized): QueryState => {
+
//setup filter search query
- const search = useRouteQuery<string>(QueryType.Filter, '', { mode: 'replace' });
+ const search = useRouteQuery<string>(QueryType.Filter, '', { mode: 'replace', route, router });
//Get sort order query
- const sort = useRouteQuery<SortType>(QueryType.Sort, SortType.CreatedTime, { mode: 'replace' });
+ const sort = useRouteQuery<SortType>(QueryType.Sort, SortType.CreatedTime, { mode: 'replace', route, router });
//Selected channel id
- const channel = useRouteQuery<string>(QueryType.Channel, '', { mode: 'replace' });
+ const channel = useRouteQuery<string>(QueryType.Channel, '', { mode: 'replace', route, router });
//Edits are in push mode because they are used to navigate to edit pages
- const channelEdit = useRouteQuery<string>(QueryType.ChannelEdit, '', { mode: 'push' });
+ const channelEdit = useRouteQuery<string>(QueryType.ChannelEdit, '', { mode: 'push', route, router });
- const content = useRouteQuery<string>(QueryType.Content, '', { mode: 'push' });
+ const content = useRouteQuery<string>(QueryType.Content, '', { mode: 'push', route, router });
//Get the selected post id from the route
- const post = useRouteQuery<string>(QueryType.Post, '', { mode: 'push' });
+ const post = useRouteQuery<string>(QueryType.Post, '', { mode: 'push', route, router });
return {
post,
@@ -66,12 +72,14 @@ const createQueryState = (): QueryState => {
* @param param0 The blog configuration object
* @returns A blog context object to pass to the blog admin components
*/
-export const createBlogContext = ({ channelUrl, postUrl, contentUrl }: BlogAdminConfig): BlogAdminContext => {
+export const createBlogContext = ({ channelUrl, postUrl, contentUrl, router, route, axios }: BlogAdminConfig): BlogAdminContext => {
- const queryState = createQueryState();
+ const queryState = createQueryState(router, route);
const getQuery = (): QueryState => queryState;
+ const getAxios = () : AxiosInstance => axios;
+
const getPostUrl = (): string => get(postUrl)
const getContentUrl = (): string => get(contentUrl)
@@ -79,6 +87,7 @@ export const createBlogContext = ({ channelUrl, postUrl, contentUrl }: BlogAdmin
const getChannelUrl = (): string => get(channelUrl)
return{
+ getAxios,
getQuery,
getPostUrl,
getChannelUrl,
diff --git a/lib/admin/src/ordering/index.ts b/lib/admin/src/ordering/index.ts
index 12cbf3c..a2f266f 100644
--- a/lib/admin/src/ordering/index.ts
+++ b/lib/admin/src/ordering/index.ts
@@ -15,7 +15,7 @@
import { MaybeRefOrGetter, computed } from 'vue';
import { useOffsetPagination } from '@vueuse/core';
-import { filter, includes, isEmpty, orderBy, slice, toLower } from 'lodash';
+import { filter, includes, isEmpty, orderBy, slice, toLower } from 'lodash-es';
import { CanPaginate, NamedBlogEntity, SortedFilteredPaged } from '../types';
/**
diff --git a/lib/admin/src/posts/computedPosts.ts b/lib/admin/src/posts/computedPosts.ts
index 61be169..44171a5 100644
--- a/lib/admin/src/posts/computedPosts.ts
+++ b/lib/admin/src/posts/computedPosts.ts
@@ -14,7 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import { computed } from "vue";
-import { isEqual, find } from "lodash";
+import { isEqual, find } from 'lodash-es';
import { apiCall } from "@vnuge/vnlib.browser";
import { PostMeta, ComputedPosts, BlogAdminContext } from "../types";
import { usePostApi } from "./usePost";
diff --git a/lib/admin/src/posts/usePost.ts b/lib/admin/src/posts/usePost.ts
index 56d0f17..1d93b6b 100644
--- a/lib/admin/src/posts/usePost.ts
+++ b/lib/admin/src/posts/usePost.ts
@@ -13,8 +13,8 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
-import { isArray, orderBy } from "lodash";
-import { WebMessage, useAxios } from "@vnuge/vnlib.browser"
+import { isArray, orderBy } from 'lodash-es';
+import { WebMessage } from "@vnuge/vnlib.browser"
import { PostMeta, PostApi, BlogAdminContext } from "../types";
/**
@@ -23,7 +23,7 @@ import { PostMeta, PostApi, BlogAdminContext } from "../types";
* @returns The configured post api
*/
export const usePostApi = (context : BlogAdminContext): PostApi => {
- const axios = useAxios(null);
+ const axios = context.getAxios();
const { channel } = context.getQuery();
diff --git a/lib/admin/src/types.ts b/lib/admin/src/types.ts
index 2d3a56c..f94932a 100644
--- a/lib/admin/src/types.ts
+++ b/lib/admin/src/types.ts
@@ -14,6 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import { UseOffsetPaginationReturn } from '@vueuse/core';
+import { AxiosInstance } from 'axios';
import { Dictionary } from 'lodash';
import { Ref } from 'vue';
@@ -267,4 +268,5 @@ export interface BlogAdminContext {
getPostUrl(): string;
getContentUrl(): string;
getChannelUrl(): string;
+ getAxios(): AxiosInstance;
} \ No newline at end of file