Skip to content

Commit

Permalink
feat: optional last executed date (#94)
Browse files Browse the repository at this point in the history
* feat: optional last executed date

* docs: show date setting description

* fix: use date format
  • Loading branch information
banteg committed Sep 21, 2023
1 parent 8da85c7 commit 597580e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions schema/settings.json
Expand Up @@ -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",
Expand Down
8 changes: 8 additions & 0 deletions src/ExecuteTimeWidget.ts
Expand Up @@ -29,6 +29,7 @@ export interface IExecuteTimeSettings {
minTime: number;
textContrast: string;
showLiveExecutionTime: boolean;
showDate: boolean;
historyCount: number;
dateFormat: string;
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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',
};
Expand Down

0 comments on commit 597580e

Please sign in to comment.