From 597580e47dd6da2db9392da039e2bad07aa02a0a Mon Sep 17 00:00:00 2001 From: banteg <4562643+banteg@users.noreply.github.com> Date: Fri, 22 Sep 2023 00:03:34 +0400 Subject: [PATCH] feat: optional last executed date (#94) * feat: optional last executed date * docs: show date setting description * fix: use date format --- schema/settings.json | 6 ++++++ src/ExecuteTimeWidget.ts | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/schema/settings.json b/schema/settings.json index a712af2..675150f 100644 --- a/schema/settings.json +++ b/schema/settings.json @@ -41,6 +41,12 @@ "description": "Show the current execution time (last execution time) as a cell executes.", "default": true }, + "showDate": { + "type": "boolean", + "title": "Show Last Execution Date", + "description": "Show the date of last cell execution.", + "default": true + }, "historyCount": { "type": "number", "title": "History of Cell Execution Time", diff --git a/src/ExecuteTimeWidget.ts b/src/ExecuteTimeWidget.ts index 27df3a8..d17d254 100644 --- a/src/ExecuteTimeWidget.ts +++ b/src/ExecuteTimeWidget.ts @@ -29,6 +29,7 @@ export interface IExecuteTimeSettings { minTime: number; textContrast: string; showLiveExecutionTime: boolean; + showDate: boolean; historyCount: number; dateFormat: string; } @@ -276,6 +277,11 @@ export default class ExecuteTimeWidget extends Widget { endTime, this._settings.dateFormat )} in ${executionTime}`; + msg = 'Last executed'; + if (this._settings.showDate) { + msg += ` at ${getTimeString(endTime, this._settings.dateFormat)}`; + } + msg += ` in ${executionTime}`; } } else if (startTime) { if (this._settings.showLiveExecutionTime) { @@ -353,6 +359,7 @@ export default class ExecuteTimeWidget extends Widget { .composite as string; this._settings.showLiveExecutionTime = settings.get('showLiveExecutionTime') .composite as boolean; + this._settings.showDate = settings.get('showDate').composite as boolean; this._settings.historyCount = settings.get('historyCount') .composite as number; @@ -397,6 +404,7 @@ export default class ExecuteTimeWidget extends Widget { minTime: 0, textContrast: 'high', showLiveExecutionTime: true, + showDate: true, historyCount: 5, dateFormat: 'yyy-MM-dd HH:mm:ss', };