Skip to content

Commit

Permalink
Merge pull request #395 from dfpc-coe/characters
Browse files Browse the repository at this point in the history
PMTiles Improvements
  • Loading branch information
ingalls authored Oct 25, 2024
2 parents f3e5462 + a236795 commit 1d2327d
Show file tree
Hide file tree
Showing 20 changed files with 254 additions and 443 deletions.
552 changes: 179 additions & 373 deletions api/web/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion api/web/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class='page h-100'>
<div class='page h-100 cloudtak-gradient'>
<header
v-if='navShown'
class='navbar navbar-expand-md d-print-none'
Expand Down
14 changes: 0 additions & 14 deletions api/web/src/components/Admin.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
<template>
<div style='overflow: auto;'>
<div class='page-wrapper'>
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<TablerBreadCrumb />
</div>
</div>
</div>
</div>
</div>

<div class='page-body'>
<div class='container-xl'>
<div class='row row-deck row-cards'>
Expand Down Expand Up @@ -200,7 +188,6 @@ import PageFooter from './PageFooter.vue';
import {
TablerAlert,
TablerLoading,
TablerBreadCrumb,
} from '@tak-ps/vue-tabler'
import {
IconNetwork,
Expand Down Expand Up @@ -241,7 +228,6 @@ export default {
IconNetwork,
PageFooter,
TablerLoading,
TablerBreadCrumb,
}
}
</script>
54 changes: 42 additions & 12 deletions api/web/src/components/Admin/AdminUser.vue
Original file line number Diff line number Diff line change
@@ -1,32 +1,46 @@
<template>
<div>
<div class='card-header'>
<IconCircleArrowLeft
class='cursor-pointer'
:size='32'
stroke='1'
<TablerIconButton
title='Back'
@click='$router.push("/admin/user")'
/>
><IconCircleArrowLeft :size='32' stroke='1'/></TablerIconButton>

<h1
class='card-title mx-2'
v-text='`User: ${$route.params.user}`'
/>

<div class='ms-auto btn-list'>
<TablerIconButton
v-if='!edit'
title='Edit User'
@click='edit = true'
><IconSettings :size='32' stroke='1' /></TablerIconButton>
<TablerIconButton
title='Refresh'
@click='fetchUserLoading'
>
<IconRefresh
:size='32'
stroke='1'
/>
</TablerIconButton>
><IconRefresh :size='32' stroke='1' /></TablerIconButton>
</div>
</div>
<div class='card-body'>
<TablerLoading v-if='loading' />
<template v-else-if='edit'>
<div class='col-12'>
<TablerToggle
label='System Administrator'
v-model='user.system_admin'
/>
</div>

<div class='col-12 d-flex align-items-center'>
<button @click='fetchUserLoading' class='btn btn-secondary'>Cancel</button>

