Manual-commit notebook snapshot extension (JupyterLab 4):
Backend
- Storage adapter layer (Local + S3 via boto3, pip extra)
- Dumb put/get/list/delete contract; key validation
- S3Storage: lazy boto3 import, S3ConnectionError with friendly
messages + connectivity check at startup
- SnapshotStore
- Strip code outputs/execution_count, MD5 on cleaned JSON
- Gzipped envelope (id/timestamp/name/description/hash/size/notebook)
- Append-only manifest.json (rebuildable from version files)
- SnapshotUnchangedError when new hash matches most recent version
- REST API (commit / list / content) under /snapshot/ namespace
- traitlets config (storage_type, local_root, s3_* + S3_* env fallback)
Frontend
- snapshot:commit command (toolbar button + command palette)
- Dialog for name + description
- SnapshotPanel (left sidebar timeline) + DiffWidget (main area)
- Cell diff: id-match first, LCS fallback; jsdiff for line diff
- Restore via model.fromJSON() + context.save() (no refresh)
- All AGENTS.md hard conventions enforced
Tests: 33 backend pytest passing (storage + store + routes)
Docs: AGENTS.md, design.md, README.md synced with implementation.
Co-Authored-By: Claude <noreply@anthropic.com>
207 lines
3.8 KiB
CSS
207 lines
3.8 KiB
CSS
/*
|
|
See the JupyterLab Developer Guide for useful CSS Patterns:
|
|
|
|
https://jupyterlab.readthedocs.io/en/stable/developer/css.html
|
|
*/
|
|
|
|
/* snapshot extension */
|
|
|
|
.jp-snapshot-panel {
|
|
padding: 8px;
|
|
overflow-y: auto;
|
|
height: 100%;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.jp-snapshot-panel-empty {
|
|
color: var(--jp-ui-font-color2, #555);
|
|
padding: 12px;
|
|
text-align: center;
|
|
}
|
|
|
|
.jp-snapshot-panel-hint {
|
|
font-size: 0.85em;
|
|
margin-top: 8px;
|
|
color: var(--jp-ui-font-color2, #888);
|
|
}
|
|
|
|
.jp-snapshot-panel-list {
|
|
list-style: none;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
.jp-snapshot-panel-item {
|
|
border: 1px solid var(--jp-border-color2, #ddd);
|
|
border-radius: 4px;
|
|
padding: 8px;
|
|
margin-bottom: 8px;
|
|
background: var(--jp-layout-color1, #fff);
|
|
}
|
|
|
|
.jp-snapshot-panel-item-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
.jp-snapshot-panel-name {
|
|
font-weight: 600;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.jp-snapshot-panel-size {
|
|
font-size: 0.8em;
|
|
color: var(--jp-ui-font-color2, #888);
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.jp-snapshot-panel-desc {
|
|
font-size: 0.9em;
|
|
color: var(--jp-ui-font-color2, #555);
|
|
margin: 4px 0;
|
|
white-space: pre-wrap;
|
|
}
|
|
|
|
.jp-snapshot-panel-time {
|
|
font-size: 0.8em;
|
|
color: var(--jp-ui-font-color2, #888);
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.jp-snapshot-panel-actions {
|
|
display: flex;
|
|
gap: 4px;
|
|
}
|
|
|
|
.jp-snapshot-panel-button {
|
|
flex: 1;
|
|
padding: 4px 8px;
|
|
font-size: 0.85em;
|
|
border: 1px solid var(--jp-border-color2, #ccc);
|
|
border-radius: 3px;
|
|
background: var(--jp-layout-color2, #f5f5f5);
|
|
cursor: pointer;
|
|
}
|
|
|
|
.jp-snapshot-panel-button:hover {
|
|
background: var(--jp-layout-color3, #e8e8e8);
|
|
}
|
|
|
|
/* commit dialog */
|
|
|
|
.jp-snapshot-commit-dialog {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 6px;
|
|
padding: 8px;
|
|
min-width: 320px;
|
|
}
|
|
|
|
.jp-snapshot-commit-dialog label {
|
|
font-weight: 600;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
.jp-snapshot-commit-dialog-name,
|
|
.jp-snapshot-commit-dialog-desc {
|
|
font-family: inherit;
|
|
font-size: 1em;
|
|
padding: 4px 6px;
|
|
border: 1px solid var(--jp-border-color2, #ccc);
|
|
border-radius: 3px;
|
|
box-sizing: border-box;
|
|
width: 100%;
|
|
}
|
|
|
|
.jp-snapshot-commit-dialog-desc {
|
|
resize: vertical;
|
|
}
|
|
|
|
/* diff widget */
|
|
|
|
.jp-snapshot-diff-widget {
|
|
padding: 8px;
|
|
overflow-y: auto;
|
|
height: 100%;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.jp-snapshot-diff-container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
}
|
|
|
|
.jp-snapshot-diff-row {
|
|
border: 1px solid var(--jp-border-color2, #ddd);
|
|
border-radius: 4px;
|
|
padding: 6px;
|
|
background: var(--jp-layout-color1, #fff);
|
|
}
|
|
|
|
.jp-snapshot-diff-added {
|
|
background: var(--jp-diff-added-color1, #e6ffed);
|
|
border-left: 3px solid #2cbe4e;
|
|
}
|
|
|
|
.jp-snapshot-diff-deleted {
|
|
background: var(--jp-diff-deleted-color1, #ffeef0);
|
|
border-left: 3px solid #cb2431;
|
|
}
|
|
|
|
.jp-snapshot-diff-modified {
|
|
background: var(--jp-diff-modified-color1, #fff5b1);
|
|
border-left: 3px solid #dfb700;
|
|
}
|
|
|
|
.jp-snapshot-diff-unchanged {
|
|
background: var(--jp-layout-color1, #fff);
|
|
border-left: 3px solid var(--jp-border-color2, #ddd);
|
|
}
|
|
|
|
.jp-snapshot-diff-badge {
|
|
display: inline-block;
|
|
font-size: 0.8em;
|
|
font-weight: 600;
|
|
padding: 1px 6px;
|
|
border-radius: 3px;
|
|
margin-right: 6px;
|
|
background: var(--jp-layout-color2, #eee);
|
|
}
|
|
|
|
.jp-snapshot-diff-cell-type {
|
|
display: inline-block;
|
|
font-size: 0.8em;
|
|
color: var(--jp-ui-font-color2, #888);
|
|
}
|
|
|
|
.jp-snapshot-diff-pre {
|
|
font-family: var(--jp-code-font-family, monospace);
|
|
font-size: 0.9em;
|
|
margin: 6px 0 0 0;
|
|
white-space: pre-wrap;
|
|
word-break: break-all;
|
|
}
|
|
|
|
.jp-snapshot-diff-line-added {
|
|
background: #ccffd8;
|
|
}
|
|
|
|
.jp-snapshot-diff-line-removed {
|
|
background: #ffd7d5;
|
|
}
|
|
|
|
.jp-snapshot-diff-line-context {
|
|
color: var(--jp-ui-font-color2, #555);
|
|
}
|
|
|
|
.jp-snapshot-diff-empty {
|
|
color: var(--jp-ui-font-color2, #888);
|
|
text-align: center;
|
|
padding: 16px;
|
|
}
|