Skip to content

Commit

Permalink
fixed popup hide
Browse files Browse the repository at this point in the history
  • Loading branch information
ganigeorgiev committed Aug 6, 2022
1 parent 5fb45a1 commit 51d635b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
11 changes: 6 additions & 5 deletions forms/collection_upsert.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,21 @@ type CollectionUpsertConfig struct {
// If you want to submit the form as part of another transaction, use
// [NewCollectionUpsertWithConfig] with Dao configured to your txDao.
func NewCollectionUpsert(app core.App, collection *models.Collection) *CollectionUpsert {
form := NewCollectionUpsertWithConfig(CollectionUpsertConfig{
return NewCollectionUpsertWithConfig(CollectionUpsertConfig{
Dao: app.Dao(),
}, collection)

return form
}

// NewCollectionUpsertWithConfig creates a new [CollectionUpsert] form
// with the provided config and [models.Collection] instance or panics on invalid configuration
// (for create you could pass a pointer to an empty Collection instance - `&models.Collection{}`).
func NewCollectionUpsertWithConfig(config CollectionUpsertConfig, collection *models.Collection) *CollectionUpsert {
form := &CollectionUpsert{config: config}
form := &CollectionUpsert{
config: config,
collection: collection,
}

if form.config.Dao == nil || collection == nil {
if form.config.Dao == nil || form.collection == nil {
panic("Invalid initializer config or nil upsert model.")
}

Expand Down
9 changes: 6 additions & 3 deletions ui/src/components/settings/ImportPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,18 @@
ApiClient.errorResponseHandler(err);
}
hide();
isImporting = false;
hide();
}
</script>
<OverlayPanel
bind:this={panel}
class="full-width-popup import-popup"
overlayClose={false}
escClose={!isImporting}
beforeHide={() => !isImporting}
popup
on:show
on:hide
Expand Down Expand Up @@ -172,11 +174,12 @@
</div>
<svelte:fragment slot="footer">
<button type="button" class="btn btn-secondary" on:click={hide}>Close</button>
<button type="button" class="btn btn-secondary" on:click={hide} disabled={isImporting}>Close</button>
<button
type="button"
class="btn btn-expanded"
class:btn-loading={isImporting}
disabled={isImporting}
on:click={() => submitImport()}
>
<span class="txt">Confirm and import</span>
Expand Down

0 comments on commit 51d635b

Please sign in to comment.