Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pop up delay #1340

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions schema/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@
"title": "Hide hidden file warning",
"description": "If true, the warning popup when opening the .gitignore file without hidden files will not be displayed.",
"default": false
},
"popupDuration": {
"type": "integer",
"title": "Popup duration",
"description": "Number of seconds a popup is displayed.",
"default": 10
}
},
"jupyter.lab.shortcuts": [
Expand Down
30 changes: 27 additions & 3 deletions src/cloneCommand.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from '@jupyterlab/apputils';
import { IChangedArgs } from '@jupyterlab/coreutils';
import { IDefaultFileBrowser } from '@jupyterlab/filebrowser';
import { ISettingRegistry } from '@jupyterlab/settingregistry';
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
import * as React from 'react';
import {
Expand All @@ -28,20 +29,41 @@ import { CommandIDs, IGitExtension } from './tokens';
import { GitCloneForm } from './widgets/GitCloneForm';
import { showDetails, showError } from './notifications';

const gitClonePluginId = '@jupyterlab/git:clone';

export const gitCloneCommandPlugin: JupyterFrontEndPlugin<void> = {
id: '@jupyterlab/git:clone',
requires: [IGitExtension, IDefaultFileBrowser, IToolbarWidgetRegistry],
id: gitClonePluginId,
requires: [
IGitExtension,
IDefaultFileBrowser,
IToolbarWidgetRegistry,
ISettingRegistry
],
optional: [ICommandPalette, ITranslator],
activate: (
activate: async (
app: JupyterFrontEnd,
gitModel: IGitExtension,
fileBrowser: IDefaultFileBrowser,
toolbarRegistry: IToolbarWidgetRegistry,
settingRegistry: ISettingRegistry,
palette: ICommandPalette | null,
translator: ITranslator | null
) => {
translator = translator ?? nullTranslator;
const trans = translator.load('jupyterlab_git');

// Attempt to load application settings
let settings: ISettingRegistry.ISettings | undefined = undefined;
try {
settings = await settingRegistry.load(gitClonePluginId);
} catch (error) {
console.error(
trans.__('Failed to load settings for the Git Extension.\n%1', error)
);
}
const popupDuration =
((settings?.composite['popupDuration'] as number) ?? 5) * 1000;

const fileBrowserModel = fileBrowser.model;
/** Add git clone command */
app.commands.addCommand(CommandIDs.gitClone, {
Expand Down Expand Up @@ -81,6 +103,7 @@ export const gitCloneCommandPlugin: JupyterFrontEndPlugin<void> = {
id,
message: trans.__('Successfully cloned'),
type: 'success',
autoClose: popupDuration,
...showDetails(details, trans)
});
await fileBrowserModel.refresh();
Expand All @@ -93,6 +116,7 @@ export const gitCloneCommandPlugin: JupyterFrontEndPlugin<void> = {
id,
message: trans.__('Failed to clone'),
type: 'error',
autoClose: popupDuration,
...showError(error as Error, trans)
});
throw error;
Expand Down
17 changes: 15 additions & 2 deletions src/commandsAndMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@
const { commands, shell, serviceManager } = app;
const trans = translator.load('jupyterlab_git');

const popupDuration = (settings.composite['popupDuration'] as number) * 1000;

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.8

git-commands › git:context-discard › status:staged - x: may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.8

git-commands › git:context-discard › status:staged - x:M may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.8

git-commands › git:context-discard › status:staged - x:A may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.8

git-commands › git:context-discard › status:partially-staged - x: may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.8

git-commands › git:context-discard › status:partially-staged - x:M may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.8

git-commands › git:context-discard › status:partially-staged - x:A may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.8

git-commands › git:context-discard › status:unstaged - x: may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.8

git-commands › git:context-discard › status:unstaged - x:M may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.8

git-commands › git:context-discard › status:unstaged - x:A may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.8

git-commands › git:context-discard › status:untracked - x: may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.9

git-commands › git:context-discard › status:staged - x: may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.9

git-commands › git:context-discard › status:staged - x:M may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.9

git-commands › git:context-discard › status:staged - x:A may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.9

git-commands › git:context-discard › status:partially-staged - x: may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.9

git-commands › git:context-discard › status:partially-staged - x:M may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.9

git-commands › git:context-discard › status:partially-staged - x:A may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.9

git-commands › git:context-discard › status:unstaged - x: may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.9

git-commands › git:context-discard › status:unstaged - x:M may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.9

git-commands › git:context-discard › status:unstaged - x:A may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.9

git-commands › git:context-discard › status:untracked - x: may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.10

git-commands › git:context-discard › status:staged - x: may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.10

git-commands › git:context-discard › status:staged - x:M may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.10

git-commands › git:context-discard › status:staged - x:A may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.10

git-commands › git:context-discard › status:partially-staged - x: may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.10

git-commands › git:context-discard › status:partially-staged - x:M may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.10

git-commands › git:context-discard › status:partially-staged - x:A may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.10

git-commands › git:context-discard › status:unstaged - x: may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.10

git-commands › git:context-discard › status:unstaged - x:M may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.10

git-commands › git:context-discard › status:unstaged - x:A may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

Check failure on line 143 in src/commandsAndMenu.tsx

View workflow job for this annotation

GitHub Actions / Test Python 3.10

git-commands › git:context-discard › status:untracked - x: may reset and/or checkout

TypeError: Cannot read properties of null (reading 'composite') at composite (src/commandsAndMenu.tsx:143:35) at Object.<anonymous> (src/__tests__/commands.spec.tsx:60:16)

/**
* Commit using a keystroke combination when in CommitBox.
*
Expand Down Expand Up @@ -238,7 +240,7 @@
id,
message: trans.__('Git repository initialized.'),
type: 'success',
autoClose: 5000
autoClose: popupDuration
});
} catch (error) {
console.error(
Expand All @@ -251,6 +253,7 @@
id,
message: trans.__('Failed to initialize the Git repository'),
type: 'error',
autoClose: popupDuration,
...showError(error as Error, trans)
});
}
Expand Down Expand Up @@ -490,6 +493,7 @@
id,
message: trans.__('Successfully pushed'),
type: 'success',
autoClose: popupDuration,
...showDetails(details, trans)
});
} catch (error: any) {
Expand All @@ -506,6 +510,7 @@
id,
message,
type: 'error',
autoClose: popupDuration,
...options
});
} else {
Expand Down Expand Up @@ -551,6 +556,7 @@
id,
message: trans.__('Successfully pulled'),
type: 'success',
autoClose: popupDuration,
...showDetails(details, trans)
});
} catch (error: any) {
Expand Down Expand Up @@ -587,6 +593,7 @@
Notification.update({
id,
message,
autoClose: popupDuration,
...options
});
} else {
Expand Down Expand Up @@ -637,7 +644,11 @@
}
const message = trans.__('Resetting...');
if (id) {
Notification.update({ id, message });
Notification.update({
id,
message,
autoClose: popupDuration
});
} else {
id = Notification.emit(message, 'in-progress', {
autoClose: false
Expand All @@ -649,6 +660,7 @@
id,
message: trans.__('Successfully reset'),
type: 'success',
autoClose: popupDuration,
...showDetails(
trans.__(
'Successfully reset the current branch to its remote state'
Expand All @@ -668,6 +680,7 @@
id,
type: 'error',
message,
autoClose: popupDuration,
...options
});
} else {
Expand Down
Loading
Loading