Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Oskari.clazz.define('Oskari.coordinatetransformation.Flyout',
},
getHandler: function () {
if (!this.handler) {
this.handler = new ViewHandler(this.instance, this.loc);
this.handler = new ViewHandler(this.instance, this.loc, this.instance.getConfiguration()?.url);
this.handler.addStateListener(() => this.lazyRender());
}
return this.handler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,19 @@
});

class UIHandler extends StateHandler {
constructor (instance) {
constructor (instance, loc, serverUrl) {
super();
this.instance = instance;
this.sandbox = instance.getSandbox();
this.loc = instance.loc;
this.loc = loc;
this.infoPopup = null;
this.filePopup = null;
this.mapPopup = null;
this.clipboardPopup = null;
this.confirmPopup = null;
this.setState(getInitialState());
this.addStateListener(state => this.filePopup?.update(state));
this.baseUrl = serverUrl || Oskari.urls.getRoute('CoordinateTransformation');
Oskari.urls.set(WATCH_JOB, WATCH_URL);
}

Expand Down Expand Up @@ -151,7 +152,7 @@
const updated = [...this.getState().coordinates];
updated[index] = coordinate;
// fill empty/undefined with object
const coordinates = updated.map(c => c ? c : { invalid: true });

Check warning on line 155 in bundles/paikkatietoikkuna/coordinatetransformation/handler/ViewHandler.js

View workflow job for this annotation

GitHub Actions / build (20)

Unnecessary use of conditional expression for default assignment
this.addSourceToState('table');
this.updateState({ coordinates, transformed: false });
}
Expand Down Expand Up @@ -204,7 +205,7 @@
this.setHeightSrs(type, null);
}
}
inputSrsChange (srs) {

Check warning on line 208 in bundles/paikkatietoikkuna/coordinatetransformation/handler/ViewHandler.js

View workflow job for this annotation

GitHub Actions / build (20)

Expected blank line between class members
const { coordinates, inputSrs } = this.getState();
if (!inputSrs || !coordinates.length) {
this.setSrs('input', srs, true);
Expand Down Expand Up @@ -306,12 +307,12 @@
this.updateState(newTypeState);
}
// TODO: refactor
setImport (key, value) {

Check warning on line 310 in bundles/paikkatietoikkuna/coordinatetransformation/handler/ViewHandler.js

View workflow job for this annotation

GitHub Actions / build (20)

Expected blank line between class members
const current = this.getState().import;
this.updateState({ import: { ...current, [key]: value } });
}
// TODO: refactor
setExport (key, value) {

Check warning on line 315 in bundles/paikkatietoikkuna/coordinatetransformation/handler/ViewHandler.js

View workflow job for this annotation

GitHub Actions / build (20)

Expected blank line between class members
const current = this.getState().export;
this.updateState({ export: { ...current, [key]: value } });
}
Expand Down Expand Up @@ -505,7 +506,7 @@
const state = this.getState();
const { params, body } = stateToPTIArray(state, transformType, true);
const { fileName } = state.export;
fetch(Oskari.urls.getRoute('CoordinateTransformation', params), {
fetch(Oskari.urls.buildUrl(this.baseUrl, params), {
method: 'POST',
body
}).then(response => {
Expand Down Expand Up @@ -557,7 +558,7 @@
}
this.updateState({ loading: true });
const { params, body } = stateToPTIArray(state, 'A2A', false);
fetch(Oskari.urls.getRoute('CoordinateTransformation', params), {
fetch(Oskari.urls.buildUrl(this.baseUrl, params), {
method: 'POST',
headers: {
Accept: 'application/json'
Expand Down Expand Up @@ -587,7 +588,7 @@
this.updateState({ loading: true });

const { params, body } = stateToPTIArray(state, transformType, false);
fetch(Oskari.urls.getRoute('CoordinateTransformation', params), {
fetch(Oskari.urls.buildUrl(this.baseUrl, params), {
method: 'POST',
headers: {
Accept: 'application/json'
Expand Down
Loading