Fix double api call in edit window
This commit is contained in:
@@ -317,16 +317,24 @@ onDestroy(() => {
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<button on:click={() => { getStats('query_name') }}>Query</button>
|
<button on:click={() => { getStats('query_name') }}>
|
||||||
|
Query
|
||||||
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button style="cursor: pointer;" on:click={() => { getStats('calls') }}>Calls</button>
|
<button style="cursor: pointer;" on:click={() => { getStats('calls') }}>
|
||||||
|
Calls
|
||||||
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button style="cursor: pointer;" on:click={() => { getStats('average_duration') }}>Avg dur</button>
|
<button style="cursor: pointer;" on:click={() => { getStats('average_duration') }}>
|
||||||
|
Avg
|
||||||
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button style="cursor: pointer;" on:click={() => { getStats('total_duration') }}>Total dur</button>
|
<button style="cursor: pointer;" on:click={() => { getStats('total_duration') }}>
|
||||||
|
Total
|
||||||
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td>Callers</td>
|
<td>Callers</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@@ -12,11 +12,12 @@ let file = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export let visible
|
export let visible
|
||||||
export const edit = (f, t = "file") => {
|
export const edit = (f, oae = false, t = "file") => {
|
||||||
|
file = f
|
||||||
|
open_after_edit = oae
|
||||||
tab = t
|
tab = t
|
||||||
|
|
||||||
console.log("Editing file", f)
|
console.log("Editing file", file)
|
||||||
file = f
|
|
||||||
|
|
||||||
file_name = file.name
|
file_name = file.name
|
||||||
shared = !(file.id === undefined || file.id === "")
|
shared = !(file.id === undefined || file.id === "")
|
||||||
@@ -26,6 +27,7 @@ export const edit = (f, t = "file") => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let tab = "file"
|
let tab = "file"
|
||||||
|
let open_after_edit = false
|
||||||
|
|
||||||
let file_name = ""
|
let file_name = ""
|
||||||
let shared = false
|
let shared = false
|
||||||
@@ -58,7 +60,11 @@ const save = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (open_after_edit) {
|
||||||
fs_navigator.navigate(file.path, false)
|
fs_navigator.navigate(file.path, false)
|
||||||
|
} else {
|
||||||
|
fs_navigator.reload()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const delete_file = async () => {
|
const delete_file = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -69,12 +75,16 @@ const delete_file = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (open_after_edit) {
|
||||||
fs_navigator.navigate(file.path, false)
|
fs_navigator.navigate(file.path, false)
|
||||||
|
} else {
|
||||||
|
fs_navigator.reload()
|
||||||
|
}
|
||||||
visible = false
|
visible = false
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Modal bind:visible={visible} title="Edit {file.name}" width="600px" on:save={save} form="file_edit_form">
|
<Modal bind:visible={visible} title="Edit {file.name}" width="600px" form="file_edit_form">
|
||||||
<div class="tab_bar">
|
<div class="tab_bar">
|
||||||
<button class:button_highlight={tab === "file"} on:click={() => tab = "file"}>
|
<button class:button_highlight={tab === "file"} on:click={() => tab = "file"}>
|
||||||
<i class="icon">edit</i>
|
<i class="icon">edit</i>
|
||||||
|
@@ -58,7 +58,7 @@ const keydown = e => {
|
|||||||
if (edit_visible) {
|
if (edit_visible) {
|
||||||
edit_visible = false
|
edit_visible = false
|
||||||
} else {
|
} else {
|
||||||
edit_window.edit(state.base)
|
edit_window.edit(state.base, true)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "s":
|
case "s":
|
||||||
|
@@ -54,6 +54,10 @@ export const navigate = async (path, push_history) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const reload = () => {
|
||||||
|
navigate(state.base.path, false)
|
||||||
|
}
|
||||||
|
|
||||||
export const open_node = (node, push_history) => {
|
export const open_node = (node, push_history) => {
|
||||||
// We need to properly URL encode the file paths so they don't cause
|
// We need to properly URL encode the file paths so they don't cause
|
||||||
// issues.. but we also want the slashes to stay clean. So here we encode
|
// issues.. but we also want the slashes to stay clean. So here we encode
|
||||||
|
@@ -38,7 +38,7 @@ $: share_url = generate_share_url(state.path)
|
|||||||
let link_copied = false
|
let link_copied = false
|
||||||
const copy_link = () => {
|
const copy_link = () => {
|
||||||
if (share_url === "") {
|
if (share_url === "") {
|
||||||
edit_window.edit(state.base, "share")
|
edit_window.edit(state.base, "share", true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,18 +48,18 @@ const copy_link = () => {
|
|||||||
}
|
}
|
||||||
let share = async () => {
|
let share = async () => {
|
||||||
if (share_url === "") {
|
if (share_url === "") {
|
||||||
edit_window.edit(state.base, "share")
|
edit_window.edit(state.base, "share", true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (navigator.share) {
|
||||||
await navigator.share({
|
await navigator.share({
|
||||||
title: state.base.name,
|
title: state.base.name,
|
||||||
text: "I would like to share '" + state.base.name + "' with you",
|
text: "I would like to share '" + state.base.name + "' with you",
|
||||||
url: share_url
|
url: share_url
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} else {
|
||||||
console.debug("Navigator does not support sharing:", err)
|
console.debug("Navigator does not support sharing")
|
||||||
sharebar_visible = !sharebar_visible
|
sharebar_visible = !sharebar_visible
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ let share = async () => {
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
{#if state.base.path !== "/"}
|
{#if state.base.path !== "/"}
|
||||||
<button on:click={() => edit_window.edit(state.base)} class="toolbar_button" class:button_highlight={edit_visible}>
|
<button on:click={() => edit_window.edit(state.base, true)} class="toolbar_button" class:button_highlight={edit_visible}>
|
||||||
<i class="icon">edit</i> <u>E</u>dit
|
<i class="icon">edit</i> <u>E</u>dit
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
@@ -35,7 +35,7 @@ const node_click = e => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const node_settings = e => {
|
const node_settings = e => {
|
||||||
edit_window.edit(state.children[e.detail])
|
edit_window.edit(state.children[e.detail], false)
|
||||||
}
|
}
|
||||||
const navigate_up = () => {
|
const navigate_up = () => {
|
||||||
creating_dir = false
|
creating_dir = false
|
||||||
@@ -45,7 +45,6 @@ const navigate_up = () => {
|
|||||||
fs_navigator.navigate(state.path[state.path.length-2].path, true)
|
fs_navigator.navigate(state.path[state.path.length-2].path, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const reload = () => { fs_navigator.navigate(state.base.path) }
|
|
||||||
|
|
||||||
const delete_selected = () => {
|
const delete_selected = () => {
|
||||||
if (mode !== "selecting") {
|
if (mode !== "selecting") {
|
||||||
@@ -82,7 +81,7 @@ const delete_selected = () => {
|
|||||||
alert("Delete failed: ", err)
|
alert("Delete failed: ", err)
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
mode = "viewing"
|
mode = "viewing"
|
||||||
reload()
|
fs_navigator.reload()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const toggle_select = () => {
|
const toggle_select = () => {
|
||||||
@@ -125,7 +124,7 @@ onMount(() => {
|
|||||||
<button on:click={navigate_up} disabled={state.path.length <= 1} title="Back">
|
<button on:click={navigate_up} disabled={state.path.length <= 1} title="Back">
|
||||||
<i class="icon">arrow_back</i>
|
<i class="icon">arrow_back</i>
|
||||||
</button>
|
</button>
|
||||||
<button on:click={reload} title="Refresh directory listing">
|
<button on:click={fs_navigator.reload()} title="Refresh directory listing">
|
||||||
<i class="icon">refresh</i>
|
<i class="icon">refresh</i>
|
||||||
</button>
|
</button>
|
||||||
<button on:click={() => toggle_view()} title="Switch between gallery view and list view">
|
<button on:click={() => toggle_view()} title="Switch between gallery view and list view">
|
||||||
@@ -184,14 +183,18 @@ onMount(() => {
|
|||||||
<br/>
|
<br/>
|
||||||
{/if}
|
{/if}
|
||||||
{#if creating_dir}
|
{#if creating_dir}
|
||||||
<CreateDirectory state={state} on:done={() => {reload(); creating_dir = false;}} on:loading></CreateDirectory>
|
<CreateDirectory
|
||||||
|
state={state}
|
||||||
|
on:done={() => {fs_navigator.reload(); creating_dir = false;}}
|
||||||
|
on:loading
|
||||||
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<FileUploader
|
<FileUploader
|
||||||
bind:this={uploader}
|
bind:this={uploader}
|
||||||
bucket_id={state.root.id}
|
bucket_id={state.root.id}
|
||||||
target_dir={state.base.path}
|
target_dir={state.base.path}
|
||||||
on:reload={reload}
|
on:reload={fs_navigator.reload}
|
||||||
write_password={state.write_password}
|
write_password={state.write_password}
|
||||||
></FileUploader>
|
></FileUploader>
|
||||||
|
|
||||||
|
@@ -75,7 +75,7 @@ const keydown = e => {
|
|||||||
class="button button_highlight"
|
class="button button_highlight"
|
||||||
type="submit"
|
type="submit"
|
||||||
form="{form}"
|
form="{form}"
|
||||||
on:click={() => {dispatch("save"); hide()}}
|
on:click={hide}
|
||||||
>
|
>
|
||||||
<i class="icon">save</i> Save
|
<i class="icon">save</i> Save
|
||||||
</button>
|
</button>
|
||||||
|
Reference in New Issue
Block a user