diff --git a/src/common/api/conversion.js b/src/common/api/conversion.js
index 90bfe05..25a2984 100644
--- a/src/common/api/conversion.js
+++ b/src/common/api/conversion.js
@@ -1,6 +1,6 @@
import { getEnvs } from 'common/functions';
import { useUserStore } from '../store/user.store';
-import { useConversionStore } from '../store/conversion.store';
+import { useReviewManifestStore } from '../store/review-manifest.store';
const apiVersion = '2.0';
const previewApiVersion = '2023-03-01-preview';
@@ -10,7 +10,8 @@ const conversionOutputOntology = 'facility-2.0';
export const uploadConversion = (file) => {
const { geography, subscriptionKey } = useUserStore.getState();
- const url = `${getEnvs()[geography].URL}/mapData?dataFormat=${dataFormat}&api-version=${apiVersion}&subscription-key=${subscriptionKey}`;
+ const { getOriginalPackageName } = useReviewManifestStore.getState();
+ const url = `${getEnvs()[geography].URL}/mapData?dataFormat=${dataFormat}&api-version=${apiVersion}&subscription-key=${subscriptionKey}&description=${getOriginalPackageName()}`;
return fetch(url, {
method: 'POST',
headers: {
@@ -22,7 +23,8 @@ export const uploadConversion = (file) => {
export const startConversion = (udid) => {
const { geography, subscriptionKey } = useUserStore.getState();
- const url = `${getEnvs()[geography].URL}/conversions?udid=${udid}&outputOntology=${conversionOutputOntology}&api-version=${previewApiVersion}&subscription-key=${subscriptionKey}&dwgPackageVersion=${conversionDwgPackageVersion}`;
+ const { getOriginalPackageName } = useReviewManifestStore.getState();
+ const url = `${getEnvs()[geography].URL}/conversions?udid=${udid}&outputOntology=${conversionOutputOntology}&api-version=${previewApiVersion}&subscription-key=${subscriptionKey}&dwgPackageVersion=${conversionDwgPackageVersion}&description=${getOriginalPackageName()}`;
return fetch(url, {
method: 'POST',
});
@@ -30,7 +32,8 @@ export const startConversion = (udid) => {
export const startDataset = (conversionId) => {
const { geography, subscriptionKey } = useUserStore.getState();
- const url = `${getEnvs()[geography].URL}/datasets?api-version=${apiVersion}&conversionId=${conversionId}&subscription-key=${subscriptionKey}`;
+ const { getOriginalPackageName } = useReviewManifestStore.getState();
+ const url = `${getEnvs()[geography].URL}/datasets?api-version=${apiVersion}&conversionId=${conversionId}&subscription-key=${subscriptionKey}&description=${getOriginalPackageName()}`;
return fetch(url, {
method: 'POST',
});
@@ -38,35 +41,9 @@ export const startDataset = (conversionId) => {
export const startTileset = (datasetId) => {
const { geography, subscriptionKey } = useUserStore.getState();
- const url = `${getEnvs()[geography].URL}/tilesets?api-version=${previewApiVersion}&datasetId=${datasetId}&subscription-key=${subscriptionKey}`;
+ const { getOriginalPackageName } = useReviewManifestStore.getState();
+ const url = `${getEnvs()[geography].URL}/tilesets?api-version=${previewApiVersion}&datasetId=${datasetId}&subscription-key=${subscriptionKey}&description=${getOriginalPackageName()}`;
return fetch(url, {
method: 'POST',
});
-};
-
-export const deleteCreatedData = () => {
- const { geography, subscriptionKey } = useUserStore.getState();
- const { uploadUdId, conversionId, datasetId, tilesetId } = useConversionStore.getState();
-
- if (tilesetId !== null) {
- return;
- }
- if (uploadUdId !== null) {
- fetch(`${getEnvs()[geography].URL}/mapData/${uploadUdId}?api-version=2.0&subscription-key=${subscriptionKey}`, {
- method: 'DELETE',
- keepalive: true,
- });
- }
- if (conversionId !== null) {
- fetch(`${getEnvs()[geography].URL}/conversions/${conversionId}?api-version=2.0&subscription-key=${subscriptionKey}`, {
- method: 'DELETE',
- keepalive: true,
- });
- }
- if (datasetId !== null) {
- fetch(`${getEnvs()[geography].URL}/datasets/${datasetId}?api-version=2.0&subscription-key=${subscriptionKey}`, {
- method: 'DELETE',
- keepalive: true,
- });
- }
};
\ No newline at end of file
diff --git a/src/common/api/conversion.test.js b/src/common/api/conversion.test.js
index 27d2856..4a7c84f 100644
--- a/src/common/api/conversion.test.js
+++ b/src/common/api/conversion.test.js
@@ -1,5 +1,4 @@
-import { uploadConversion, startConversion, startDataset, startTileset, deleteCreatedData } from './conversion';
-import { useConversionStore } from '../store';
+import { uploadConversion, startConversion, startDataset, startTileset } from './conversion';
jest.mock('../store/user.store', () => ({
useUserStore: {
@@ -14,7 +13,7 @@ describe('conversion api', () => {
it('should call uploadConversion request', () => {
uploadConversion('myFile');
expect(global.fetch).toHaveBeenCalledWith(
- 'https://eu.atlas.microsoft.com/mapData?dataFormat=dwgzippackage&api-version=2.0&subscription-key=subKeeeeeeey',
+ 'https://eu.atlas.microsoft.com/mapData?dataFormat=dwgzippackage&api-version=2.0&subscription-key=subKeeeeeeey&description=',
{ 'body': 'myFile', 'headers': { 'Content-Type': 'application/octet-stream' }, 'method': 'POST' },
);
});
@@ -22,7 +21,7 @@ describe('conversion api', () => {
it('should call startConversion request', () => {
startConversion('yuuu-deee-iii-deeee');
expect(global.fetch).toHaveBeenCalledWith(
- 'https://eu.atlas.microsoft.com/conversions?udid=yuuu-deee-iii-deeee&outputOntology=facility-2.0&api-version=2023-03-01-preview&subscription-key=subKeeeeeeey&dwgPackageVersion=2.0',
+ 'https://eu.atlas.microsoft.com/conversions?udid=yuuu-deee-iii-deeee&outputOntology=facility-2.0&api-version=2023-03-01-preview&subscription-key=subKeeeeeeey&dwgPackageVersion=2.0&description=',
{ 'method': 'POST' },
);
});
@@ -30,7 +29,7 @@ describe('conversion api', () => {
it('should call startDataset request', () => {
startDataset('con-ver-sion-id');
expect(global.fetch).toHaveBeenCalledWith(
- 'https://eu.atlas.microsoft.com/datasets?api-version=2.0&conversionId=con-ver-sion-id&subscription-key=subKeeeeeeey',
+ 'https://eu.atlas.microsoft.com/datasets?api-version=2.0&conversionId=con-ver-sion-id&subscription-key=subKeeeeeeey&description=',
{ 'method': 'POST' },
);
});
@@ -38,67 +37,8 @@ describe('conversion api', () => {
it('should call startTileset request', () => {
startTileset('da-ta-set-id');
expect(global.fetch).toHaveBeenCalledWith(
- 'https://eu.atlas.microsoft.com/tilesets?api-version=2023-03-01-preview&datasetId=da-ta-set-id&subscription-key=subKeeeeeeey',
+ 'https://eu.atlas.microsoft.com/tilesets?api-version=2023-03-01-preview&datasetId=da-ta-set-id&subscription-key=subKeeeeeeey&description=',
{ 'method': 'POST' },
);
});
-
- it('should delete uploaded data', () => {
- useConversionStore.setState({
- uploadUdId: 123,
- });
- deleteCreatedData();
- expect(global.fetch).toHaveBeenCalledWith(
- 'https://eu.atlas.microsoft.com/mapData/123?api-version=2.0&subscription-key=subKeeeeeeey',
- { 'method': 'DELETE', 'keepalive': true },
- );
- });
-
- it('should delete uploaded data and conversion', () => {
- useConversionStore.setState({
- uploadUdId: 123,
- conversionId: 234,
- });
- deleteCreatedData();
- expect(global.fetch).toHaveBeenCalledWith(
- 'https://eu.atlas.microsoft.com/mapData/123?api-version=2.0&subscription-key=subKeeeeeeey',
- { 'method': 'DELETE', 'keepalive': true },
- );
- expect(global.fetch).toHaveBeenCalledWith(
- 'https://eu.atlas.microsoft.com/conversions/234?api-version=2.0&subscription-key=subKeeeeeeey',
- { 'method': 'DELETE', 'keepalive': true },
- );
- });
-
- it('should delete uploaded data and conversion and dataset', () => {
- useConversionStore.setState({
- uploadUdId: 123,
- conversionId: 234,
- datasetId: 345,
- });
- deleteCreatedData();
- expect(global.fetch).toHaveBeenCalledWith(
- 'https://eu.atlas.microsoft.com/mapData/123?api-version=2.0&subscription-key=subKeeeeeeey',
- { 'method': 'DELETE', 'keepalive': true },
- );
- expect(global.fetch).toHaveBeenCalledWith(
- 'https://eu.atlas.microsoft.com/conversions/234?api-version=2.0&subscription-key=subKeeeeeeey',
- { 'method': 'DELETE', 'keepalive': true },
- );
- expect(global.fetch).toHaveBeenCalledWith(
- 'https://eu.atlas.microsoft.com/datasets/345?api-version=2.0&subscription-key=subKeeeeeeey',
- { 'method': 'DELETE', 'keepalive': true },
- );
- });
-
- it('should delete nothing when tileset id is not null', () => {
- useConversionStore.setState({
- uploadUdId: 123,
- conversionId: 234,
- datasetId: 345,
- tilesetId: 456,
- });
- deleteCreatedData();
- expect(global.fetch).not.toHaveBeenCalled();
- });
});
\ No newline at end of file
diff --git a/src/common/api/conversions.js b/src/common/api/conversions.js
new file mode 100644
index 0000000..fb94790
--- /dev/null
+++ b/src/common/api/conversions.js
@@ -0,0 +1,42 @@
+import { getEnvs } from 'common/functions';
+import { useUserStore } from '../store/user.store';
+
+const uploadApiVersion = '2.0';
+const creatorApiVersion = '2023-03-01-preview';
+
+const getUploads = () => {
+ const { geography, subscriptionKey } = useUserStore.getState();
+ const url = `${getEnvs()[geography].URL}/mapData?api-version=${uploadApiVersion}&subscription-key=${subscriptionKey}`;
+ return fetch(url);
+};
+
+const getConversions = () => {
+ const { geography, subscriptionKey } = useUserStore.getState();
+ const url = `${getEnvs()[geography].URL}/conversions?api-version=${creatorApiVersion}&subscription-key=${subscriptionKey}`;
+ return fetch(url);
+};
+
+const getDatasets = () => {
+ const { geography, subscriptionKey } = useUserStore.getState();
+ const url = `${getEnvs()[geography].URL}/datasets?api-version=${creatorApiVersion}&subscription-key=${subscriptionKey}`;
+ return fetch(url);
+};
+
+const getTilesets = () => {
+ const { geography, subscriptionKey } = useUserStore.getState();
+ const url = `${getEnvs()[geography].URL}/tilesets?api-version=${creatorApiVersion}&subscription-key=${subscriptionKey}`;
+ return fetch(url);
+};
+
+export const getAllData = () => (
+ Promise.all([getUploads(), getConversions(), getDatasets(), getTilesets()]).then(re => (
+ Promise.all([re[0].json(), re[1].json(), re[2].json(), re[3].json()])
+ )).then(([uploads, conversions, datasets, tilesets]) => (
+ {
+ ...uploads,
+ ...conversions,
+ ...datasets,
+ ...tilesets,
+ }
+ ))
+);
\ No newline at end of file
diff --git a/src/common/constants.js b/src/common/constants.js
index e3dde07..f380d35 100644
--- a/src/common/constants.js
+++ b/src/common/constants.js
@@ -4,6 +4,8 @@ export const PATHS = {
CREATE_GEOREFERENCE: '/create-georeference',
REVIEW_CREATE: '/review-create',
CONVERSION: '/review-create/conversion',
+ PAST_CONVERSION: '/past-conversion',
+ CONVERSIONS: '/conversions',
LAYERS: '/layers',
LEVELS: '/levels',
INVALID_PATH: '/*',
@@ -18,6 +20,7 @@ export const ROUTE_NAME_BY_PATH = {
[PATHS.INVALID_PATH]: 'redirect',
[PATHS.REVIEW_CREATE]: 'prepare.drawing.package',
[PATHS.CONVERSION]: 'create.indoor.map',
+ [PATHS.CONVERSIONS]: 'All conversions',
};
export const TRUNCATE_FRACTION_DIGITS = 8;
diff --git a/src/common/store/conversion-past.store.js b/src/common/store/conversion-past.store.js
new file mode 100644
index 0000000..0b833ad
--- /dev/null
+++ b/src/common/store/conversion-past.store.js
@@ -0,0 +1,21 @@
+import { create } from 'zustand';
+
+import { conversionStatuses, conversionSteps} from './conversion.store';
+
+export const useConversionPastStore = create((set) => ({
+ selectedStep: conversionSteps.upload,
+ uploadStepStatus: conversionStatuses.empty,
+ uploadUdId: null,
+ conversionStepStatus: conversionStatuses.empty,
+ conversionId: null,
+ datasetStepStatus: conversionStatuses.empty,
+ datasetId: null,
+ tilesetStepStatus: conversionStatuses.empty,
+ tilesetId: null,
+ mapConfigurationId: null,
+ bbox: null,
+ setStep: (selectedStep) => set({
+ selectedStep,
+ }),
+ setData: (data) => set(data),
+}));
\ No newline at end of file
diff --git a/src/common/store/conversion.store.js b/src/common/store/conversion.store.js
index 243cef4..f026066 100644
--- a/src/common/store/conversion.store.js
+++ b/src/common/store/conversion.store.js
@@ -1,7 +1,6 @@
import { create } from 'zustand';
import {
- deleteCreatedData,
startConversion,
startDataset,
startTileset,
@@ -38,6 +37,7 @@ const getDefaultState = () => ({
uploadEndTime: null,
uploadUdId: null,
uploadOperationLog: null,
+ uploadDescription: null,
conversionStepStatus: conversionStatuses.empty,
conversionStartTime: null,
conversionEndTime: null,
@@ -82,7 +82,6 @@ export const useConversionStore = create((set, get) => ({
uploadOperationLog: data.error ? JSON.stringify(data.error, null, 4) : defaultErrorMessage,
uploadEndTime: Date.now(),
});
- deleteCreatedData();
});
} else {
get().fetchUploadStatus(res.headers.get(OPERATION_LOCATION));
@@ -93,7 +92,6 @@ export const useConversionStore = create((set, get) => ({
uploadOperationLog: e.message || defaultErrorMessage,
uploadEndTime: Date.now(),
});
- deleteCreatedData();
});
},
fetchUploadStatus: (location) => {
@@ -114,7 +112,6 @@ export const useConversionStore = create((set, get) => ({
uploadOperationLog: data.error ? JSON.stringify(data.error, null, 4) : defaultErrorMessage,
uploadEndTime: Date.now(),
});
- deleteCreatedData();
} else if (data.status === LRO_STATUS.RUNNING) {
set(() => ({
uploadOperationLog: JSON.stringify(data, null, 4),
@@ -135,6 +132,7 @@ export const useConversionStore = create((set, get) => ({
get().startConversion(data.udid);
set({
uploadUdId: data.udid,
+ uploadDescription: data.description,
});
});
} else {
@@ -146,7 +144,6 @@ export const useConversionStore = create((set, get) => ({
uploadOperationLog: e.message || defaultErrorMessage,
uploadEndTime: Date.now(),
});
- deleteCreatedData();
});
},
startConversion: (udid) => {
@@ -166,7 +163,6 @@ export const useConversionStore = create((set, get) => ({
conversionOperationLog: data.error ? JSON.stringify(data.error, null, 4) : defaultErrorMessage,
conversionEndTime: Date.now(),
});
- deleteCreatedData();
});
} else {
get().fetchConversionStatus(res.headers.get(OPERATION_LOCATION));
@@ -177,7 +173,6 @@ export const useConversionStore = create((set, get) => ({
conversionOperationLog: e.message || defaultErrorMessage,
conversionEndTime: Date.now(),
});
- deleteCreatedData();
});
},
fetchConversionStatus: (operationLocation) => {
@@ -198,7 +193,6 @@ export const useConversionStore = create((set, get) => ({
conversionOperationLog: data.error ? JSON.stringify(data.error, null, 4) : defaultErrorMessage,
conversionEndTime: Date.now(),
});
- deleteCreatedData();
} else if (data.status === LRO_STATUS.RUNNING) {
set(() => ({
conversionOperationLog: JSON.stringify(data, null, 4),
@@ -233,7 +227,6 @@ export const useConversionStore = create((set, get) => ({
conversionOperationLog: e.message || defaultErrorMessage,
conversionEndTime: Date.now(),
});
- deleteCreatedData();
});
},
startDataset: (conversionId) => {
@@ -253,7 +246,6 @@ export const useConversionStore = create((set, get) => ({
datasetOperationLog: data.error ? JSON.stringify(data.error, null, 4) : defaultErrorMessage,
datasetEndTime: Date.now(),
});
- deleteCreatedData();
});
} else {
get().fetchDatasetStatus(res.headers.get(OPERATION_LOCATION));
@@ -264,7 +256,6 @@ export const useConversionStore = create((set, get) => ({
datasetOperationLog: e.message || defaultErrorMessage,
datasetEndTime: Date.now(),
});
- deleteCreatedData();
});
},
fetchDatasetStatus: (location) => {
@@ -285,7 +276,6 @@ export const useConversionStore = create((set, get) => ({
datasetOperationLog: data.error ? JSON.stringify(data.error, null, 4) : defaultErrorMessage,
datasetEndTime: Date.now(),
});
- deleteCreatedData();
} else if (data.status === LRO_STATUS.RUNNING) {
set(() => ({
datasetOperationLog: JSON.stringify(data, null, 4),
@@ -318,7 +308,6 @@ export const useConversionStore = create((set, get) => ({
datasetOperationLog: e.message || defaultErrorMessage,
datasetEndTime: Date.now(),
});
- deleteCreatedData();
});
},
startTileset: (datasetId) => {
@@ -338,7 +327,6 @@ export const useConversionStore = create((set, get) => ({
tilesetOperationLog: data.error ? JSON.stringify(data.error, null, 4) : defaultErrorMessage,
tilesetEndTime: Date.now(),
});
- deleteCreatedData();
});
} else {
get().fetchTilesetStatus(res.headers.get(OPERATION_LOCATION));
@@ -349,7 +337,6 @@ export const useConversionStore = create((set, get) => ({
tilesetOperationLog: e.message || defaultErrorMessage,
tilesetEndTime: Date.now(),
});
- deleteCreatedData();
});
},
fetchTilesetStatus: (location) => {
@@ -370,7 +357,6 @@ export const useConversionStore = create((set, get) => ({
tilesetOperationLog: data.error ? JSON.stringify(data.error, null, 4) : defaultErrorMessage,
tilesetEndTime: Date.now(),
});
- deleteCreatedData();
} else if (data.status === LRO_STATUS.RUNNING) {
set(() => ({
tilesetOperationLog: JSON.stringify(data, null, 4),
@@ -405,7 +391,6 @@ export const useConversionStore = create((set, get) => ({
tilesetOperationLog: e.message || defaultErrorMessage,
tilesetEndTime: Date.now(),
});
- deleteCreatedData();
});
},
}));
\ No newline at end of file
diff --git a/src/common/store/response.store.js b/src/common/store/response.store.js
index f5b1d8f..0273456 100644
--- a/src/common/store/response.store.js
+++ b/src/common/store/response.store.js
@@ -66,7 +66,9 @@ export const useResponseStore = create((set, get) => ({
// Uses the operationLocation set by uploadFile()
refreshStatus: () => {
const operationLocation = get().operationLocation;
- if (operationLocation === '') {
+ const lroStatus = get().lroStatus;
+
+ if (operationLocation === '' || lroStatus === LRO_STATUS.FETCHING_DATA || lroStatus === LRO_STATUS.SUCCEEDED) {
return;
}
@@ -103,12 +105,10 @@ export const useResponseStore = create((set, get) => ({
}
if (data.status === LRO_STATUS.SUCCEEDED) {
- if (get().lroStatus !== LRO_STATUS.FETCHING_DATA) {
- set(() => ({
- lroStatus: LRO_STATUS.FETCHING_DATA,
- }));
- get().fetchManifestData(data.fetchUrl);
- }
+ set(() => ({
+ lroStatus: LRO_STATUS.FETCHING_DATA,
+ }));
+ get().fetchManifestData(data.fetchUrl);
}
})
.catch(({ message }) => {
diff --git a/src/common/translations/en.js b/src/common/translations/en.js
index 8438d34..eb05ca1 100644
--- a/src/common/translations/en.js
+++ b/src/common/translations/en.js
@@ -66,6 +66,7 @@ const en = {
'facility.name': 'Facility name',
'feedback': 'Feedback',
'feedback.link': 'Feedback link',
+ 'filter.by.name': 'Filter by name',
'geography': 'Geography',
'file.name': 'File name',
'geography.europe': 'Europe',
@@ -82,6 +83,7 @@ const en = {
'levels.preview': 'Levels preview',
'level.name': 'Level name',
'level.name.of.file': 'Level name of {{filename}}',
+ 'loading': 'Loading...',
'logs': 'Logs',
'longitude': 'Longitude',
'manifest.file': 'Manifest file',
@@ -143,6 +145,9 @@ const en = {
'upload': 'Upload',
'vertical.extent': 'Vertical Extent',
'vertical.extent.of.file': 'Vertical Extent of {{filename}}',
+ 'view': 'View',
+ 'view.all.conversions': 'View all conversions',
+ 'view.existing.conversions': 'View existing conversions',
},
};
diff --git a/src/components/bread-crumb-nav/bread-crumb-nav.js b/src/components/bread-crumb-nav/bread-crumb-nav.js
index 924ffd3..94386be 100644
--- a/src/components/bread-crumb-nav/bread-crumb-nav.js
+++ b/src/components/bread-crumb-nav/bread-crumb-nav.js
@@ -5,7 +5,6 @@ import { useNavigate, useLocation } from 'react-router-dom';
import { breadcrumbStyle } from './bread-crumb-nav.style';
import { getSplitPaths } from 'common/functions';
import { PATHS, ROUTE_NAME_BY_PATH } from 'common/constants';
-import { deleteCreatedData } from 'common/api/conversion';
import { useConversionStore } from 'common/store';
const routesConfirmationRequiredBeforeLeaving = [
@@ -28,7 +27,6 @@ const BreadCrumbNav = () => {
}
if (routesConfirmationRequiredBeforeLeaving.includes(pathname)) {
if (window.confirm(t('progress.will.be.lost'))) {
- deleteCreatedData();
useConversionStore.getState().reset();
navigate(path);
}
diff --git a/src/components/route/route.js b/src/components/route/route.js
index 09c801e..4dbd771 100644
--- a/src/components/route/route.js
+++ b/src/components/route/route.js
@@ -24,7 +24,7 @@ const Route = ({ title, component: Component, dataRequired }) => {
const shouldShowFooter = useMemo(() => progressBarSteps.findIndex(route => route.href === pathname) !== -1, [pathname]);
useEffect(() => {
- if (dataRequired && lroStatus !== LRO_STATUS.SUCCEEDED) {
+ if (dataRequired && lroStatus !== LRO_STATUS.SUCCEEDED && lroStatus !== LRO_STATUS.FETCHING_DATA) {
navigate(PATHS.INDEX);
}
}, [dataRequired, lroStatus, navigate]);
diff --git a/src/pages/conversion/__snapshots__/index.test.js.snap b/src/pages/conversion/__snapshots__/index.test.js.snap
index 8983601..54e01c7 100644
--- a/src/pages/conversion/__snapshots__/index.test.js.snap
+++ b/src/pages/conversion/__snapshots__/index.test.js.snap
@@ -44,8 +44,6 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
- background-color: #E1DFDD;
- font-weight: 700;
cursor: pointer;
}
@@ -66,15 +64,6 @@ Object {
}
.emotion-4 {
- margin-right: 0.5rem;
-}
-
-.emotion-5 {
- color: #605e5c;
- font-size: 0.6875rem;
-}
-
-.emotion-6 {
height: 2.75rem;
display: -webkit-box;
display: -webkit-flex;
@@ -90,15 +79,26 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
+ background-color: #E1DFDD;
+ font-weight: 700;
cursor: pointer;
}
-.emotion-6:hover {
+.emotion-4:hover {
color: #0078d4;
background-color: #F3F2F1;
}
-.emotion-18 {
+.emotion-6 {
+ margin-right: 0.5rem;
+}
+
+.emotion-7 {
+ color: #605e5c;
+ font-size: 0.6875rem;
+}
+
+.emotion-20 {
height: 2.75rem;
display: -webkit-box;
display: -webkit-flex;
@@ -116,19 +116,19 @@ Object {
width: 100%;
}
-.emotion-22 {
+.emotion-24 {
padding: 0 1rem;
overflow: auto;
width: calc(100% - 18rem);
}
@media (max-width: 600px) {
- .emotion-22 {
+ .emotion-24 {
width: calc(100% - 9rem);
}
}
-.emotion-23 {
+.emotion-25 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
@@ -139,22 +139,14 @@ Object {
height: 100%;
}
-.emotion-24 {
+.emotion-26 {
margin-top: 1rem;
margin-bottom: 1rem;
font-size: 1rem;
}
-.emotion-25 {
- font-weight: 600;
-}
-
-.emotion-26 {
- overflow: auto;
-}
-
.emotion-27 {
- overflow-x: auto;
+ font-weight: 600;
}
@@ -166,15 +158,35 @@ Object {
class="emotion-1"
>
+
+
@@ -345,8 +347,6 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
- background-color: #E1DFDD;
- font-weight: 700;
cursor: pointer;
}
@@ -367,15 +367,6 @@ Object {
}
.emotion-4 {
- margin-right: 0.5rem;
-}
-
-.emotion-5 {
- color: #605e5c;
- font-size: 0.6875rem;
-}
-
-.emotion-6 {
height: 2.75rem;
display: -webkit-box;
display: -webkit-flex;
@@ -391,15 +382,26 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
+ background-color: #E1DFDD;
+ font-weight: 700;
cursor: pointer;
}
-.emotion-6:hover {
+.emotion-4:hover {
color: #0078d4;
background-color: #F3F2F1;
}
-.emotion-18 {
+.emotion-6 {
+ margin-right: 0.5rem;
+}
+
+.emotion-7 {
+ color: #605e5c;
+ font-size: 0.6875rem;
+}
+
+.emotion-20 {
height: 2.75rem;
display: -webkit-box;
display: -webkit-flex;
@@ -417,19 +419,19 @@ Object {
width: 100%;
}
-.emotion-22 {
+.emotion-24 {
padding: 0 1rem;
overflow: auto;
width: calc(100% - 18rem);
}
@media (max-width: 600px) {
- .emotion-22 {
+ .emotion-24 {
width: calc(100% - 9rem);
}
}
-.emotion-23 {
+.emotion-25 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
@@ -440,22 +442,14 @@ Object {
height: 100%;
}
-.emotion-24 {
+.emotion-26 {
margin-top: 1rem;
margin-bottom: 1rem;
font-size: 1rem;
}
-.emotion-25 {
- font-weight: 600;
-}
-
-.emotion-26 {
- overflow: auto;
-}
-
.emotion-27 {
- overflow-x: auto;
+ font-weight: 600;
}
@@ -466,15 +460,35 @@ Object {
class="emotion-1"
>
+
+
diff --git a/src/pages/conversion/__snapshots__/step-button.test.js.snap b/src/pages/conversion/__snapshots__/step-button.test.js.snap
index f606008..4911d59 100644
--- a/src/pages/conversion/__snapshots__/step-button.test.js.snap
+++ b/src/pages/conversion/__snapshots__/step-button.test.js.snap
@@ -19,8 +19,6 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
- background-color: #E1DFDD;
- font-weight: 700;
cursor: pointer;
}
@@ -90,8 +88,6 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
- background-color: #E1DFDD;
- font-weight: 700;
cursor: pointer;
}
@@ -216,8 +212,6 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
- background-color: #E1DFDD;
- font-weight: 700;
cursor: pointer;
}
@@ -289,8 +283,6 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
- background-color: #E1DFDD;
- font-weight: 700;
cursor: pointer;
}
@@ -417,8 +409,6 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
- background-color: #E1DFDD;
- font-weight: 700;
cursor: pointer;
}
@@ -490,8 +480,6 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
- background-color: #E1DFDD;
- font-weight: 700;
cursor: pointer;
}
@@ -618,8 +606,6 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
- background-color: #E1DFDD;
- font-weight: 700;
cursor: pointer;
}
@@ -692,8 +678,6 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
- background-color: #E1DFDD;
- font-weight: 700;
cursor: pointer;
}
@@ -837,8 +821,6 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
- background-color: #E1DFDD;
- font-weight: 700;
cursor: pointer;
}
@@ -929,8 +911,6 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
- background-color: #E1DFDD;
- font-weight: 700;
cursor: pointer;
}
@@ -1060,8 +1040,6 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
- background-color: #E1DFDD;
- font-weight: 700;
cursor: pointer;
}
@@ -1134,8 +1112,6 @@ Object {
padding: 0 0.5rem;
border: none;
width: 100%;
- background-color: #E1DFDD;
- font-weight: 700;
cursor: pointer;
}
diff --git a/src/pages/conversion/__snapshots__/tileset-content.test.js.snap b/src/pages/conversion/__snapshots__/tileset-content.test.js.snap
index d80453b..9b233b8 100644
--- a/src/pages/conversion/__snapshots__/tileset-content.test.js.snap
+++ b/src/pages/conversion/__snapshots__/tileset-content.test.js.snap
@@ -85,18 +85,18 @@ Object {
font-weight: 600;
}
-.emotion-4 {
+.emotion-3 {
opacity: 0.5;
font-size: 0.75rem;
cursor: pointer;
margin: 0 0.5rem;
}
-.emotion-4:hover {
+.emotion-3:hover {
opacity: 0.75;
}
-.emotion-5 {
+.emotion-6 {
overflow: auto;
}
@@ -115,7 +115,16 @@ Object {
MapConfigurationId
:
-
+ my-map-config
+
+
+
+
+
:
-
+ default_some-id
@@ -137,7 +146,7 @@ Object {
operation.log
@@ -336,18 +345,18 @@ Object {
font-weight: 600;
}
-.emotion-4 {
+.emotion-3 {
opacity: 0.5;
font-size: 0.75rem;
cursor: pointer;
margin: 0 0.5rem;
}
-.emotion-4:hover {
+.emotion-3:hover {
opacity: 0.75;
}
-.emotion-5 {
+.emotion-6 {
overflow: auto;
}
@@ -365,7 +374,16 @@ Object {
MapConfigurationId
:
-
+ my-map-config
+
+
+
+
+
:
-
+ default_some-id
@@ -387,7 +405,7 @@ Object {
operation.log
@@ -617,560 +635,3 @@ Object {
"unmount": [Function],
}
`;
-
-exports[`tileset content should render tileset content logs tab 1`] = `
-Object {
- "asFragment": [Function],
- "baseElement": .emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-flex-direction: column;
- -ms-flex-direction: column;
- flex-direction: column;
- height: 100%;
-}
-
-.emotion-1 {
- margin-top: 1rem;
- margin-bottom: 1rem;
- font-size: 1rem;
-}
-
-.emotion-2 {
- font-weight: 600;
-}
-
-.emotion-4 {
- opacity: 0.5;
- font-size: 0.75rem;
- cursor: pointer;
- margin: 0 0.5rem;
-}
-
-.emotion-4:hover {
- opacity: 0.75;
-}
-
-.emotion-5 {
- overflow: auto;
-}
-
-
-
-
-
-
-
- MapConfigurationId
-
- :
-
-
-
-
- MapConfigurationAlias
-
- :
-
-
-
-
-
-
-
-
-
-
- operation.log
-
-
-
-
-
-
-
-
-
-
- {
-
-
-
-
-
-
-
-
-
-
- "
-
-
- foo
-
-
- "
-
-
-
- :
-
-
-
-
-
- "
- hop-hei-la-la-lei
- "
-
-
-
-
-
-
-
-
- "
-
-
- baz
-
-
- "
-
-
-
- :
-
-
-
-
-
- "
- blee blue blah blueberry dee
- "
-
-
-
-
-
-
-
-
- }
-
-
-
-
-
-
-
-
-
- ,
- "container": .emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-flex-direction: column;
- -ms-flex-direction: column;
- flex-direction: column;
- height: 100%;
-}
-
-.emotion-1 {
- margin-top: 1rem;
- margin-bottom: 1rem;
- font-size: 1rem;
-}
-
-.emotion-2 {
- font-weight: 600;
-}
-
-.emotion-4 {
- opacity: 0.5;
- font-size: 0.75rem;
- cursor: pointer;
- margin: 0 0.5rem;
-}
-
-.emotion-4:hover {
- opacity: 0.75;
-}
-
-.emotion-5 {
- overflow: auto;
-}
-
-
-
-
-
-
- MapConfigurationId
-
- :
-
-
-
-
- MapConfigurationAlias
-
- :
-
-
-
-
-
-
-
-
-
-
- operation.log
-
-
-
-
-
-
-
-
-
-
- {
-
-
-
-
-
-
-
-
-
-
- "
-
-
- foo
-
-
- "
-
-
-
- :
-
-
-
-
-
- "
- hop-hei-la-la-lei
- "
-
-
-
-
-
-
-
-
- "
-
-
- baz
-
-
- "
-
-
-
- :
-
-
-
-
-
- "
- blee blue blah blueberry dee
- "
-
-
-
-
-
-
-
-
- }
-
-
-
-
-
-
-
-
-
,
- "debug": [Function],
- "findAllByAltText": [Function],
- "findAllByDisplayValue": [Function],
- "findAllByLabelText": [Function],
- "findAllByPlaceholderText": [Function],
- "findAllByRole": [Function],
- "findAllByTestId": [Function],
- "findAllByText": [Function],
- "findAllByTitle": [Function],
- "findByAltText": [Function],
- "findByDisplayValue": [Function],
- "findByLabelText": [Function],
- "findByPlaceholderText": [Function],
- "findByRole": [Function],
- "findByTestId": [Function],
- "findByText": [Function],
- "findByTitle": [Function],
- "getAllByAltText": [Function],
- "getAllByDisplayValue": [Function],
- "getAllByLabelText": [Function],
- "getAllByPlaceholderText": [Function],
- "getAllByRole": [Function],
- "getAllByTestId": [Function],
- "getAllByText": [Function],
- "getAllByTitle": [Function],
- "getByAltText": [Function],
- "getByDisplayValue": [Function],
- "getByLabelText": [Function],
- "getByPlaceholderText": [Function],
- "getByRole": [Function],
- "getByTestId": [Function],
- "getByText": [Function],
- "getByTitle": [Function],
- "queryAllByAltText": [Function],
- "queryAllByDisplayValue": [Function],
- "queryAllByLabelText": [Function],
- "queryAllByPlaceholderText": [Function],
- "queryAllByRole": [Function],
- "queryAllByTestId": [Function],
- "queryAllByText": [Function],
- "queryAllByTitle": [Function],
- "queryByAltText": [Function],
- "queryByDisplayValue": [Function],
- "queryByLabelText": [Function],
- "queryByPlaceholderText": [Function],
- "queryByRole": [Function],
- "queryByTestId": [Function],
- "queryByText": [Function],
- "queryByTitle": [Function],
- "rerender": [Function],
- "unmount": [Function],
-}
-`;
diff --git a/src/pages/conversion/conversion-content.js b/src/pages/conversion/conversion-content.js
index fd762ae..dbcdc0c 100644
--- a/src/pages/conversion/conversion-content.js
+++ b/src/pages/conversion/conversion-content.js
@@ -1,7 +1,6 @@
-import { shallow } from 'zustand/shallow';
import { useTranslation } from 'react-i18next';
-import { conversionSteps, useConversionStore, conversionStatuses } from 'common/store/conversion.store';
+import { conversionSteps, conversionStatuses } from 'common/store/conversion.store';
import {
boldHeader,
contentContainer,
@@ -12,11 +11,8 @@ import { Log } from './log';
import { DownloadLogs } from './download-logs';
import CopyIcon from './copy-icon';
-const conversionStoreSelector = (s) => [s.conversionStepStatus, s.conversionOperationLog, s.selectedStep, s.conversionId, s.diagnosticPackageLocation];
-
-const ConversionContent = () => {
+const ConversionContent = ({conversionStepStatus, conversionOperationLog, selectedStep, conversionId, diagnosticPackageLocation}) => {
const { t } = useTranslation();
- const [conversionStepStatus, operationLog, selectedStep, conversionId, diagnosticPackageLocation] = useConversionStore(conversionStoreSelector, shallow);
if (selectedStep !== conversionSteps.conversion) {
return null;
@@ -28,13 +24,13 @@ const ConversionContent = () => {
ConversionId: {conversionId === null ? '' : conversionId}
-
+ {conversionOperationLog &&
{t('operation.log')}
-
-
+
+
}
{conversionStepStatus !== conversionStatuses.empty && conversionStepStatus !== conversionStatuses.inProgress &&
}
+ link={diagnosticPackageLocation} json={conversionOperationLog} />}
);
};
diff --git a/src/pages/conversion/conversion-content.test.js b/src/pages/conversion/conversion-content.test.js
index 89130a2..0546f7d 100644
--- a/src/pages/conversion/conversion-content.test.js
+++ b/src/pages/conversion/conversion-content.test.js
@@ -1,31 +1,17 @@
import { render } from '@testing-library/react';
import ConversionContent from './conversion-content';
-import { useConversionStore } from 'common/store';
describe('conversion content', () => {
- beforeEach(() => {
- useConversionStore.setState({
- selectedStep: 0,
- conversionOperationLog: null,
- conversionId: null,
- diagnosticPackageLocation: null,
- });
- });
-
it('should render nothing by default', () => {
- const view = render();
+ const view = render();
expect(view).toMatchSnapshot();
});
it('should render conversion content', () => {
- useConversionStore.setState({
- selectedStep: 1,
- conversionOperationLog: JSON.stringify({ foo: 'bar', baz: 'blee blue blah blueberry dee'}, null, 4),
- conversionId: 17,
- diagnosticPackageLocation: 'http://conversion.content.com',
- });
- const view = render();
+ const view = render();
expect(view).toMatchSnapshot();
});
});
\ No newline at end of file
diff --git a/src/pages/conversion/dataset-content.js b/src/pages/conversion/dataset-content.js
index 65fb28b..8e341c8 100644
--- a/src/pages/conversion/dataset-content.js
+++ b/src/pages/conversion/dataset-content.js
@@ -1,17 +1,13 @@
-import { shallow } from 'zustand/shallow';
import { useTranslation } from 'react-i18next';
-import { conversionSteps, useConversionStore, conversionStatuses } from 'common/store/conversion.store';
+import { conversionSteps, conversionStatuses } from 'common/store/conversion.store';
import { boldHeader, contentContainer, logContainer, metaInfoContainer } from './style';
import { Log } from './log';
import { DownloadLogs } from './download-logs';
import CopyIcon from './copy-icon';
-const conversionStoreSelector = (s) => [s.datasetStepStatus, s.datasetOperationLog, s.datasetId, s.selectedStep];
-
-const DatasetContent = () => {
+const DatasetContent = ({ datasetStepStatus, datasetOperationLog, datasetId, selectedStep }) => {
const { t } = useTranslation();
- const [datasetStepStatus, datasetOperationLog, datasetId, selectedStep] = useConversionStore(conversionStoreSelector, shallow);
if (selectedStep !== conversionSteps.dataset) {
return null;
@@ -23,10 +19,10 @@ const DatasetContent = () => {
DatasetId: {datasetId === null ? '' : datasetId}
-
+ {datasetOperationLog &&
{t('operation.log')}
-
+
}
{datasetStepStatus !== conversionStatuses.empty && datasetStepStatus !== conversionStatuses.inProgress &&
}
diff --git a/src/pages/conversion/dataset-content.test.js b/src/pages/conversion/dataset-content.test.js
index 02823b2..89af250 100644
--- a/src/pages/conversion/dataset-content.test.js
+++ b/src/pages/conversion/dataset-content.test.js
@@ -1,31 +1,16 @@
import { render } from '@testing-library/react';
import DatasetContent from './dataset-content';
-import { useConversionStore } from 'common/store';
describe('dataset content', () => {
- beforeEach(() => {
- useConversionStore.setState({
- selectedStep: 2,
- datasetOperationLog: null,
- datasetId: null,
- });
- });
-
it('should render nothing when not selected', () => {
- useConversionStore.setState({
- selectedStep: 1,
- });
- const view = render();
+ const view = render();
expect(view).toMatchSnapshot();
});
it('should render dataset content', () => {
- useConversionStore.setState({
- datasetOperationLog: JSON.stringify({ foo: 'bar', baz: 'The rule of thumb used by most antique dealers is that anything about 100 years or older is an antique. Items that are old, but not quite that old, are called vintage.' }, null, 4),
- datasetId: 'zxcv-data-zxcvzxcv-set-dgfh',
- });
- const view = render();
+ const operationLog = JSON.stringify({ foo: 'bar', baz: 'The rule of thumb used by most antique dealers is that anything about 100 years or older is an antique. Items that are old, but not quite that old, are called vintage.' }, null, 4);
+ const view = render();
expect(view).toMatchSnapshot();
});
});
\ No newline at end of file
diff --git a/src/pages/conversion/index.js b/src/pages/conversion/index.js
index d0b4b69..aca8642 100644
--- a/src/pages/conversion/index.js
+++ b/src/pages/conversion/index.js
@@ -1,8 +1,18 @@
import { shallow } from 'zustand/shallow';
import { useTranslation } from 'react-i18next';
-import { useEffect } from 'react';
+import { useNavigate } from 'react-router-dom';
+import { cx } from '@emotion/css';
+import { Icon } from '@fluentui/react/lib/Icon';
-import { container, content, stepsContainer } from './style';
+import { PATHS } from 'common';
+import {
+ container,
+ content,
+ enabledStep,
+ step as stepStyle,
+ stepsContainer,
+ stepTitle,
+} from './style';
import UploadContent from './upload-content';
import ConversionContent from './conversion-content';
import DatasetContent from './dataset-content';
@@ -10,79 +20,104 @@ import TilesetContent from './tileset-content';
import MapContent from './map-content';
import StepButton from './step-button';
import { conversionSteps, useConversionStore } from 'common/store';
-import { deleteCreatedData } from 'common/api/conversion';
import { conversionStatuses } from 'common/store/conversion.store';
-const unloadCallback = () => {
- deleteCreatedData();
-};
-const beforeUnload = (e) => {
- e.preventDefault();
- return (e.returnValue = '');
-};
-
const conversionStoreSelector = (s) => [
s.uploadStepStatus,
s.uploadStartTime,
s.uploadEndTime,
+ s.uploadOperationLog,
+ s.uploadUdId,
s.conversionStepStatus,
s.conversionStartTime,
s.conversionEndTime,
+ s.conversionOperationLog,
+ s.conversionId,
+ s.diagnosticPackageLocation,
s.datasetStepStatus,
s.datasetStartTime,
s.datasetEndTime,
+ s.datasetOperationLog,
+ s.datasetId,
s.tilesetStepStatus,
s.tilesetStartTime,
s.tilesetEndTime,
+ s.tilesetOperationLog,
+ s.tilesetId,
+ s.mapConfigurationId,
+ s.bbox,
+ s.setStep,
+ s.selectedStep,
];
const Conversion = () => {
const { t } = useTranslation();
+ const navigate = useNavigate();
const [
uploadStepStatus,
uploadStartTime,
uploadEndTime,
+ uploadOperationLog,
+ uploadUdId,
conversionStepStatus,
conversionStartTime,
conversionEndTime,
+ conversionOperationLog,
+ conversionId,
+ diagnosticPackageLocation,
datasetStepStatus,
datasetStartTime,
datasetEndTime,
+ datasetOperationLog,
+ datasetId,
tilesetStepStatus,
tilesetStartTime,
tilesetEndTime,
+ tilesetOperationLog,
+ tilesetId,
+ mapConfigurationId,
+ bbox,
+ setStep,
+ selectedStep,
] = useConversionStore(conversionStoreSelector, shallow);
- useEffect(() => {
- window.addEventListener('beforeunload', beforeUnload);
- window.addEventListener('unload', unloadCallback);
- return () => {
- window.removeEventListener('beforeunload', beforeUnload);
- window.removeEventListener('unload', unloadCallback);
- };
- }, []);
-
return (
+
+
+ startTime={uploadStartTime} step={conversionSteps.upload} title={t('package.upload')}
+ setStep={setStep} selectedStep={selectedStep} />
+ startTime={conversionStartTime} step={conversionSteps.conversion} title={t('package.conversion')}
+ setStep={setStep} selectedStep={selectedStep} />
+ startTime={datasetStartTime} step={conversionSteps.dataset} title={t('dataset.creation')}
+ setStep={setStep} selectedStep={selectedStep} />
+ startTime={tilesetStartTime} step={conversionSteps.tileset} title={t('tileset.creation')}
+ setStep={setStep} selectedStep={selectedStep} />
+ disabled={tilesetStepStatus !== conversionStatuses.finishedSuccessfully}
+ setStep={setStep} selectedStep={selectedStep} />
-
-
-
-
-
+
+
+
+
+
);
diff --git a/src/pages/conversion/index.test.js b/src/pages/conversion/index.test.js
index 71145b5..348cc28 100644
--- a/src/pages/conversion/index.test.js
+++ b/src/pages/conversion/index.test.js
@@ -2,6 +2,13 @@ import { render } from '@testing-library/react';
import Conversion from './index';
+const mockNavigate = jest.fn();
+
+jest.mock('react-router-dom', () => ({
+ ...jest.requireActual('react-router-dom'),
+ useNavigate: () => mockNavigate,
+}));
+
describe('Conversion', () => {
it('should render component', () => {
const view = render();
diff --git a/src/pages/conversion/map-content.js b/src/pages/conversion/map-content.js
index d912c07..30719dd 100644
--- a/src/pages/conversion/map-content.js
+++ b/src/pages/conversion/map-content.js
@@ -1,17 +1,13 @@
-import { conversionSteps, useConversionStore } from 'common/store';
+import { conversionSteps } from 'common/store';
import TilesetMap from './tileset-map';
-const conversionStoreSelector = (s) => s.selectedStep;
-
-const MapContent = () => {
- const selectedStep = useConversionStore(conversionStoreSelector);
-
+const MapContent = ({ selectedStep, mapConfigurationId, bbox }) => {
if (selectedStep !== conversionSteps.map) {
return null;
}
return (
-
+
);
};
diff --git a/src/pages/conversion/past-conversion.js b/src/pages/conversion/past-conversion.js
new file mode 100644
index 0000000..0575d8e
--- /dev/null
+++ b/src/pages/conversion/past-conversion.js
@@ -0,0 +1,128 @@
+import { shallow } from 'zustand/shallow';
+import { useTranslation } from 'react-i18next';
+import { useNavigate } from 'react-router-dom';
+import { cx } from '@emotion/css';
+import { Icon } from '@fluentui/react/lib/Icon';
+
+import { PATHS } from 'common';
+import {
+ container,
+ content,
+ enabledStep,
+ step as stepStyle,
+ stepsContainer,
+ stepTitle,
+} from './style';
+import UploadContent from './upload-content';
+import ConversionContent from './conversion-content';
+import DatasetContent from './dataset-content';
+import TilesetContent from './tileset-content';
+import MapContent from './map-content';
+import StepButton from './step-button';
+import { conversionSteps } from 'common/store';
+import { useConversionPastStore } from 'common/store/conversion-past.store';
+
+import { conversionStatuses } from 'common/store/conversion.store';
+
+const conversionStoreSelector = (s) => [
+ s.uploadStepStatus,
+ s.uploadStartTime,
+ s.uploadEndTime,
+ s.uploadOperationLog,
+ s.uploadUdId,
+ s.conversionStepStatus,
+ s.conversionStartTime,
+ s.conversionEndTime,
+ s.conversionOperationLog,
+ s.conversionId,
+ s.diagnosticPackageLocation,
+ s.datasetStepStatus,
+ s.datasetStartTime,
+ s.datasetEndTime,
+ s.datasetOperationLog,
+ s.datasetId,
+ s.tilesetStepStatus,
+ s.tilesetStartTime,
+ s.tilesetEndTime,
+ s.tilesetOperationLog,
+ s.tilesetId,
+ s.mapConfigurationId,
+ s.bbox,
+ s.setStep,
+ s.selectedStep,
+];
+
+const Conversion = () => {
+ const { t } = useTranslation();
+ const navigate = useNavigate();
+
+ const [
+ uploadStepStatus,
+ uploadStartTime,
+ uploadEndTime,
+ uploadOperationLog,
+ uploadUdId,
+ conversionStepStatus,
+ conversionStartTime,
+ conversionEndTime,
+ conversionOperationLog,
+ conversionId,
+ diagnosticPackageLocation,
+ datasetStepStatus,
+ datasetStartTime,
+ datasetEndTime,
+ datasetOperationLog,
+ datasetId,
+ tilesetStepStatus,
+ tilesetStartTime,
+ tilesetEndTime,
+ tilesetOperationLog,
+ tilesetId,
+ mapConfigurationId,
+ bbox,
+ setStep,
+ selectedStep,
+ ] = useConversionPastStore(conversionStoreSelector, shallow);
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default Conversion;
\ No newline at end of file
diff --git a/src/pages/conversion/step-button.js b/src/pages/conversion/step-button.js
index a072544..edfa17c 100644
--- a/src/pages/conversion/step-button.js
+++ b/src/pages/conversion/step-button.js
@@ -1,19 +1,14 @@
import { useCallback, useState, useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import { cx } from '@emotion/css';
-import { shallow } from 'zustand/shallow';
import { enabledStep, selectedStep as selectedStepStyle, step as stepStyle, stepTimer, stepTitle } from './style';
import Icon from './icon';
-import { useConversionStore } from 'common/store';
import { formatProgressTime } from './format-time';
-const conversionStoreSelector = (s) => [s.setStep, s.selectedStep];
-
-const StepButton = ({ endTime, label, status, startTime, step, title, disabled }) => {
+const StepButton = ({ endTime, label, status, startTime, step, title, disabled, setStep, selectedStep }) => {
const [elapsedTime, setElapsedTime] = useState('');
const intervalRef = useRef(null);
- const [setStep, selectedStep] = useConversionStore(conversionStoreSelector, shallow);
useEffect(() => {
if (startTime !== null && endTime !== null) {
diff --git a/src/pages/conversion/tileset-content.js b/src/pages/conversion/tileset-content.js
index 160d8ac..38ee05e 100644
--- a/src/pages/conversion/tileset-content.js
+++ b/src/pages/conversion/tileset-content.js
@@ -1,17 +1,14 @@
-import { shallow } from 'zustand/shallow';
import { useTranslation } from 'react-i18next';
-import { conversionSteps, useConversionStore, conversionStatuses } from 'common/store/conversion.store';
+import { conversionSteps, conversionStatuses } from 'common/store/conversion.store';
import { boldHeader, contentContainer, logContainer, metaInfoContainer } from './style';
import { Log } from './log';
import { DownloadLogs } from './download-logs';
import CopyIcon from './copy-icon';
-const conversionStoreSelector = (s) => [s.tilesetStepStatus, s.tilesetOperationLog, s.selectedStep, s.mapConfigurationId, s.tilesetId];
-const TilesetContent = () => {
+const TilesetContent = ({ tilesetStepStatus, tilesetOperationLog, selectedStep, mapConfigurationId, tilesetId }) => {
const { t } = useTranslation();
- const [tilesetStepStatus, operationLog, selectedStep, mapConfigurationId, tilesetId] = useConversionStore(conversionStoreSelector, shallow);
if (selectedStep !== conversionSteps.tileset) {
return null;
@@ -29,13 +26,13 @@ const TilesetContent = () => {
-
+ {tilesetOperationLog &&
{t('operation.log')}
-
-
+
+
}
{tilesetStepStatus !== conversionStatuses.empty && tilesetStepStatus !== conversionStatuses.inProgress &&
}
+ json={tilesetOperationLog} />}
);
};
diff --git a/src/pages/conversion/tileset-content.test.js b/src/pages/conversion/tileset-content.test.js
index 9aa491e..b36dcad 100644
--- a/src/pages/conversion/tileset-content.test.js
+++ b/src/pages/conversion/tileset-content.test.js
@@ -14,25 +14,13 @@ describe('tileset content', () => {
});
it('should render nothing by default', () => {
- const view = render();
+ const view = render();
expect(view).toMatchSnapshot();
});
it('should render tileset content', () => {
- useConversionStore.setState({
- selectedStep: 3,
- tilesetOperationLog: JSON.stringify({ foo: 'tileset-operation-log', baz: 'blee blue blah blueberry dee'}, null, 4),
- });
- const view = render();
- expect(view).toMatchSnapshot();
- });
-
- it('should render tileset content logs tab', () => {
- useConversionStore.setState({
- selectedStep: 3,
- tilesetOperationLog: JSON.stringify({ foo: 'hop-hei-la-la-lei', baz: 'blee blue blah blueberry dee'}, null, 4),
- });
- const view = render();
+ const operationLog = JSON.stringify({ foo: 'tileset-operation-log', baz: 'blee blue blah blueberry dee'}, null, 4);
+ const view = render();
expect(view).toMatchSnapshot();
});
});
\ No newline at end of file
diff --git a/src/pages/conversion/tileset-map.js b/src/pages/conversion/tileset-map.js
index d74b59a..3d9b4ff 100644
--- a/src/pages/conversion/tileset-map.js
+++ b/src/pages/conversion/tileset-map.js
@@ -1,17 +1,15 @@
import { useEffect } from 'react';
import { shallow } from 'zustand/shallow';
-import { useConversionStore, useUserStore } from 'common/store';
+import { useUserStore } from 'common/store';
import { indoor, control as indoorControl } from 'azure-maps-indoor';
import { control, Map } from 'azure-maps-control';
import { getEnvs } from 'common/functions';
import { mapContainer } from './style';
-const conversionStoreSelector = (s) => [s.mapConfigurationId, s.bbox];
const userStoreSelector = (s) => [s.geography, s.subscriptionKey];
-const TilesetMap = () => {
- const [mapConfigurationId, bbox] = useConversionStore(conversionStoreSelector, shallow);
+const TilesetMap = ({ mapConfigurationId, bbox }) => {
const [geography, subscriptionKey] = useUserStore(userStoreSelector, shallow);
useEffect(() => {
diff --git a/src/pages/conversion/tileset-map.test.js b/src/pages/conversion/tileset-map.test.js
index d2101b4..e1e529c 100644
--- a/src/pages/conversion/tileset-map.test.js
+++ b/src/pages/conversion/tileset-map.test.js
@@ -10,7 +10,6 @@ jest.mock('azure-maps-control', () => ({
Map: jest.fn(),
}));
jest.mock('common/store', () => ({
- useConversionStore: () => ['map-config-id', [0, 1, 2, 3]],
useUserStore: () => ['US', 'key-subscription'],
}));
@@ -23,7 +22,7 @@ describe('Tileset map', () => {
}));
});
it('should render map', () => {
- render();
+ render();
const constructorSpy = jest.spyOn(azMapsControl, 'Map');
expect(constructorSpy).toBeCalledWith(
'azure-maps-container',
diff --git a/src/pages/conversion/upload-content.js b/src/pages/conversion/upload-content.js
index 0c227b6..837adb9 100644
--- a/src/pages/conversion/upload-content.js
+++ b/src/pages/conversion/upload-content.js
@@ -1,17 +1,13 @@
-import { shallow } from 'zustand/shallow';
import { useTranslation } from 'react-i18next';
-import { conversionStatuses, conversionSteps, useConversionStore } from 'common/store/conversion.store';
+import { conversionStatuses, conversionSteps } from 'common/store/conversion.store';
import { boldHeader, contentContainer, logContainer, metaInfoContainer } from './style';
import { Log } from './log';
import { DownloadLogs } from './download-logs';
import CopyIcon from './copy-icon';
-const conversionStoreSelector = (s) => [s.uploadStepStatus, s.uploadOperationLog, s.uploadUdId, s.selectedStep];
-
-const UploadContent = () => {
+const UploadContent = ({ uploadStepStatus, uploadOperationLog, uploadUdId, selectedStep }) => {
const { t } = useTranslation();
- const [uploadStepStatus, uploadOperationLog, uploadUdId, selectedStep] = useConversionStore(conversionStoreSelector, shallow);
if (selectedStep !== conversionSteps.upload) {
return null;
@@ -23,10 +19,10 @@ const UploadContent = () => {
Udid: {uploadUdId === null ? '' : uploadUdId}
-
+ {uploadOperationLog &&
{t('operation.log')}
-
+
}
{uploadStepStatus !== conversionStatuses.empty && uploadStepStatus !== conversionStatuses.inProgress &&
}
diff --git a/src/pages/conversion/upload-content.test.js b/src/pages/conversion/upload-content.test.js
index f71d678..093e86e 100644
--- a/src/pages/conversion/upload-content.test.js
+++ b/src/pages/conversion/upload-content.test.js
@@ -1,31 +1,16 @@
import { render } from '@testing-library/react';
import UploadContent from './upload-content';
-import { useConversionStore } from 'common/store';
describe('upload content', () => {
- beforeEach(() => {
- useConversionStore.setState({
- selectedStep: 0,
- uploadOperationLog: null,
- uploadUdId: null,
- });
- });
-
it('should render nothing when not selected', () => {
- useConversionStore.setState({
- selectedStep: 1,
- });
- const view = render();
+ const view = render();
expect(view).toMatchSnapshot();
});
it('should render upload content', () => {
- useConversionStore.setState({
- uploadOperationLog: JSON.stringify({ foo: 'bar', baz: 'blee blue blah blueberry dee' }, null, 4),
- uploadUdId: 'zxcv-asdf-zxcvzxcv-asdf-dgfh',
- });
- const view = render();
+ const operationLog = JSON.stringify({ foo: 'bar', baz: 'blee blue blah blueberry dee' }, null, 4);
+ const view = render();
expect(view).toMatchSnapshot();
});
});
\ No newline at end of file
diff --git a/src/pages/conversions/icon.js b/src/pages/conversions/icon.js
new file mode 100644
index 0000000..188af47
--- /dev/null
+++ b/src/pages/conversions/icon.js
@@ -0,0 +1,23 @@
+import { Icon } from '@fluentui/react/lib/Icon';
+
+import { conversionStatuses } from 'common/store/conversion.store';
+import { checkIcon, crossIcon, inProgressIcon } from './style';
+
+export const StatusIcon = ({item}) => {
+ if (!item) {
+ return ;
+ }
+
+ const status = item.uploadStatus ?? item.conversionStatus ?? item.datasetStatus ?? item.tilesetStatus;
+
+ switch (status) {
+ case conversionStatuses.empty:
+ return ;
+ case conversionStatuses.inProgress:
+ return ;
+ case conversionStatuses.failed:
+ return ;
+ default:
+ return ;
+ }
+};
\ No newline at end of file
diff --git a/src/pages/conversions/index.js b/src/pages/conversions/index.js
new file mode 100644
index 0000000..4bf22e5
--- /dev/null
+++ b/src/pages/conversions/index.js
@@ -0,0 +1,294 @@
+import { useEffect, useState, useCallback } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useNavigate } from 'react-router-dom';
+import { shallow } from 'zustand/shallow';
+import { DetailsList, DetailsRow, DetailsListLayoutMode } from '@fluentui/react/lib/DetailsList';
+import { TextField } from '@fluentui/react';
+
+import { PATHS } from 'common';
+import { getAllData } from 'common/api/conversions';
+import { conversionStatuses, useConversionStore } from 'common/store/conversion.store';
+import { useConversionPastStore } from 'common/store/conversion-past.store';
+import { StatusIcon } from './icon';
+import { filterInputStyles, iconsContainer, nameFilterContainer } from './style';
+
+const defaultColumns = [
+ { key: 'nameCol', name: 'Name', fieldName: 'name', minWidth: 40, maxWidth: 200, isResizable: true },
+ { key: 'statusCol', name: 'Status', fieldName: 'status', minWidth: 40, maxWidth: 200, isResizable: true },
+ { key: 'dateCol', name: 'Date', fieldName: 'date', minWidth: 40, maxWidth: 200, isResizable: true, isSorted: true, isSortedDescending: true, },
+];
+
+const addSorting = (columns, sortingColumnKey) => (
+ columns.map((column) => ({
+ ...column,
+ isSorted: column.key === sortingColumnKey,
+ isSortedDescending: isDescending(column, sortingColumnKey),
+ }))
+);
+
+const isDescending = (column, sortingColumnKey) => {
+ if (column.key !== sortingColumnKey) {
+ return undefined;
+ }
+ if (column.isSortedDescending === undefined) {
+ return false;
+ }
+ return !column.isSortedDescending;
+};
+
+const getOnColumnClickCallback = (columns, setColumns, setSorting) => (e, column) => {
+ if (column.key === 'statusCol') return;
+ const newColumns = addSorting(columns, column.key);
+ setSorting({
+ fieldName: column.fieldName,
+ descending: !!newColumns.find((col) => col.key === column.key).isSortedDescending,
+ });
+ setColumns(newColumns.map((col) => ({
+ ...col,
+ onColumnClick: getOnColumnClickCallback(newColumns, setColumns, setSorting),
+ })));
+};
+
+const conversionStoreSelector = (s) => ({
+ uploadStepStatus: s.uploadStepStatus,
+ uploadUdId: s.uploadUdId,
+ uploadStartTime: s.uploadStartTime,
+ uploadDescription: s.uploadDescription,
+ conversionStepStatus: s.conversionStepStatus,
+ conversionId: s.conversionId,
+ conversionDate: s.conversionEndTime,
+ datasetStepStatus: s.datasetStepStatus,
+ datasetId: s.datasetId,
+ datasetDate: s.datasetEndTime,
+ tilesetStepStatus: s.tilesetStepStatus,
+ tilesetId: s.tilesetId,
+ tilesetDate: s.tilesetEndTime,
+});
+
+const pastConversionStoreSelector = (s) => s.setData;
+
+const Conversions = () => {
+ const { t } = useTranslation();
+ const navigate = useNavigate();
+ const [isLoading, setIsLoading] = useState(true);
+ const [existingConversions, setExistingConversions] = useState([]);
+ const [items, setItems] = useState([]);
+ const [sorting, setSorting] = useState({ fieldName: 'date', descending: true});
+ const [columns, setColumns] = useState([]);
+ const [nameFilter, setNameFilter] = useState('');
+
+ const ongoingConversion = useConversionStore(conversionStoreSelector, shallow);
+ const setPastConversionData = useConversionPastStore(pastConversionStoreSelector, shallow);
+
+ const onItemClick = useCallback((item) => {
+ setPastConversionData(item.conversionData);
+ navigate(item.ongoing ? PATHS.CONVERSION : PATHS.PAST_CONVERSION);
+ }, [navigate, setPastConversionData]);
+
+ const onNameFilterChange = (e, text) => setNameFilter(text);
+
+ useEffect(() => {
+ setColumns(defaultColumns.map((column) => ({
+ ...column,
+ onColumnClick: getOnColumnClickCallback(defaultColumns, setColumns, setSorting),
+ })));
+ getAllData().then(({ conversions, datasets, mapDataList, tilesets }) => {
+ setIsLoading(false);
+ const groupedItems = groupItems(ongoingConversion, { conversions, datasets, mapDataList, tilesets });
+ groupedItems.sort((a, b) => a.date < b.date ? 1 : -1);
+ setExistingConversions(groupedItems);
+ });
+ }, []); // eslint-disable-line
+
+ useEffect(() => {
+ const items = [...existingConversions];
+ if (ongoingConversion.uploadStartTime) {
+ items.unshift({
+ ongoing: true,
+ upload: {
+ udid: ongoingConversion.uploadUdId,
+ uploadStatus: ongoingConversion.uploadStepStatus,
+ created: ongoingConversion.uploadStartTime,
+ description: ongoingConversion.uploadDescription,
+ },
+ conversion: {
+ conversionId: ongoingConversion.conversionId,
+ conversionStatus: ongoingConversion.conversionStepStatus,
+ created: ongoingConversion.conversionDate,
+ },
+ dataset: {
+ datasetId: ongoingConversion.datasetId,
+ datasetStatus: ongoingConversion.datasetStepStatus,
+ created: ongoingConversion.datasetDate,
+ },
+ tileset: {
+ tilesetId: ongoingConversion.tilesetId,
+ tilesetStatus: ongoingConversion.tilesetStepStatus,
+ created: ongoingConversion.tilesetDate,
+ },
+ date: new Date(ongoingConversion.tilesetDate ?? ongoingConversion.uploadStartTime),
+ });
+ }
+
+ setItems(items.map((item, i) => ({
+ key: i,
+ name: item.upload?.description ?? item.conversion?.description ?? item.dataset?.description ?? item.tileset?.description ?? '',
+ status: (
+
+
+
+
+
+
+ ),
+ date: item.date.toLocaleString(),
+ ongoing: item.ongoing,
+ conversionData: {
+ uploadStepStatus: item.upload?.udid ? conversionStatuses.finishedSuccessfully : conversionStatuses.empty,
+ uploadUdId: item.upload?.udid,
+ conversionStepStatus: item.conversion?.conversionId ? conversionStatuses.finishedSuccessfully : conversionStatuses.empty,
+ conversionId: item.conversion?.conversionId,
+ datasetStepStatus: item.dataset?.datasetId ? conversionStatuses.finishedSuccessfully : conversionStatuses.empty,
+ datasetId: item.dataset?.datasetId,
+ tilesetStepStatus: item.tileset?.tilesetId ? conversionStatuses.finishedSuccessfully : conversionStatuses.empty,
+ tilesetId: item.tileset?.tilesetId,
+ mapConfigurationId: item.tileset?.defaultMapConfigurationId,
+ bbox: item.tileset?.bbox,
+ }
+ })).filter((item) => item.name.includes(nameFilter)).sort((a, b) => {
+ if (a[sorting.fieldName] < b[sorting.fieldName]) {
+ return sorting.descending ? 1 : -1;
+ }
+ return sorting.descending ? -1 : 1;
+ }));
+ }, [existingConversions, ongoingConversion, t, sorting, nameFilter]);
+
+ if (isLoading) {
+ return {t('loading')}
;
+ }
+
+ return (
+ <>
+
+
+
+ (
+
+ )}
+ layoutMode={DetailsListLayoutMode.justified}
+ selectionMode={0}
+ />
+ >
+ );
+};
+
+function groupItems(ongoingConversion, { conversions, datasets, mapDataList, tilesets }) {
+ const items = [];
+
+ const usedItems = {
+ datasets: new Set([ongoingConversion.datasetId]),
+ conversions: new Set([ongoingConversion.conversionId]),
+ uploads: new Set([ongoingConversion.uploadUdId]),
+ };
+
+ tilesets?.forEach((tileset) => {
+ if (tileset.tilesetId === ongoingConversion.tilesetId) {
+ return;
+ }
+ const item = {
+ tileset,
+ };
+ const dataset = datasets.find((dataset) => {
+ if (dataset.datasetId === tileset.datasetId) {
+ usedItems.datasets.add(dataset.datasetId);
+ return true;
+ }
+ return false;
+ });
+ item.dataset = dataset;
+ const conversionIds = dataset?.datasetSources?.conversionIds ?? [];
+ const conversion = conversions.find((c) => {
+ if (conversionIds.includes(c.conversionId)) {
+ usedItems.conversions.add(c.conversionId);
+ return true;
+ }
+ return false;
+ });
+ item.conversion = conversion;
+ item.upload = mapDataList.find((upload) => {
+ if (upload.udid === conversion?.udid) {
+ usedItems.uploads.add(upload.udid);
+ return true;
+ }
+ return false;
+ });
+ item.date = new Date(item.tileset.created);
+ items.push(item);
+ });
+
+ datasets?.forEach((dataset) => {
+ if (usedItems.datasets.has(dataset.datasetId) || dataset.datasetId === ongoingConversion.datasetId) {
+ return;
+ }
+ const item = {
+ dataset,
+ };
+
+ const conversionIds = dataset.datasetSources?.conversionIds ?? [];
+ const conversion = conversions.find((c) => {
+ if (conversionIds.includes(c.conversionId)) {
+ usedItems.conversions.add(c.conversionId);
+ return true;
+ }
+ return false;
+ });
+ item.conversion = conversion;
+ item.upload = mapDataList.find((upload) => {
+ if (upload.udid === conversion?.udid) {
+ usedItems.uploads.add(upload.udid);
+ return true;
+ }
+ return false;
+ });
+ item.date = new Date(item.dataset.created);
+ items.push(item);
+ });
+
+ conversions?.forEach((conversion) => {
+ if (usedItems.conversions.has(conversion.conversionId) || conversion.conversionId === ongoingConversion.conversionId) {
+ return;
+ }
+ const item = {
+ conversion,
+ };
+
+ item.upload = mapDataList.find((upload) => {
+ if (upload.udid === conversion.udid) {
+ usedItems.uploads.add(upload.udid);
+ return true;
+ }
+ return false;
+ });
+ item.date = new Date(item.conversion.created);
+ items.push(item);
+ });
+
+ mapDataList?.forEach((upload) => {
+ if (usedItems.uploads.has(upload.udid) || upload.udid === ongoingConversion.udid) {
+ return;
+ }
+ items.push({
+ upload,
+ date: new Date(upload.created),
+ });
+ });
+
+ return items;
+}
+
+export default Conversions;
\ No newline at end of file
diff --git a/src/pages/conversions/style.js b/src/pages/conversions/style.js
new file mode 100644
index 0000000..84a4c67
--- /dev/null
+++ b/src/pages/conversions/style.js
@@ -0,0 +1,46 @@
+import { css, keyframes } from '@emotion/css';
+
+import { color, fontSize } from 'common/styles';
+
+export const crossIcon = css`
+ color: ${color.redError};
+`;
+
+export const checkIcon = css`
+ color: ${color.greenIcon};
+`;
+
+const spin = keyframes`
+ from {
+ transform: rotate(0deg);
+ }
+ to {
+ transform: rotate(360deg);
+ }
+`;
+
+export const inProgressIcon = css`
+ color: ${color.blueIcon};
+ animation: ${spin} 2s linear infinite;
+`;
+
+export const iconsContainer = css`
+ display: flex;
+ gap: 2px;
+`;
+
+export const nameFilterContainer = css`
+ width: 300px;
+ margin-top: 1rem;
+ border-color: red;
+`;
+
+export const filterInputStyles = {
+ fieldGroup: [{
+ height: '1.5rem',
+ borderColor: color.grayBorder,
+ }],
+ field: [{
+ fontSize: fontSize.sm,
+ }]
+};
\ No newline at end of file
diff --git a/src/pages/create-manifest/__snapshots__/create-manifest.test.js.snap b/src/pages/create-manifest/__snapshots__/create-manifest.test.js.snap
index 2b0b2a5..861cc56 100644
--- a/src/pages/create-manifest/__snapshots__/create-manifest.test.js.snap
+++ b/src/pages/create-manifest/__snapshots__/create-manifest.test.js.snap
@@ -525,6 +525,9 @@ Object {
+
+ view.existing.conversions
+
,
@@ -1049,6 +1052,9 @@ Object {
+
+ view.existing.conversions
+
,
"debug": [Function],
@@ -1634,6 +1640,9 @@ Object {
+
+ view.existing.conversions
+