import React from "react"; import { computed, makeObservable } from "mobx"; import { observer } from "mobx-react"; import { formatDateTimeLong } from "eez-studio-shared/util"; import { IStore } from "eez-studio-shared/store"; import { Icon } from "eez-studio-ui/icon"; import type { IAppStore } from "instrument/window/history/history"; import { HistoryItem } from "instrument/window/history/item"; import { IActivityLogEntry } from "instrument/window/history/activity-log"; import { HistoryItemInstrumentInfo } from "../HistoryItemInstrumentInfo"; //////////////////////////////////////////////////////////////////////////////// export const ScriptHistoryItemComponent = observer( class ScriptHistoryItemComponent extends React.Component< { appStore: IAppStore; historyItem: ScriptHistoryItem; }, {} > { render() { return (

{formatDateTimeLong( this.props.historyItem.date )}

{this.props.historyItem.getSourceDescriptionElement( this.props.appStore )} {this.props.historyItem.scriptMessage .parameters && ( )} {this.props.historyItem.scriptMessage.done && ( )}
Name { this.props.historyItem.scriptMessage .name }
Type { this.props.historyItem.scriptMessage .type }
Parameters
                                                {JSON.stringify(
                                                    this.props.historyItem
                                                        .scriptMessage
                                                        .parameters
                                                )}
                                            
Result: {this.props.historyItem .scriptMessage.error ? (
{ this.props.historyItem .scriptMessage.error }
) : ( "Success" )}
); } } ); export interface IScriptHistoryItemMessage { name: string; type: string; parameters?: any; done: boolean; error?: string; } export class ScriptHistoryItem extends HistoryItem { constructor(public store: IStore, activityLogEntry: IActivityLogEntry) { super(store, activityLogEntry); makeObservable(this, { scriptMessage: computed }); } get scriptMessage() { return JSON.parse(this.message) as IScriptHistoryItemMessage; } getListItemElement(appStore: IAppStore): React.ReactNode { return ( ); } }