Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
icon.classList.add(NOTEBOOK_MATERIAL_ICON_CLASS);
break;
case 'file':
icon.classList.add(this.parseFileExtension(model.path));
break;
default:
icon.classList.add(MATERIAL_ICON_CLASS);
icon.classList.add(FILE_TYPE_CLASS);
break;
}
let modText = '';
let modTitle = '';
if (model.last_modified) {
modText = Time.formatHuman(model.last_modified);
modTitle = Time.format(model.last_modified);
}
// If an item is being edited currently, its text node is unavailable.
if (text) {
text.textContent = model.name;
}
modified.textContent = modText;
modified.title = modTitle;
}
} else {
icon.textContent = '';
icon.className = ITEM_ICON_CLASS;
}
node.title = model.name;
// If an item is being edited currently, its text node is unavailable.
if (text) {
text.textContent = model.name;
}
let modText = '';
let modTitle = '';
if (model.last_modified) {
modText = Time.formatHuman(new Date(model.last_modified));
modTitle = Time.format(new Date(model.last_modified), 'lll');
}
modified.textContent = modText;
modified.title = modTitle;
}
icon.textContent = '';
// clean up the svg icon annotation, if any
delete icon.dataset.icon;
}
node.title = model.name;
// If an item is being edited currently, its text node is unavailable.
if (text && text.textContent !== model.name) {
text.textContent = model.name;
}
let modText = '';
let modTitle = '';
if (model.last_modified) {
modText = Time.formatHuman(new Date(model.last_modified));
modTitle = Time.format(new Date(model.last_modified), 'lll');
}
modified.textContent = modText;
modified.title = modTitle;
}
it('should convert a timestring to a date format', () => {
expect(Time.format(new Date()).length).to.equal(16);
const date = new Date();
const value = Time.format(date.toISOString(), 'MM-DD');
expect(value.length).to.equal(5);
});
});
it('should convert a timestring to a date format', () => {
expect(Time.format(new Date()).length).to.equal(16);
const date = new Date();
const value = Time.format(date.toISOString(), 'MM-DD');
expect(value.length).to.equal(5);
});
});
function updateTitle(panel: ConsolePanel, connected: Date | null, executed: Date | null) {
let session = panel.console.session;
let caption = (
`Name: ${session.name}\n` +
`Directory: ${PathExt.dirname(session.path)}\n` +
`Kernel: ${session.kernelDisplayName}`
);
if (connected) {
caption += `\nConnected: ${Time.format(connected.toISOString())}`;
}
if (executed) {
caption += `\nLast Execution: ${Time.format(executed.toISOString())}`;
}
panel.title.label = session.name;
panel.title.caption = caption;
}
}
.then((checkpoints: Contents.ICheckpointModel[]) => {
if (widget.isDisposed) {
return;
}
let last = checkpoints[checkpoints.length - 1];
let checkpoint = last ? Time.format(last.last_modified) : 'None';
let caption = `Name: ${model.name}\nPath: ${model.path}\n`;
if (context.model.readOnly) {
caption += 'Read-only';
} else {
caption +=
`Last Saved: ${Time.format(model.last_modified)}\n` +
`Last Checkpoint: ${checkpoint}`;
}
widget.title.caption = caption;
});
}
.then((checkpoints: Contents.ICheckpointModel[]) => {
if (widget.isDisposed) {
return;
}
let last = checkpoints[checkpoints.length - 1];
let checkpoint = last ? Time.format(last.last_modified) : 'None';
let caption = `Name: ${model.name}\nPath: ${model.path}\n`;
if (context.readOnly) {
caption += 'Read-only';
} else {
caption +=
`Last Saved: ${Time.format(model.last_modified)}\n` +
`Last Checkpoint: ${checkpoint}`;
}
widget.title.caption = caption;
});
}
.then((checkpoints: Contents.ICheckpointModel[]) => {
if (widget.isDisposed) {
return;
}
let last = checkpoints[checkpoints.length - 1];
let checkpoint = last ? Time.format(last.last_modified) : 'None';
let caption = `Name: ${model.name}\nPath: ${model.path}\n`;
if (context.readOnly) {
caption += 'Read-only';
} else {
caption +=
`Last Saved: ${Time.format(model.last_modified)}\n` +
`Last Checkpoint: ${checkpoint}`;
}
widget.title.caption = caption;
});
}
.then((checkpoints: Contents.ICheckpointModel[]) => {
if (widget.isDisposed) {
return;
}
let last = checkpoints[checkpoints.length - 1];
let checkpoint = last ? Time.format(last.last_modified) : 'None';
let caption = `Name: ${model.name}\nPath: ${model.path}\n`;
if (context.model.readOnly) {
caption += 'Read-only';
} else {
caption +=
`Last Saved: ${Time.format(model.last_modified)}\n` +
`Last Checkpoint: ${checkpoint}`;
}
widget.title.caption = caption;
});
}