Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
]));
cardStorage.set('state', {
cards: currentCards || tempState.cards,
labels: loadLabels(currentCards) || [],
});
// * Clear tmp/state key
userStorage.delete('tmp/state');
} else if (userCardsInStorage.length || userLabelsInStorage.length) {
cardStorage.set('state', {
cards: getUniqCardsById([...userCardsInStorage]) || tempState.cards,
labels: loadLabels(userCardsInStorage) || [],
});
userStorage.delete('state');
}
logger.log('LOADED CARDS STORAGE', cardStorage.get('state'));
global.cardStorage = cardStorage;
global.userStorage = userStorage;
// * CHANGE CWD EVENT
ipcMain.on('CHANGED-CWD', () => {
logger.info('CURRENT WORKING DIRECTORY CHANGED');
const currentUserState = cardStorage.get('state');
const newCwd = getCwd(userStorage.get('settings'));
const newCardStorage = new Storage({
name: 'mdyna-card-data',
newCwd,
});
logger.info('PORTING STATE FROM OLD CWD [', cwd, '] TO [', newCwd, ']');
logger.log(newCardStorage.get('state'), cardStorage.get('state'));
if (currentUserState) {
userStorage.set('tmp/state', currentUserState);
return new Promise((resolve, reject) => {
log.log('starting metascan...')
const pathStats = fs.statSync(pathname)
log.log('file size: ', pathStats.size)
const msStart = process.hrtime()
let firstRow = true
var colTypes: Array
let rowCount = 0
// extract table name from file path:
const tableName = genTableName(pathname)
let csvOptions = { delimiter }
const pathStream = fs.createReadStream(pathname)
let gauge = new Gauge()
const numREs = (delimiter === ';') ? eurNumREs : usNumREs
const guessFunc = guessColumnType(numREs)
ipcMain.on('log', (event, entry) => {
log.log(entry);
});
this._server = {
token: data.token,
url: data.url,
name: 'Local',
type: 'local',
};
PageConfig.setOption('token', this._server.token);
PageConfig.setOption('baseUrl', this._server.url);
this._setupLab();
try {
this._lab.start({'ignorePlugins': this._ignorePlugins});
} catch (e) {
log.log(e);
}
this._lab.restored.then( () => {
ipcRenderer.send('lab-ready');
(this.refs.splash as SplashScreen).fadeSplashScreen();
});
}
const handleOpen = (event, filePath) => {
log.log('handleOpen called!')
log.warn('got open-file event for: ', filePath)
event.preventDefault()
const targetPath = getTargetPath(options, filePath)
if (isReady) {
log.warn('open-file: app is ready, opening in new window')
appWindow.create(targetPath)
} else {
openFilePath = targetPath
log.warn('open-file: set openFilePath ' + targetPath)
}
}
private _connectionAdded(server: JupyterServer.IServer) {
PageConfig.setOption('baseUrl', server.url);
PageConfig.setOption('token', server.token);
try {
this._lab.start({'ignorePlugins': this._ignorePlugins});
} catch (e) {
log.log(e);
}
let rServer: Application.IRemoteServer = {...server, id: this._nextRemoteId++};
this.setState((prevState: ServerManager.State) => {
server.id = this._nextRemoteId++;
let remotes = this.state.remotes.concat(rServer);
this._saveState();
return({
renderState: this._renderEmpty,
remotes: remotes
});
});
}
autoUpdater.on('download-progress', (arg) => {
logger.log('download-progress');
logger.log(arg);
});
function loadBoards(boards) {
logger.log('LOADING BOARDS', boards);
const boardNames = ['INBOX'];
const boardList = [
{
name: 'INBOX',
cards: 'all',
bg: 'default',
labels: 'all',
},
];
for (let i = 0; i < boards.length; i += 1) {
const board = boards[i];
const { name } = board;
if (name && name !== 'INBOX') {
boardList.push(board);
boardNames.push(name);
}
app.on('ready', () => {
logger.log('Main Electron Logs');
logger.error('Main Electron Logs');
mainWindow = new BrowserWindow(MDYNA_WINDOW_OPTIONS);
const splash = new BrowserWindow(SPLASH_WINDOW_OPTIONS);
splash.loadURL(`file://${__dirname}/splash.html`);
splash.show();
runUpdater();
const { webContents } = mainWindow;
const handleRedirect = (e, url) => {
if (url !== webContents.getURL()) {
e.preventDefault();
shell.openExternal(url);
public async log(message?: unknown, ...optionalParams: unknown[]): Promise {
ElectronLog.log(message, ...optionalParams);
}