From 5dd4b69ebf4f407a2ba7ccc53fe43b445ab0684e Mon Sep 17 00:00:00 2001 From: vnugent Date: Wed, 9 Aug 2023 11:59:15 -0400 Subject: Package updates, lodash-es, release state fixes --- lib/admin/src/channels/channels.ts | 5 ++--- lib/admin/src/channels/computedChannels.ts | 2 +- lib/admin/src/content/computedContent.ts | 2 +- lib/admin/src/content/useContent.ts | 6 +++--- lib/admin/src/feedProperties/index.ts | 2 +- lib/admin/src/helpers.ts | 2 +- lib/admin/src/index.ts | 27 ++++++++++++++++++--------- lib/admin/src/ordering/index.ts | 2 +- lib/admin/src/posts/computedPosts.ts | 2 +- lib/admin/src/posts/usePost.ts | 6 +++--- lib/admin/src/types.ts | 2 ++ 11 files changed, 34 insertions(+), 24 deletions(-) (limited to 'lib/admin/src') 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 . -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 . 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 . -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 . -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 . 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; readonly contentUrl: MaybeRef; readonly channelUrl: MaybeRef; readonly defaultPageSize?: number; } -const createQueryState = (): QueryState => { +const createQueryState = (router :Router , route : RouteLocationNormalized): QueryState => { + //setup filter search query - const search = useRouteQuery(QueryType.Filter, '', { mode: 'replace' }); + const search = useRouteQuery(QueryType.Filter, '', { mode: 'replace', route, router }); //Get sort order query - const sort = useRouteQuery(QueryType.Sort, SortType.CreatedTime, { mode: 'replace' }); + const sort = useRouteQuery(QueryType.Sort, SortType.CreatedTime, { mode: 'replace', route, router }); //Selected channel id - const channel = useRouteQuery(QueryType.Channel, '', { mode: 'replace' }); + const channel = useRouteQuery(QueryType.Channel, '', { mode: 'replace', route, router }); //Edits are in push mode because they are used to navigate to edit pages - const channelEdit = useRouteQuery(QueryType.ChannelEdit, '', { mode: 'push' }); + const channelEdit = useRouteQuery(QueryType.ChannelEdit, '', { mode: 'push', route, router }); - const content = useRouteQuery(QueryType.Content, '', { mode: 'push' }); + const content = useRouteQuery(QueryType.Content, '', { mode: 'push', route, router }); //Get the selected post id from the route - const post = useRouteQuery(QueryType.Post, '', { mode: 'push' }); + const post = useRouteQuery(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 . 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 . -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 . 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 -- cgit