diff --git a/src/commands/Dashboard.ts b/src/commands/Dashboard.ts index edc8912c..598b1ef5 100644 --- a/src/commands/Dashboard.ts +++ b/src/commands/Dashboard.ts @@ -24,7 +24,6 @@ import { ExtensionListener, SnippetListener, TaxonomyListener, - LogListener, LocalizationListener, SsgListener } from '../listeners/dashboard'; @@ -237,7 +236,6 @@ export class Dashboard { ModeListener.process(msg); GitListener.process(msg); TaxonomyListener.process(msg); - LogListener.process(msg); SsgListener.process(msg); }); } diff --git a/src/components/icons/ArrowClockwiseIcon.tsx b/src/components/icons/ArrowClockwiseIcon.tsx new file mode 100644 index 00000000..acdc86d8 --- /dev/null +++ b/src/components/icons/ArrowClockwiseIcon.tsx @@ -0,0 +1,13 @@ +import * as React from 'react'; + +export interface IArrowClockwiseIconProps { + className?: string; +} + +export const ArrowClockwiseIcon: React.FunctionComponent = ({ className }: React.PropsWithChildren) => { + return ( + + ); +}; \ No newline at end of file diff --git a/src/constants/GeneralCommands.ts b/src/constants/GeneralCommands.ts index 5db92184..efa20688 100644 --- a/src/constants/GeneralCommands.ts +++ b/src/constants/GeneralCommands.ts @@ -24,6 +24,11 @@ export const GeneralCommands = { content: { locales: 'getContentLocales' }, + logging: { + info: 'logInfo', + warn: 'logWarn', + error: 'logError' + }, runCommand: 'runCommand', getLocalization: 'getLocalization', openOnWebsite: 'openOnWebsite' diff --git a/src/dashboardWebView/DashboardMessage.ts b/src/dashboardWebView/DashboardMessage.ts index 86859b5b..73a2fe97 100644 --- a/src/dashboardWebView/DashboardMessage.ts +++ b/src/dashboardWebView/DashboardMessage.ts @@ -75,7 +75,6 @@ export enum DashboardMessage { getState = 'getState', runCustomScript = 'runCustomScript', sendTelemetry = 'sendTelemetry', - logError = 'logError', showNotification = 'showNotification', // Settings diff --git a/src/dashboardWebView/components/App.tsx b/src/dashboardWebView/components/App.tsx index 51b2b50a..2a2b896c 100644 --- a/src/dashboardWebView/components/App.tsx +++ b/src/dashboardWebView/components/App.tsx @@ -9,7 +9,7 @@ import { Contents } from './Contents/Contents'; import { Media } from './Media/Media'; import { DataView } from './DataView'; import { Snippets } from './SnippetsView/Snippets'; -import { FEATURE_FLAG } from '../../constants'; +import { FEATURE_FLAG, GeneralCommands } from '../../constants'; import { Messenger } from '@estruyf/vscode/dist/client'; import { TaxonomyView } from './TaxonomyView'; import { Route, Routes, useNavigate } from 'react-router-dom'; @@ -18,7 +18,6 @@ import { useEffect, useMemo, useState } from 'react'; import { UnknownView } from './UnknownView'; import { ErrorBoundary } from '@sentry/react'; import { ErrorView } from './ErrorView'; -import { DashboardMessage } from '../DashboardMessage'; import * as l10n from '@vscode/l10n'; import { LocalizationKey } from '../../localization'; import { SettingsView } from './SettingsView/SettingsView'; @@ -100,7 +99,7 @@ export const App: React.FunctionComponent = ({ fallback={} onError={(error: Error, componentStack: string, eventId: string) => { Messenger.send( - DashboardMessage.logError, + GeneralCommands.toVSCode.logging.error, `Event ID: ${eventId} Message: ${error.message} diff --git a/src/dashboardWebView/components/Header/Header.tsx b/src/dashboardWebView/components/Header/Header.tsx index 0c755ad6..997b9ba3 100644 --- a/src/dashboardWebView/components/Header/Header.tsx +++ b/src/dashboardWebView/components/Header/Header.tsx @@ -32,6 +32,7 @@ import { Link } from '../Common/Link'; import { SPONSOR_LINK } from '../../../constants'; import { Filters } from './Filters'; import { ActionsBar } from './ActionsBar'; +import { RefreshDashboardData } from './RefreshDashboardData'; export interface IHeaderProps { header?: React.ReactNode; @@ -163,13 +164,15 @@ export const Header: React.FunctionComponent = ({ {location.pathname === routePaths.contents && ( <>
-
+
+ +
diff --git a/src/dashboardWebView/components/Header/Navigation.tsx b/src/dashboardWebView/components/Header/Navigation.tsx index 7ccc7d6b..99c75259 100644 --- a/src/dashboardWebView/components/Header/Navigation.tsx +++ b/src/dashboardWebView/components/Header/Navigation.tsx @@ -63,7 +63,7 @@ export const Navigation: React.FunctionComponent = ({ }, [settings?.draftField?.type, tabInfo]); return ( -
- -
); }; diff --git a/src/dashboardWebView/components/Header/Tab.tsx b/src/dashboardWebView/components/Header/Tab.tsx index ae9185a2..70ba753f 100644 --- a/src/dashboardWebView/components/Header/Tab.tsx +++ b/src/dashboardWebView/components/Header/Tab.tsx @@ -15,8 +15,6 @@ export const Tab: React.FunctionComponent = ({ }: React.PropsWithChildren) => { const location = useLocation(); - console.log(location.pathname, navigationType); - return ( + + ); }; diff --git a/src/dashboardWebView/components/SnippetsView/SnippetForm.tsx b/src/dashboardWebView/components/SnippetsView/SnippetForm.tsx index 804091dc..41c6006b 100644 --- a/src/dashboardWebView/components/SnippetsView/SnippetForm.tsx +++ b/src/dashboardWebView/components/SnippetsView/SnippetForm.tsx @@ -8,6 +8,7 @@ import { DashboardMessage } from '../../DashboardMessage'; import { SettingsAtom, ViewDataSelector } from '../../state'; import { SnippetInputField } from './SnippetInputField'; import { SNIPPET } from '../../../constants/Snippet'; +import { GeneralCommands } from '../../../constants'; export interface ISnippetFormProps { snippetKey?: string; @@ -144,22 +145,17 @@ ${snippetBody} const allFields: SnippetField[] = []; const snippetFields = snippet.fields || []; - // Loop over all fields to check if they are present in the snippet - console.log('placeholders', placeholders); - console.log('snippetFields', snippetFields); - for await (const field of snippetFields) { - console.log('field', field); const idx = placeholders.findIndex((fieldName) => fieldName === field.name); if (idx > -1) { try { const value = await insertPlaceholderValues(field.default || ''); - console.log('value', value); allFields.push({ ...field, value }); } catch (e) { + messageHandler.send(GeneralCommands.toVSCode.logging.error, `SnippetForm: ${(e as Error).message}`); console.log('Error', (e as Error).message) } } diff --git a/src/helpers/ArticleHelper.ts b/src/helpers/ArticleHelper.ts index 6689d64a..26129596 100644 --- a/src/helpers/ArticleHelper.ts +++ b/src/helpers/ArticleHelper.ts @@ -208,7 +208,6 @@ export class ArticleHelper { validateInput: async (value) => { try { const newFileUri = Uri.joinPath(Uri.file(folderPath), `${value}${fileExtension}`); - console.log(newFileUri.fsPath); const exists = await workspace.fs.readFile(newFileUri); if (exists && value !== fileNameWithoutExt) { return l10n.t(LocalizationKey.commandsArticleRenameFileExistsError, value); diff --git a/src/listeners/dashboard/LogListener.ts b/src/listeners/dashboard/LogListener.ts deleted file mode 100644 index f4879b7b..00000000 --- a/src/listeners/dashboard/LogListener.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { DashboardMessage } from '../../dashboardWebView/DashboardMessage'; -import { Logger } from '../../helpers'; -import { PostMessageData } from '../../models'; -import { BaseListener } from './BaseListener'; - -export class LogListener extends BaseListener { - /** - * Process the messages for the dashboard views - * @param msg - */ - public static process(msg: PostMessageData) { - super.process(msg); - - switch (msg.command) { - case DashboardMessage.logError: - Logger.error(msg.payload); - break; - } - } -} diff --git a/src/listeners/dashboard/index.ts b/src/listeners/dashboard/index.ts index 230a62c6..26727ef8 100644 --- a/src/listeners/dashboard/index.ts +++ b/src/listeners/dashboard/index.ts @@ -8,6 +8,5 @@ export * from './SettingsListener'; export * from './SnippetListener'; export * from './TelemetryListener'; export * from './TaxonomyListener'; -export * from './LogListener'; export * from './LocalizationListener'; export * from './SsgListener'; diff --git a/src/listeners/general/BaseListener.ts b/src/listeners/general/BaseListener.ts index 3340dac6..93d51e49 100644 --- a/src/listeners/general/BaseListener.ts +++ b/src/listeners/general/BaseListener.ts @@ -25,6 +25,15 @@ export abstract class BaseListener { commands.executeCommand(command, args); } break; + case GeneralCommands.toVSCode.logging.info: + Logger.info(msg.payload); + break; + case GeneralCommands.toVSCode.logging.warn: + Logger.warning(msg.payload); + break; + case GeneralCommands.toVSCode.logging.error: + Logger.error(msg.payload); + break; } } diff --git a/src/listeners/panel/DataListener.ts b/src/listeners/panel/DataListener.ts index 55c70afb..1436c274 100644 --- a/src/listeners/panel/DataListener.ts +++ b/src/listeners/panel/DataListener.ts @@ -224,7 +224,9 @@ export class DataListener extends BaseListener { return; } } catch (e) { - Logger.error(`DataListener::pushMetadata: ${(e as Error).message}`); + if (filePath) { + Logger.error(`DataListener::pushMetadata: ${(e as Error).message}`); + } this.sendMsg(Command.metadata, undefined); return; }