-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2695 from DenverCoder544/publisher_tools_reactifi…
…cation Publisher tools reactification
- Loading branch information
Showing
13 changed files
with
186 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
87 changes: 87 additions & 0 deletions
87
bundles/mapping/mapmodule/plugin/logo/publisher/LogoTool.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { AbstractPublisherTool } from '../../../../../framework/publisher2/tools/AbstractPublisherTool'; | ||
|
||
class LogoTool extends AbstractPublisherTool { | ||
constructor (...args) { | ||
super(...args); | ||
this.index = 1; | ||
this.group = 'additional'; | ||
this.config = null; | ||
} | ||
|
||
init (data) { | ||
const plugin = this.findPluginFromInitData(data); | ||
if (plugin) { | ||
this.storePluginConf(plugin.config); | ||
// when we enter publisher: | ||
// restore saved location for plugin that is not stopped nor started | ||
this.getPlugin().setLocation(plugin.config?.location?.classes); | ||
} | ||
} | ||
|
||
getTool () { | ||
return { | ||
id: 'Oskari.mapframework.bundle.mapmodule.plugin.LogoPlugin', | ||
title: 'LogoPlugin', | ||
config: this.state.pluginConfig || {} | ||
}; | ||
} | ||
|
||
// not displayed on tool panels so user can't disable it | ||
isDisplayed () { | ||
return false; | ||
} | ||
|
||
getPlugin () { | ||
// always use the instance on map, not a new copy | ||
return this.getMapmodule().getPluginInstances('LogoPlugin'); | ||
} | ||
|
||
// always enabled, use the instance that is on map | ||
isEnabled () { | ||
return true; | ||
} | ||
|
||
stop () { | ||
// when we exit publisher: | ||
// move plugin back to bottom left if it was dragged during publisher | ||
this.getPlugin()?.setLocation('bottom left'); | ||
} | ||
|
||
/** | ||
* Get values. | ||
* @method getValues | ||
* @public | ||
* | ||
* @returns {Object} tool value object | ||
*/ | ||
getValues () { | ||
const plugin = this.getPlugin(); | ||
if (!plugin) { | ||
return null; | ||
} | ||
return { | ||
configuration: { | ||
mapfull: { | ||
conf: { | ||
plugins: [{ | ||
id: this.getTool().id, | ||
config: { | ||
location: plugin.getConfig()?.location | ||
} | ||
}] | ||
} | ||
} | ||
} | ||
}; | ||
} | ||
} | ||
|
||
// Attach protocol to make this discoverable by Oskari publisher | ||
Oskari.clazz.defineES('Oskari.publisher.LogoTool', | ||
LogoTool, | ||
{ | ||
protocol: ['Oskari.mapframework.publisher.Tool'] | ||
} | ||
); | ||
|
||
export { LogoTool }; |
Oops, something went wrong.