<div class='ms-auto'>
<button @click='saveUser' class='btn btn-primary'>Save</button>
</div>
</div>
</template>
<template v-else>
<div class='datagrid'>
<template v-for='ele in getKeys(user)'>
Expand Down Expand Up @@ -70,10 +84,12 @@ import { std, stdurl } from '../../std.ts';
import type { User } from '../../types.ts';
import {
TablerLoading,
TablerToggle,
TablerIconButton
} from '@tak-ps/vue-tabler';
import {
IconRefresh,
IconSettings,
IconCircleArrowLeft,
} from '@tabler/icons-vue'
Expand All @@ -88,11 +104,25 @@ async function fetchUser(): Promise<User> {
}
const loading = ref(false);
const edit = ref(false);
const user = ref<User>(await fetchUser());
const getKeys = <T extends object>(obj: T) => Object.keys(obj) as Array<keyof T>
async function saveUser(): Promise<void> {
edit.value = false;
loading.value = true;
const url = stdurl(`/api/user/${route.params.user}`);
user.value = await std(url, {
method: 'PATCH',
body: {
system_admin: user.value.system_admin
}
}) as User;
loading.value = false;
}
async function fetchUserLoading(): Promise<void> {
edit.value = false;
loading.value = true;
const url = stdurl(`/api/user/${route.params.user}`);
user.value = await std(url) as User;
Expand Down
38 changes: 13 additions & 25 deletions api/web/src/components/CloudTAK/Menu/Overlays.vue
Original file line number Diff line number Diff line change
@@ -1,37 +1,23 @@
<template>
<MenuTemplate name='Overlays'>
<template #buttons>
<IconPencil
<TablerIconButton
v-if='isDraggable === false'
v-tooltip='"Edit Order"'
role='button'
tabindex='0'
class='cursor-pointer'
:size='32'
:stroke='1'
title='"Edit Order"'
@click='isDraggable = true'
/>
<IconPencilCheck
><IconPencil :size='32' :stroke='1' /></TablerIconButton>

<TablerIconButton
v-else-if='isDraggable === true'
v-tooltip='"Save Order"'
role='button'
tabindex='0'
class='cursor-pointer'
:size='32'
:stroke='1'
title='"Save Order"'
@click='isDraggable = false'
/>
><IconPencilCheck :size='32' :stroke='1'/></TablerIconButton>

<IconPlus
<TablerIconButton
v-if='!isDraggable'
v-tooltip='"Add Overlay"'
class='cursor-pointer'
role='button'
tabindex='0'
:size='32'
:stroke='1'
title='"Add Overlay"'
@click='$router.push("/menu/datas")'
/>
><IconPlus :size='32' :stroke='1' /></TablerIconButton>
</template>
<template #default>
<TablerLoading v-if='loading || !isLoaded' />
Expand Down Expand Up @@ -101,7 +87,7 @@

<span
class='mx-2 user-select-none text-truncate'
style='width: 240px;'
style='width: 200px;'
:class='{
"cursor-pointer": ["data", "profile"].includes(overlay.mode)
&& overlay.type === "vector"
Expand Down Expand Up @@ -199,6 +185,7 @@
import MenuTemplate from '../util/MenuTemplate.vue';
import {
TablerDelete,
TablerIconButton,
TablerLoading,
TablerRange
} from '@tak-ps/vue-tabler';
Expand Down Expand Up @@ -308,6 +295,7 @@ export default {
TreeVector,
TreeMission,
TablerRange,
TablerIconButton,
TablerLoading,
TablerDelete,
IconGripVertical,
Expand Down
2 changes: 1 addition & 1 deletion api/web/src/components/Connection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<div class='col d-flex text-white'>
<TablerBreadCrumb />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion api/web/src/components/ConnectionEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<div class='col d-flex text-white'>
<TablerBreadCrumb />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion api/web/src/components/ConnectionSink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<div class='col d-flex text-white'>
<TablerBreadCrumb />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion api/web/src/components/ConnectionSinkEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<div class='col d-flex text-white'>
<TablerBreadCrumb />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion api/web/src/components/ConnectionSinks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<div class='col d-flex text-white'>
<TablerBreadCrumb />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion api/web/src/components/Connections.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<div class='col d-flex text-white'>
<TablerBreadCrumb />

<div class='ms-auto'>
Expand Down
2 changes: 1 addition & 1 deletion api/web/src/components/Data.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<div class='col d-flex text-white'>
<TablerBreadCrumb />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion api/web/src/components/DataEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<div class='col d-flex text-white'>
<TablerBreadCrumb />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion api/web/src/components/DataJob.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<div class='col d-flex text-white'>
<TablerBreadCrumb />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion api/web/src/components/Layer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<div class='col d-flex text-white'>
<TablerBreadCrumb />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion api/web/src/components/LayerAlerts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<div class='col d-flex text-white'>
<TablerBreadCrumb />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion api/web/src/components/LayerEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<div class='col d-flex text-white'>
<TablerBreadCrumb />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion api/web/src/components/LayerQuery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<div class='col d-flex text-white'>
<TablerBreadCrumb />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion api/web/src/components/LayerQueryFeature.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class='page-header d-print-none'>
<div class='container-xl'>
<div class='row g-2 align-items-center'>
<div class='col d-flex'>
<div class='col d-flex text-white'>
<TablerBreadCrumb />
</div>
</div>
Expand Down
9 changes: 5 additions & 4 deletions tasks/pmtiles/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ async function nativeDecompress(
// Lambda needs to run with 512MB, empty function takes about 70
const CACHE = new pmtiles.ResolvedValueCache(undefined, undefined, nativeDecompress);
// eslint-disable-next-line no-useless-escape
const TILE = /^\/(?<NAME>[0-9a-zA-Z\/!\-@_\.\*\'\(\)]+)\/(?<Z>\d+)\/(?<X>\d+)\/(?<Y>\d+).(?<EXT>[a-z]+)$/;
const TILE = /^\/(?<NAME>[0-9a-zA-Z\/!\-@_\.\%\*\'\(\)]+)\/(?<Z>\d+)\/(?<X>\d+)\/(?<Y>\d+).(?<EXT>[a-z]+)$/;
// eslint-disable-next-line no-useless-escape
const META = /^\/(?<NAME>[0-9a-zA-Z\/!\-@_\.\*\'\(\)]+)$/;
const META = /^\/(?<NAME>[0-9a-zA-Z\/!\-@_\.\%\*\'\(\)]+)$/;

export const tile_path = (
path: string,
Expand All @@ -48,13 +48,13 @@ export const tile_path = (

if (match) {
const g = match.groups!;
return { ok: true, meta: false, name: g.NAME, tile: [+g.Z, +g.X, +g.Y], ext: g.EXT };
return { ok: true, meta: false, name: decodeURIComponent(g.NAME), tile: [+g.Z, +g.X, +g.Y], ext: g.EXT };
} else {
const meta_match = path.match(META);

if (meta_match) {
const g = meta_match.groups!;
return { ok: true, meta: true, name: g.NAME, tile: [0, 0, 0], ext: g.EXT };
return { ok: true, meta: true, name: decodeURIComponent(g.NAME), tile: [0, 0, 0], ext: g.EXT };
} else {
return { ok: false, meta: false, name: "", tile: [0, 0, 0], ext: "" };
}
Expand Down Expand Up @@ -336,6 +336,7 @@ export const handlerRaw = async (
throw err;
}
}

return apiError(404, "Invalid URL");
};

Expand Down

0 comments on commit 1d2327d

Please sign in to comment.