mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 01:16:01 +00:00
update status with icon
This commit is contained in:
@@ -458,19 +458,25 @@ function createWindow() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeAppUpdateStatus(message) {
|
function changeAppUpdateStatus(status) {
|
||||||
appUpdateStatus = message;
|
appUpdateStatus = status;
|
||||||
mainWindow.webContents.send('app-update-status', appUpdateStatus);
|
mainWindow.webContents.send('app-update-status', appUpdateStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
autoUpdater.on('checking-for-update', () => {
|
autoUpdater.on('checking-for-update', () => {
|
||||||
console.log('Checking for updates');
|
console.log('Checking for updates');
|
||||||
changeAppUpdateStatus('Checking for updates...');
|
changeAppUpdateStatus({
|
||||||
|
icon: 'icon loading',
|
||||||
|
message: 'Checking for updates...',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-available', info => {
|
autoUpdater.on('update-available', info => {
|
||||||
console.log('Update available', info);
|
console.log('Update available', info);
|
||||||
changeAppUpdateStatus(`New version ${info.version} available`);
|
changeAppUpdateStatus({
|
||||||
|
icon: 'icon download',
|
||||||
|
message: `New version ${info.version} available`,
|
||||||
|
});
|
||||||
if (!autoUpdater.autoDownload) {
|
if (!autoUpdater.autoDownload) {
|
||||||
mainWindow.webContents.send('update-available', info.version);
|
mainWindow.webContents.send('update-available', info.version);
|
||||||
}
|
}
|
||||||
@@ -478,17 +484,26 @@ autoUpdater.on('update-available', info => {
|
|||||||
|
|
||||||
autoUpdater.on('update-not-available', info => {
|
autoUpdater.on('update-not-available', info => {
|
||||||
console.log('Update not available', info);
|
console.log('Update not available', info);
|
||||||
changeAppUpdateStatus(`No new updates`);
|
changeAppUpdateStatus({
|
||||||
|
icon: 'icon check',
|
||||||
|
message: `No new updates`,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-downloaded', info => {
|
autoUpdater.on('update-downloaded', info => {
|
||||||
console.log('Update downloaded from', info);
|
console.log('Update downloaded from', info);
|
||||||
changeAppUpdateStatus(`Downloaded new version ${info.version}`);
|
changeAppUpdateStatus({
|
||||||
|
icon: 'icon download',
|
||||||
|
message: `Downloaded new version ${info.version}`,
|
||||||
|
});
|
||||||
mainWindow.webContents.send('downloaded-new-version', info.version);
|
mainWindow.webContents.send('downloaded-new-version', info.version);
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('error', error => {
|
autoUpdater.on('error', error => {
|
||||||
changeAppUpdateStatus(`Autoupdate error`);
|
changeAppUpdateStatus({
|
||||||
|
icon: 'icon error',
|
||||||
|
message: `Autoupdate error`,
|
||||||
|
});
|
||||||
console.error('Update error', error);
|
console.error('Update error', error);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -140,6 +140,7 @@
|
|||||||
'icon custom-join': 'mdi mdi-arrow-left-right-bold',
|
'icon custom-join': 'mdi mdi-arrow-left-right-bold',
|
||||||
'icon parent-filter': 'mdi mdi-home-alert',
|
'icon parent-filter': 'mdi mdi-home-alert',
|
||||||
'icon parent-filter-outline': 'mdi mdi-home-alert-outline',
|
'icon parent-filter-outline': 'mdi mdi-home-alert-outline',
|
||||||
|
'icon download': 'mdi mdi-download',
|
||||||
|
|
||||||
'icon run': 'mdi mdi-play',
|
'icon run': 'mdi mdi-play',
|
||||||
'icon chevron-down': 'mdi mdi-chevron-down',
|
'icon chevron-down': 'mdi mdi-chevron-down',
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ export const commandsCustomized = derived([commands, commandsSettings], ([$comma
|
|||||||
...$commandsSettings[k],
|
...$commandsSettings[k],
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
export const appUpdateStatus = writable('');
|
export const appUpdateStatus = writable(null);
|
||||||
export const appUpdaterActive = writable(false);
|
export const appUpdaterActive = writable(false);
|
||||||
|
|
||||||
export const draggingTab = writable(null);
|
export const draggingTab = writable(null);
|
||||||
@@ -310,4 +310,4 @@ let appUpdaterActiveValue = false;
|
|||||||
appUpdaterActive.subscribe(value => {
|
appUpdaterActive.subscribe(value => {
|
||||||
appUpdaterActiveValue = value;
|
appUpdaterActiveValue = value;
|
||||||
});
|
});
|
||||||
export const getAppUpdaterActive = () => appUpdaterActiveValue;
|
export const getAppUpdaterActive = () => appUpdaterActiveValue;
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ export function initializeAppUpdates() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
electron.addEventListener('app-update-status', (e, text) => {
|
electron.addEventListener('app-update-status', (e, value) => {
|
||||||
appUpdateStatus.set(text);
|
appUpdateStatus.set(value);
|
||||||
});
|
});
|
||||||
|
|
||||||
electron.addEventListener('downloaded-new-version', (e, version) => {
|
electron.addEventListener('downloaded-new-version', (e, version) => {
|
||||||
|
|||||||
@@ -173,7 +173,8 @@
|
|||||||
|
|
||||||
{#if $appUpdateStatus}
|
{#if $appUpdateStatus}
|
||||||
<div class="item">
|
<div class="item">
|
||||||
{$appUpdateStatus}
|
<FontIcon icon={$appUpdateStatus.icon} padRight />
|
||||||
|
{$appUpdateStatus.message}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user