Skip to content

Commit

Permalink
fix onFailLoad for helpview (#1951)
Browse files Browse the repository at this point in the history
  • Loading branch information
sawka authored Feb 12, 2025
1 parent 36bf4af commit af65c2c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 39 deletions.
6 changes: 1 addition & 5 deletions frontend/app/view/chat/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ class ChatModel {
});
}

function makeChatModel(blockId: string): ChatModel {
return new ChatModel(blockId);
}

interface ChatProps {
model: ChatModel;
}
Expand Down Expand Up @@ -67,4 +63,4 @@ const Chat = memo(({ model }: ChatProps) => {
);
});

export { Chat, ChatModel, makeChatModel };
export { Chat, ChatModel };
10 changes: 5 additions & 5 deletions frontend/app/view/helpview/helpview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const docsiteWebUrl = "https://docs.waveterm.dev/";
const baseUrlRegex = /http[s]?:\/\/([^:\/])+(:\d+)?/;

class HelpViewModel extends WebViewModel {
get viewComponent(): ViewComponent {
return HelpView;
}

constructor(blockId: string, nodeModel: BlockNodeModel) {
super(blockId, nodeModel);
this.viewText = atom((get) => {
Expand Down Expand Up @@ -137,10 +141,6 @@ class HelpViewModel extends WebViewModel {
}
}

function makeHelpViewModel(blockId: string, nodeModel: BlockNodeModel) {
return new HelpViewModel(blockId, nodeModel);
}

function HelpView(props: ViewComponentProps<HelpViewModel>) {
const model = props.model;
const homepageUrl = useAtomValue(model.homepageUrl);
Expand Down Expand Up @@ -172,4 +172,4 @@ function HelpView(props: ViewComponentProps<HelpViewModel>) {
);
}

export { HelpView, HelpViewModel, makeHelpViewModel };
export { HelpViewModel };
7 changes: 1 addition & 6 deletions frontend/app/view/preview/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -869,11 +869,6 @@ export class PreviewModel implements ViewModel {
}
}

function makePreviewModel(blockId: string, nodeModel: BlockNodeModel): PreviewModel {
const previewModel = new PreviewModel(blockId, nodeModel);
return previewModel;
}

function MarkdownPreview({ model }: SpecializedViewProps) {
const connName = useAtomValue(model.connection);
const fileInfo = useAtomValue(model.statFile);
Expand Down Expand Up @@ -1231,4 +1226,4 @@ const OpenFileModal = memo(
}
);

export { makePreviewModel, PreviewView };
export { PreviewView };
6 changes: 1 addition & 5 deletions frontend/app/view/quicktipsview/quicktipsview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ class QuickTipsViewModel implements ViewModel {
}
}

function makeQuickTipsViewModel() {
return new QuickTipsViewModel();
}

function QuickTipsView({ model }: { model: QuickTipsViewModel }) {
return (
<div className="quicktips-view">
Expand All @@ -37,4 +33,4 @@ function QuickTipsView({ model }: { model: QuickTipsViewModel }) {
);
}

export { makeQuickTipsViewModel, QuickTipsView, QuickTipsViewModel };
export { QuickTipsViewModel };
7 changes: 1 addition & 6 deletions frontend/app/view/sysinfo/sysinfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,6 @@ class SysinfoViewModel implements ViewModel {
}
}

function makeSysinfoViewModel(blockId: string, viewType: string): SysinfoViewModel {
const sysinfoViewModel = new SysinfoViewModel(blockId, viewType);
return sysinfoViewModel;
}

const plotColors = ["#58C142", "#FFC107", "#FF5722", "#2196F3", "#9C27B0", "#00BCD4", "#FFEB3B", "#795548"];

type SysinfoViewProps = {
Expand Down Expand Up @@ -562,4 +557,4 @@ const SysinfoViewInner = React.memo(({ model }: SysinfoViewProps) => {
);
});

export { makeSysinfoViewModel, SysinfoView, SysinfoViewModel };
export { SysinfoViewModel };
7 changes: 1 addition & 6 deletions frontend/app/view/waveai/waveai.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,6 @@ export class WaveAiModel implements ViewModel {
}
}

function makeWaveAiViewModel(blockId: string): WaveAiModel {
const waveAiModel = new WaveAiModel(blockId);
return waveAiModel;
}

const ChatItem = ({ chatItemAtom, model }: ChatItemProps) => {
const chatItem = useAtomValue(chatItemAtom);
const { user, text } = chatItem;
Expand Down Expand Up @@ -873,4 +868,4 @@ const WaveAi = ({ model }: { model: WaveAiModel; blockId: string }) => {
);
};

export { makeWaveAiViewModel, WaveAi };
export { WaveAi };
7 changes: 1 addition & 6 deletions frontend/app/view/webview/webview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,6 @@ export class WebViewModel implements ViewModel {
}
}

function makeWebViewModel(blockId: string, nodeModel: BlockNodeModel): WebViewModel {
const webviewModel = new WebViewModel(blockId, nodeModel);
return webviewModel;
}

const BookmarkTypeahead = memo(
({ model, blockRef }: { model: WebViewModel; blockRef: React.RefObject<HTMLDivElement> }) => {
const openBookmarksJson = () => {
Expand Down Expand Up @@ -898,4 +893,4 @@ const WebView = memo(({ model, onFailLoad, blockRef }: WebViewProps) => {
);
});

export { WebView, makeWebViewModel };
export { WebView };

0 comments on commit af65c2c

Please sign in to comment.