Skip to content

Commit

Permalink
Merge pull request #108 from enonic/issue-106
Browse files Browse the repository at this point in the history
Spinner is not visible while application list is being fetched #106
  • Loading branch information
alansemenov authored Sep 9, 2019
2 parents 448da35 + 6ff7c47 commit e254b97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import '../../api.ts';
import {ApplicationInput} from './view/ApplicationInput';
import {MarketAppsTreeGrid} from './view/MarketAppsTreeGrid';
import {ApplicationUploaderEl} from './ApplicationUploaderEl';
import {ApplicationUploadStartedEvent} from '../browse/ApplicationUploadStartedEvent';
import TreeNode = api.ui.treegrid.TreeNode;
import Application = api.application.Application;
import i18n = api.util.i18n;
import DivEl = api.dom.DivEl;
import MarketApplication = api.application.MarketApplication;
import UploadFailedEvent = api.ui.uploader.UploadFailedEvent;
import UploadStartedEvent = api.ui.uploader.UploadStartedEvent;
import ButtonEl = api.dom.ButtonEl;
import StringHelper = api.util.StringHelper;
import i18n = api.util.i18n;

export class InstallAppDialog
extends api.ui.dialog.ModalDialog {
Expand Down Expand Up @@ -59,15 +58,10 @@ export class InstallAppDialog

this.applicationInput.onTextValueChanged(() => {
this.clearButton.setVisible(!StringHelper.isEmpty(this.applicationInput.getValue()));
this.marketAppsTreeGrid.mask();
this.marketAppsTreeGrid.refresh();
});

const showMask = api.util.AppHelper.debounce(this.marketAppsTreeGrid.mask.bind(this.marketAppsTreeGrid), 300, false);
this.applicationInput.getTextInput().onValueChanged(() => {
if (!this.applicationInput.isUrlTyped()) {
showMask();
}
});
this.applicationInput.onAppInstallStarted(() => {
this.marketAppsTreeGrid.mask();
this.statusMessage.showInstalling();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ import UploadFailedEvent = api.ui.uploader.UploadFailedEvent;

export class ApplicationInput extends api.dom.CompositeFormInputEl {

private static LAST_KEY_PRESS_TIMEOUT: number = 300;

private textInput: InputEl;

private applicationUploaderEl: ApplicationUploaderEl;
private LAST_KEY_PRESS_TIMEOUT: number;

private cancelAction: Action;

private textValueChangedListeners: {(): void}[] = [];
Expand Down Expand Up @@ -40,7 +43,6 @@ export class ApplicationInput extends api.dom.CompositeFormInputEl {
showCancel: false
}));

this.LAST_KEY_PRESS_TIMEOUT = 750;
this.cancelAction = cancelAction;

this.applicationUploaderEl.onUploadStarted((event: UploadStartedEvent<Application>) => {
Expand All @@ -67,7 +69,7 @@ export class ApplicationInput extends api.dom.CompositeFormInputEl {
}

private initUrlEnteredHandler() {
const keyDownHandler: () => void = api.util.AppHelper.debounce(this.startInstall.bind(this), this.LAST_KEY_PRESS_TIMEOUT);
const keyDownHandler: () => void = api.util.AppHelper.debounce(() => this.startInstall(), ApplicationInput.LAST_KEY_PRESS_TIMEOUT);

this.onKeyDown((event) => {
switch (event.keyCode) {
Expand Down

0 comments on commit e254b97

Please sign in to comment.