feat: Edit metadata (#5066)

* chore: rebase and clean-up

* feat: sync description, add e2e tests

* feat: simplify web code

* chore: unit tests

* fix: linting

* Bug fix with the arrows key

* timezone typeahead filter

timezone typeahead filter

* small stlying

* format fix

* Bug fix in the map selection

Bug fix in the map selection

* Websocket basic

Websocket basic

* Update metadata visualisation through the websocket

* Update timeline

* fix merge

* fix web

* fix web

* maplibre system

* format fix

* format fix

* refactor: clean up

* Fix small bug in the hour/timezone

* Don't diplay modify for readOnly asset

* Add log in case of failure

* Formater + try/catch error

* Remove everything related to websocket

* Revert "Remove everything related to websocket"

This reverts commit 14bcb9e1e4.

* remove notification

* fix test

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
YFrendo 2023-11-30 04:52:28 +01:00 committed by GitHub
parent b396e0eee3
commit 644e52b153
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 1045 additions and 81 deletions

View file

@ -0,0 +1,39 @@
<script lang="ts">
import ChangeDate from '$lib/components/shared-components/change-date.svelte';
import { handleError } from '$lib/utils/handle-error';
import { api } from '@api';
import { DateTime } from 'luxon';
import MenuOption from '../../shared-components/context-menu/menu-option.svelte';
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
export let menuItem = false;
const { clearSelect, getOwnedAssets } = getAssetControlContext();
let isShowChangeDate = false;
const handleConfirm = async (dateTimeOriginal: string) => {
isShowChangeDate = false;
const ids = Array.from(getOwnedAssets())
.filter((a) => !a.isExternal)
.map((a) => a.id);
try {
await api.assetApi.updateAssets({
assetBulkUpdateDto: { ids, dateTimeOriginal },
});
} catch (error) {
handleError(error, 'Unable to change date');
}
clearSelect();
};
</script>
{#if menuItem}
<MenuOption text="Change date" on:click={() => (isShowChangeDate = true)} />
{/if}
{#if isShowChangeDate}
<ChangeDate
initialDate={DateTime.now()}
on:confirm={({ detail: date }) => handleConfirm(date)}
on:cancel={() => (isShowChangeDate = false)}
/>
{/if}

View file

@ -0,0 +1,42 @@
<script lang="ts">
import { api } from '@api';
import MenuOption from '../../shared-components/context-menu/menu-option.svelte';
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
import ChangeLocation from '$lib/components/shared-components/change-location.svelte';
import { handleError } from '../../../utils/handle-error';
export let menuItem = false;
const { clearSelect, getOwnedAssets } = getAssetControlContext();
let isShowChangeLocation = false;
async function handleConfirm(point: { lng: number; lat: number }) {
isShowChangeLocation = false;
const ids = Array.from(getOwnedAssets())
.filter((a) => !a.isExternal)
.map((a) => a.id);
try {
await api.assetApi.updateAssets({
assetBulkUpdateDto: {
ids,
latitude: point.lat,
longitude: point.lng,
},
});
} catch (error) {
handleError(error, 'Unable to update location');
}
clearSelect();
}
</script>
{#if menuItem}
<MenuOption text="Change location" on:click={() => (isShowChangeLocation = true)} />
{/if}
{#if isShowChangeLocation}
<ChangeLocation
on:confirm={({ detail: point }) => handleConfirm(point)}
on:cancel={() => (isShowChangeLocation = false)}
/>
{/if}