Commit b94c9695 authored by Pierre Marchand's avatar Pierre Marchand

[client/project] fixed timeline failed to update on project change

parent e2b3e0c1
......@@ -24,7 +24,7 @@ import { fetchProjects, fetchProfiles, fetchTimeline, fetchAlias } from '../remo
import { AppLayout } from '../shape/app';
import { getApiUrl } from 'sdi/app';
import { setCurrentTimelineUnit, setCurrentTimelineId, setTimelineWindow } from '../events/project';
import { setCurrentTimelineUnit, setCurrentTimelineId, setTimelineWindow, clearTimeLine } from '../events/project';
const logger = debug('sdi:events/app');
......@@ -45,11 +45,12 @@ export const loadProfiles =
.catch(err => logger(err));
export const loadAlias =
() => fetchAlias(getApiUrl('alias')).then(as => assign('data/alias', as))
() => fetchAlias(getApiUrl('alias')).then(as => assign('data/alias', as));
export const loadTimeline =
(id: number) => {
clearTimeLine();
fetchTimeline(getApiUrl(`geodata/angled/p/project/${id}/timeline/`))
.then((timeline) => {
assign('component/project/timeline', timeline);
......@@ -67,34 +68,5 @@ export const setProfileAndPannelNumber =
assign('profile/current/page', pannelNumber);
};
//that allready in angled-core
// export const updateGeocoderTerm =
// (address: string) => {
// dispatch('component/geocoder', state => ({ ...state, address }));
// }
// export const updateGeocoderResponse =
// (serviceResponse: IUgWsResponse | null) => {
// dispatch('component/geocoder', (state) => {
// state.serviceResponse = serviceResponse;
// return state;
// });
// }
// export const unfoldGeocoder =
// () => {
// dispatch('component/geocoder', (state) => {
// state.folded = false;
// return state;
// });
// }
// export const foldGeocoder =
// () => {
// dispatch('component/geocoder', (state) => {
// state.folded = true;
// return state;
// });
// }
logger('loaded');
......@@ -272,7 +272,7 @@ export const clearProjectForm = (pid: number) => {
clearRemoveUnitFromMulti();
resetWriteDomain();
assign('component/ui/form/manip-team-member', []);
}
};
export const pushStaged =
() => {
......@@ -280,9 +280,9 @@ export const pushStaged =
assign('component/project/saving/error', null);
const onSuccess = () => setLayout('Form');
const onError = (err: unknown) => {
logger(`SaveError`, err)
logger(`SaveError`, err);
assign('component/project/saving/error', `${err}`);
}
};
dispatch('component/project/form/stage', (us) => {
......@@ -420,6 +420,17 @@ export const selectUnit =
};
export const clearTimeLine = () => {
assign('component/project/timeline', []);
assign('component/project/timeline/window', null);
assign('component/project/timeline-unit', []);
assign('component/project/timeline/current-id', null);
assign('component/project/timeline/current-unit', null);
assign('component/project/timeline/current-time', null);
assign('component/project/timeline/current-project', null);
};
export const loadTimelineUnit =
(name: InformationUnitName) =>
getCurrentProjectId().map(pid =>
......
......@@ -45,6 +45,7 @@ declare module 'sdi/shape' {
'component/project/timeline/current-unit': Nullable<InformationUnitName>;
'component/project/timeline/current-time': Nullable<number>;
'component/project/timeline/current-project': Nullable<Project>;
'component/project/data/nova': Collection<RemoteResource<object>>;
'component/project/display/type': DisplayType;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment