From 889e3742ae55147db08ce09b7555d896b37001b2 Mon Sep 17 00:00:00 2001 From: Raruto Date: Tue, 23 Jan 2024 15:38:36 +0100 Subject: [PATCH] Remove API `g3wsdk.core.workflow` related to `g3w-client-plugin-editing` repository (#545) * remove workflow files - delete folder `src/app/core/workflow/` - delete file: `src/services/workflows.js` - delete API: `g3wsdk.workflow` * Delete UserMessageSteps.js * Remove locales workflow translation and move to g3w-client-plugin-editing * Clean code * remove empty object * restore legacy tips (v3.4) --------- Co-authored-by: volterra79 --- src/app/api.js | 14 - src/app/core/workflow/flow.js | 98 ------- src/app/core/workflow/queque.js | 32 --- src/app/core/workflow/step.js | 264 ----------------- src/app/core/workflow/task.js | 67 ----- src/app/core/workflow/workflow.js | 441 ----------------------------- src/components/UserMessageSteps.js | 107 ------- src/components/index.js | 2 - src/locales/de.js | 6 - src/locales/en.js | 6 - src/locales/fi.js | 6 - src/locales/fr.js | 6 - src/locales/it.js | 6 - src/locales/ro.js | 6 - src/locales/se.js | 7 - src/services/application.js | 2 +- src/services/index.js | 2 - src/services/workflows.js | 79 ------ 18 files changed, 1 insertion(+), 1150 deletions(-) delete mode 100644 src/app/core/workflow/flow.js delete mode 100644 src/app/core/workflow/queque.js delete mode 100644 src/app/core/workflow/step.js delete mode 100644 src/app/core/workflow/task.js delete mode 100644 src/app/core/workflow/workflow.js delete mode 100644 src/components/UserMessageSteps.js delete mode 100644 src/services/workflows.js diff --git a/src/app/api.js b/src/app/api.js index d8145bc33..29eef145e 100644 --- a/src/app/api.js +++ b/src/app/api.js @@ -98,7 +98,6 @@ import PluginsRegistry from 'store/plugins'; import ProjectsRegistry from 'store/projects'; import RelationsService from 'services/relations'; import TaskService from 'services/tasks'; -import WorkflowsStack from 'services/workflows'; import ApiService from 'services/api'; import RouterService from 'services/router'; @@ -147,10 +146,6 @@ const Filter = require('core/layers/filter/filter'); const Expression = require('core/layers/filter/expression'); const Plugin = require('core/plugin/plugin'); const PluginService = require('core/plugin/pluginservice'); -const Task = require('core/workflow/task'); -const Step = require('core/workflow/step'); -const Flow = require('core/workflow/flow'); -const Workflow = require('core/workflow/workflow'); /** * GUI modules @@ -307,8 +302,6 @@ const g3wsdk = { WmsLayer, XYZLayer, MapLayer, - geometry: { - }, features: { Feature, FeaturesStore, @@ -331,13 +324,6 @@ const g3wsdk = { PluginsRegistry, PluginService }, - workflow: { - Task, - Step, - Flow, - Workflow, - WorkflowsStack - }, input: { inputService: { handleFilterExpressionFormInput: FormService._getFilterExpression, diff --git a/src/app/core/workflow/flow.js b/src/app/core/workflow/flow.js deleted file mode 100644 index 2ea982e67..000000000 --- a/src/app/core/workflow/flow.js +++ /dev/null @@ -1,98 +0,0 @@ -const { base, inherit } = require('utils'); -const G3WObject = require('core/g3wobject'); -const Queque = require('core/workflow/queque'); - -//Class Flow of workflow step by step -function Flow() { - let steps = []; - let inputs; - let counter = 0; - let context = null; - let d; - let _workflow; - this.queques = { - end: new Queque(), - micro: new Queque() - }; - //start workflow - this.start = function(workflow) { - d = $.Deferred(); - if (counter > 0) { - console.log("reset workflow before restarting"); - } - _workflow = workflow; - inputs = workflow.getInputs(); - context = workflow.getContext(); - steps = workflow.getSteps(); - // check if there are steps - if (steps && steps.length) { - //run step (first) - this.runStep(steps[0], inputs, context); - } - // return a promise that will be reolved if all step go right - return d.promise(); - }; - - //run step - this.runStep = function(step, inputs) { - //run step that run task - _workflow.setMessages({ - help: step.state.help - }); - const runMicroTasks = this.queques.micro.getLength(); - step.run(inputs, context, this.queques) - .then(outputs => { - runMicroTasks && this.queques.micro.run(); - this.onDone(outputs); - }) - .fail(error => this.onError(error)); - }; - - //check if all step are resolved - this.onDone = function(outputs) { - counter++; - if (counter === steps.length) { - counter = 0; - d.resolve(outputs); - return; - } - this.runStep(steps[counter], outputs); - }; - - // in case of error - this.onError = function(err) { - counter = 0; - this.clearQueques(); - d.reject(err); - }; - - // stop flow - this.stop = function() { - const d = $.Deferred(); - steps[counter].isRunning() ? steps[counter].stop() : null; - this.clearQueques(); - if (counter > 0) { - // set counter to 0 - counter = 0; - // reject flow - d.reject(); - } else { - //reject to force rollback session - d.resolve(); - } - return d.promise(); - }; - base(this) -} - -inherit(Flow, G3WObject); - -const proto = Flow.prototype; - -proto.clearQueques = function(){ - this.queques.micro.clear(); - this.queques.end.clear(); -}; - -module.exports = Flow; - diff --git a/src/app/core/workflow/queque.js b/src/app/core/workflow/queque.js deleted file mode 100644 index eb3aae953..000000000 --- a/src/app/core/workflow/queque.js +++ /dev/null @@ -1,32 +0,0 @@ -function Queque() { - this.tasks = []; -} - -const proto = Queque.prototype; - -proto.addTask = function(task){ - this.tasks.push(task); -}; - -proto.run = function(reverse=false){ - while (this.tasks.length) { - const task = reverse ? this.tasks.pop() : this.tasks.shift(); - task(); - } -}; - -proto.flush = function(){ - return this.tasks.splice(0); -}; - -proto.getLength = function(){ - return this.tasks.length; -}; - -proto.clear = function(){ - this.run(); - this.tasks = []; -}; - -module.exports = Queque; - diff --git a/src/app/core/workflow/step.js b/src/app/core/workflow/step.js deleted file mode 100644 index 86e65f292..000000000 --- a/src/app/core/workflow/step.js +++ /dev/null @@ -1,264 +0,0 @@ -const { base, inherit } = require('utils'); -const G3WObject = require('core/g3wobject'); - -/** - * @param options.input - * @param options.context - * @param options.task - * @param options.outputs - * @param options.escKeyPressEventHandler - * @param options.id - * @param options.name - * @param options.help - * @param options.message - */ -function Step(options = {}) { - - base(this); - - const { - inputs = null, - context = null, - task = null, - outputs = null, - escKeyPressEventHandler, - } = options; - - /** - * @FIXME add description - */ - this._inputs = inputs; - - /** - * @FIXME add description - */ - this._context = context; - - /** - * @FIXME add description - */ - this._task = task; - - /** - * @FIXME add description - */ - this._outputs = outputs; - - /** - * Dynamic state of step - */ - this.state = { - id: options.id || null, - name: options.name || null, - help: options.help || null, // help to show what the user has to do - running: false, // running - error: null, // error - message: options.message || null // message - }; - - if (escKeyPressEventHandler) { - this.registerEscKeyEvent(escKeyPressEventHandler) - } - -} - -inherit(Step, G3WObject); - -const proto = Step.prototype; - -/** - * Bind interrupt event on keys escape pressed - * - * @param evt.key - * @param evt.data.callback - * @param evt.data.task - */ -proto.escKeyUpHandler = function(evt) { - if ('Escape' === evt.key) { - evt.data.callback({ task: evt.data.task }); - } -}; - -/** - * @FIXME add description - */ -proto.unbindEscKeyUp = function() { - $(document).unbind('keyup', this.escKeyUpHandler); -}; - -/** - * @FIXME add description - */ -proto.bindEscKeyUp = function(callback = () => {}) { - $(document).on('keyup', { callback, task: this.getTask()}, this.escKeyUpHandler); -}; - -/** - * @listens run - * @listens stop - */ -proto.registerEscKeyEvent = function(callback) { - this.on('run', () => this.bindEscKeyUp(callback)); - this.on('stop', () => this.unbindEscKeyUp()); -}; - -/** - * Start task - * - * @param inputs - * @param context - * @param queques - * - * @returns jQuery promise - * - * @fires run - */ -proto.run = function(inputs, context, queques) { - const d = $.Deferred(); - - this.emit('run', { inputs, context }); - - if (this._task) { - try { - this.state.running = true; // change state to running - this._task.setInputs(inputs); - this._task.setContext(context); - this._task - .run(inputs, context, queques) - .then(outputs => { this.stop(); d.resolve(outputs); }) - .fail(err => { this.stop(); d.reject(err); }); - } catch(err) { - console.warn(err) - this.state.error = err; - this.state.error = 'Problem ..'; - this.stop(); - d.reject(err); - } - } - - return d.promise(); -}; - -/** - * Stop step - * - * @fires stop - */ -proto.stop = function() { - this._task.stop(this._inputs, this._context); // stop task - this.state.running = false; // remove running state - this.emit('stop'); - this._task.setInputs(null); - this._task.setContext(null); -}; - -/** - * Revert task - */ -proto.revert = function() { - if (this._task && this._task.revert) { - this._task.revert(); - } -}; - -/** - * @FIXME add description - */ -proto.panic = function() { - if (this._task && this._task.panic) { - this._task.panic(); - } -}; - -/** - * @FIXME add description - */ -proto.getId = function() { - return this.state.id; -}; - -/** - * @FIXME add description - */ -proto.getName = function() { - return this.state.name; -}; - -/** - * @FIXME add description - */ -proto.getHelp = function() { - return this.state.help; -}; - -/** - * @FIXME add description - */ -proto.getError = function() { - return this.state.error; -}; - -/** - * @FIXME add description - */ -proto.getMessage = function() { - return this.state.message; -}; - -/** - * @FIXME add description - */ -proto.isRunning = function() { - return this.state.running; -}; - -/** - * @FIXME add description - */ -proto.setInputs = function(inputs) { - this._inputs = inputs; -}; - -/** - * @FIXME add description - */ -proto.getInputs = function() { - return this._inputs; -}; - -/** - * @FIXME add description - */ -proto.setTask = function(task) { - this._task = task; -}; - -/** - * @FIXME add description - */ -proto.getTask = function() { - return this._task; -}; - -/** - * @FIXME add description - */ -proto.setOutputs = function(outputs) { - this._outputs = outputs; -}; - -/** - * @FIXME add description - */ -proto.getOutputs = function() { - return this._outputs; -}; - -/** - * @FIXME add description - */ -Step.MESSAGES = { - help: null, -}; - -module.exports = Step; \ No newline at end of file diff --git a/src/app/core/workflow/task.js b/src/app/core/workflow/task.js deleted file mode 100644 index 077c06382..000000000 --- a/src/app/core/workflow/task.js +++ /dev/null @@ -1,67 +0,0 @@ -const { base, inherit } = require('utils'); -const G3WObject = require('core/g3wobject'); - -function Task(options={}) { - base(this, options); - this.state = { - usermessagesteps: {} - }; -} - -inherit(Task, G3WObject); - -const proto = Task.prototype; - -/** - * Set and get task usefult properties used to run - */ - -proto.setInputs = function(inputs){ - this.inputs = inputs; -}; - -proto.getInputs = function(){ - return this.inputs; -}; - -proto.setContext = function(context){ - return this.context = context; -}; - -proto.getContext = function(){ - return this.context; -}; - -proto.revert = function() { - console.log('Revert to implemente '); -}; - -proto.panic = function() { - console.log('Panic to implement ..'); -}; - -proto.stop = function() { - console.log('Task Stop to implement ..'); -}; - -proto.run = function() { - console.log('Wrong. This method has to be overwrite from task'); -}; - -proto.setRoot = function(task) { - this.state.root = task; -}; - -proto.getUserMessageSteps = function() { - return this.state.usermessagesteps; -}; - -proto.setUserMessageSteps = function(steps={}) { - this.state.usermessagesteps = steps; -}; - -proto.setUserMessageStepDone = function(type) { - if (type) this.state.usermessagesteps[type].done = true; -}; - -module.exports = Task; diff --git a/src/app/core/workflow/workflow.js b/src/app/core/workflow/workflow.js deleted file mode 100644 index 126b687c0..000000000 --- a/src/app/core/workflow/workflow.js +++ /dev/null @@ -1,441 +0,0 @@ -import WorkflowsStack from 'services/workflows'; -import GUI from 'services/gui'; - -import UserMessageSteps from 'components/UserMessageSteps'; - -const { - base, - inherit, - resolve -} = require('utils'); -const G3WObject = require('core/g3wobject'); -const Flow = require('core/workflow/flow'); -const { MESSAGES } = require('core/workflow/step'); - -/** - * Workflow Class (manage flow of steps) - * - * @param options.inputs - * @param options.context - * @param options.flow - * @param options.steps - * @param options.runOnce - * @param options.backbuttonlabel - * - * @constructor - */ -function Workflow(options = {}) { - - const { - inputs = null, - context = null, - flow = new Flow(), - steps = [], - runOnce = false, - backbuttonlabel = null, - } = options; - - base(this); - - /** - * @FIXME add description - */ - this._promise = null; - - /** - * Mandatory inputs to work with editing - */ - this._inputs = inputs; - - /** - * @FIXME add description - */ - this._context = context; - - /** - * Flow object to control the flow - */ - this._flow = flow; - - /** - * All steps of flow - */ - this._steps = steps; - - /** - * Whether is child of another workflow - */ - this._child = null; - - /** - * stack workflowindex - */ - this._stackIndex = null; - - /** - * Stop when flow stop - */ - this.runOnce = runOnce; - - /** - * @FIXME add description - */ - this._messages = MESSAGES; - - /** - * @FIXME add description - */ - this._userMessageSteps = this._steps.reduce((messagesSteps, step) => { - const usermessagesteps = step.getTask().getUserMessageSteps(); - return usermessagesteps && { ...messagesSteps, ...usermessagesteps, } || messagesSteps }, - {}); - - /** - * Holds back button label (in case of child workflow) - * - * @since 3.9.0 - */ - this.backbuttonlabel = backbuttonlabel; - -} - -inherit(Workflow, G3WObject); - -const proto = Workflow.prototype; - -/** - * @returns { * } - */ -proto.getContextService = function() { - return this.getContext().service; -}; - -/** - * @param service - */ -proto.setContextService = function(service) { - this.getContext().service = service; -}; - -/** - * @returns { null | * } - */ -proto.getStackIndex = function() { - return this._stackIndex; -}; - -/** - * @param workflow - */ -proto.addChild = function(workflow) { - if (this._child) { - this._child.addChild(workflow); - } else { - this._child = workflow; - } -}; - -/** - * @FIXME add description - */ -proto.removeChild = function() { - if (this._child) { - WorkflowsStack.removeAt(this._child.getStackIndex()); - } - this._child = null; -}; - -/** - * @param input.key - * @param input.value - */ -proto.setInput = function({ - key, - value, -}) { - this._inputs[key] = value; -}; - -/** - * @TODO check if deprecated (probably unused) - * - * @param inputs - * - * @private - */ -proto._setInputs = function(inputs) { - this._inputs = inputs; -}; - -/** - * @returns { null | * } - */ -proto.getInputs = function() { - return this._inputs; -}; - -/** - * @param context - */ -proto.setContext = function(context) { - this._context = context; -}; - -/** - * @returns { * | {} | null } - */ -proto.getContext = function() { - return this._context; -}; - -/** - * @returns {*} - */ -proto.getFlow = function() { - return this._flow; -}; - -/** - * @param flow - */ -proto.setFlow = function(flow) { - this._flow = flow; -}; - -/** - * @param step - */ -proto.addStep = function(step) { - this._steps.push(step); -}; - -/** - * @param steps - */ -proto.setSteps = function(steps) { - this._steps = steps; -}; - -/** - * @returns { * | Array } - */ -proto.getSteps = function() { - return this._steps; -}; - -/** - * @param index - * - * @returns { * } - */ -proto.getStep = function(index) { - return this._steps[index]; -}; - -/** - * @param messages - */ -proto.setMessages = function(messages) { - Object.assign(this._messages, messages); -}; - -/** - * @FIXME add description - */ -proto.getMessages = function() { - return this._messages; -}; - -/** - * @FIXME add description - */ -proto.clearMessages = function() { - this._messages.help = null; - if (this._isThereUserMessaggeSteps()) { - this.clearUserMessagesSteps(); - } -}; - -/** - * @returns { * | null } - */ -proto.getLastStep = function() { - return this._steps.length ? this._steps[ this._steps.length - 1 ] : null; -}; - -/** - * @returns { T } - */ -proto.getRunningStep = function() { - return this._steps.find(step => step.isRunning()); -}; - -/** - * Stop all workflow children - */ -proto._stopChild = function() { - return this._child ? - this._child.stop() : - resolve(); // <-- FIXME: undefined function ? -}; - -/** - * @returns { number } - * - * @private - */ -proto._isThereUserMessaggeSteps = function() { - return Object.keys(this._userMessageSteps).length; -}; - -/** - * @FIXME add description - */ -proto.reject = function() { - if (this._promise) { - this._promise.reject(); - } -}; - -/** - * @FIXME add description - */ -proto.resolve = function() { - if (this._promise) { - this._promise.resolve(); - } -}; - -/** - * Start workflow - * - * @param options.inputs - * @param options.context - * @param options.flow - * @param options.steps - * - * @fires start - */ -proto.start = function(options = {}) { - const d = $.Deferred(); - - this._promise = d; - this._inputs = options.inputs; - this._context = options.context || {}; - - const isChild = this._context.isChild || false; - - // stop child when a workflow is running - if (!isChild && WorkflowsStack.getLength() && WorkflowsStack.getCurrent() !== this) { - WorkflowsStack.getCurrent().addChild(this) - } - - this._stackIndex = WorkflowsStack.push(this); - this._flow = options.flow || this._flow; - this._steps = options.steps || this._steps; - - const showUserMessage = this._isThereUserMessaggeSteps(); - - if (showUserMessage) { - GUI.showUserMessage({ - title: 'sdk.workflow.steps.title', - type: 'tool', - position: 'left', - size: 'small', - closable: false, - hooks: { - body: UserMessageSteps({ steps: this._userMessageSteps }) - } - }); - } - - this._flow - .start(this) - .then(outputs => { - if (showUserMessage) { - setTimeout(() => { this.clearUserMessagesSteps(); d.resolve(outputs); }, 500); - } else { - d.resolve(outputs); - } - }) - .fail(error => { - if (showUserMessage) { - this.clearUserMessagesSteps(); - } - d.reject(error); - }) - .always(() => { - if (this.runOnce) { - this.stop(); - } - }); - - this.emit('start'); - - return d.promise(); -}; - -/** - * Stop workflow during flow - * - * @fires stop - */ -proto.stop = function() { - const d = $.Deferred(); - - this._promise = null; - - - this - ._stopChild() // stop child workflow - .always(() => { // ensure that child is always removed - this.removeChild(); - WorkflowsStack.removeAt(this.getStackIndex()); - this._flow - .stop() - .then(d.resolve) - .fail(d.reject) - .always(() => this.clearMessages()) - }); - - this.emit('stop'); - - return d.promise(); -}; - -/** - * @FIXME add description - */ -proto.clearUserMessagesSteps = function() { - this._resetUserMessaggeStepsDone(); - GUI.closeUserMessage(); -}; - -/** - * @private - */ -proto._resetUserMessaggeStepsDone = function() { - Object.keys(this._userMessageSteps).forEach(type => { - const userMessageSteps = this._userMessageSteps[type]; - userMessageSteps.done = false; - if (userMessageSteps.buttonnext) userMessageSteps.buttonnext.disabled = true; - }) -}; - -/** - * @since 3.9.0 - */ -proto.setBackButtonLabel = function(label=null) { - this.backbuttonlabel = label; -} - -/** - * @returns { null } - * - * @since 3.9.0 - */ -proto.getBackButtonLabel = function() { - return this.backbuttonlabel; -} - -module.exports = Workflow; \ No newline at end of file diff --git a/src/components/UserMessageSteps.js b/src/components/UserMessageSteps.js deleted file mode 100644 index a3ff5b9ba..000000000 --- a/src/components/UserMessageSteps.js +++ /dev/null @@ -1,107 +0,0 @@ -/** - * @file - * @since v3.8 - */ - -import ApplicationState from 'store/application-state'; -import GUI from 'services/gui'; - -export default function({ steps={} } = {}) { - return { - data() { - return { - steps, - currentStep: 0 - } - }, - watch: { - steps: { - handler(steps) { - Object.values(steps).find((step, index)=>{ - if (!step.done) { - this.currentStep = index; - return true; - } - }) - }, - deep: false - } - }, - render(h) { - return h('ul', { - style: { - alignSelf: 'flex-start', - listStyle: 'none', - padding: `${ApplicationState.ismobile ? 5 : 10}px !important`, - marginBottom: 0 - } - }, Object.values(this.steps).map((step, index) => { - const state = { - current: !step.done && index === this.currentStep, - done: step.done, - todo: !step.done && index !== this.currentStep - }; - return h('li', - { - style: { - fontWeight: (step.done || !step.done && index === this.currentStep) && 'bold' || null, - marginBottom: '5px', - color: step.done && "green", - display: step.buttonnext && 'inline-flex' - } - }, - [ - h('i', { - style: { - marginRight: '5px', - fontWeight: step.done && 'bold' - }, - class: { - [GUI.getFontClass('arrow-right')]: state.current, - [GUI.getFontClass('empty-circle')]: state.todo, - [GUI.getFontClass('success')]: state.done, - } - }), - h('span', { - directives:[ - { - name: step.directive, - value: step.description - } - ], - style: { - display: step.buttonnext ? 'inline-flex': 'inline', - flexDirection: step.buttonnext && 'row-reverse' - } - }), - step.dynamic !== undefined && h('span', { - style: { - alignSelf: 'center', - padding: '3px', - } - }, step.dynamic), - step.buttonnext && h('button', { - on: { - click(){ - step.done = true; - step.buttonnext.done(); - } - }, - directives: [{ - name: 't', - value: 'sdk.workflow.next' - }], - style: { - fontWeight: 'bold' - }, - class: { - btn: true, - 'btn-success': true, - 'g3w-disabled': step.buttonnext.disabled - } - }) - ]) - })) - } - }; -}; diff --git a/src/components/index.js b/src/components/index.js index 70443ba80..5c3e74ec6 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -111,7 +111,6 @@ import Tool from './Tool.vue'; import Tools from './Tools.vue'; import UserMessage from './UserMessage.vue'; import ViewportContentsViewer from './ViewportContentsViewer.vue'; -import UserMessageSteps from './UserMessageSteps.js'; import WMS from './WMS.vue'; import WMSLayersPanel from './WMSLayersPanel.vue'; @@ -232,7 +231,6 @@ export { Tools, UserMessage, ViewportContentsViewer, - UserMessageSteps, WMS, WMSLayersPanel, }; diff --git a/src/locales/de.js b/src/locales/de.js index 8c087d07e..8d149d177 100644 --- a/src/locales/de.js +++ b/src/locales/de.js @@ -337,12 +337,6 @@ export default { list_of_relations_feature: 'Liste der Relationen des Features', error_missing_father_field: "Ein Feld fehlt" }, - workflow: { - steps: { - title: 'Schritte', - }, - next: 'Weiter' - }, form: { loading: 'Laden ...', inputs: { diff --git a/src/locales/en.js b/src/locales/en.js index 6b24084ea..6a59f414d 100644 --- a/src/locales/en.js +++ b/src/locales/en.js @@ -337,12 +337,6 @@ export default { list_of_relations_feature: 'List of relations of feature', error_missing_father_field: "Field is missing" }, - workflow: { - steps: { - title: 'Steps', - }, - next: 'Next' - }, form: { loading: 'Loading ...', inputs: { diff --git a/src/locales/fi.js b/src/locales/fi.js index a833b4229..bf76ab967 100644 --- a/src/locales/fi.js +++ b/src/locales/fi.js @@ -337,12 +337,6 @@ export default { list_of_relations_feature: 'Lista ominaisuuden relaatioista', error_missing_father_field: "Kenttä puuttu" }, - workflow: { - steps: { - title: 'Vaiheet' - }, - next: "Seuraava", - }, form: { loading: 'Ladataan...', inputs: { diff --git a/src/locales/fr.js b/src/locales/fr.js index 3c6be4287..90dd68b04 100644 --- a/src/locales/fr.js +++ b/src/locales/fr.js @@ -337,12 +337,6 @@ export default { list_of_relations_feature: 'Liste des relations entre les caractéristiques', error_missing_father_field: "Le champ concerné n'existe pas" }, - workflow: { - steps: { - title: 'Étapes', - }, - next: 'Suivant' - }, form: { loading: 'Chargement...', inputs: { diff --git a/src/locales/it.js b/src/locales/it.js index 5236a03a3..314d99bbc 100644 --- a/src/locales/it.js +++ b/src/locales/it.js @@ -339,12 +339,6 @@ export default { list_of_relations_feature: 'Lista delle relazioni della feature', error_missing_father_field: "Il campo relazionato non esiste" }, - workflow: { - steps: { - title: 'Passi', - }, - next: 'Avanti' - }, form: { loading: 'Caricamento ...', inputs: { diff --git a/src/locales/ro.js b/src/locales/ro.js index cd9d21975..ec64a09dd 100644 --- a/src/locales/ro.js +++ b/src/locales/ro.js @@ -337,12 +337,6 @@ export default { list_of_relations_feature: 'Lista de relații a entității', error_missing_father_field: "Câmpul de legătură lipsește" }, - workflow: { - steps: { - title: 'Pași', - }, - next: 'Următorul' - }, form: { loading: 'Se încarcă ...', inputs: { diff --git a/src/locales/se.js b/src/locales/se.js index 684d720d5..948ef851b 100644 --- a/src/locales/se.js +++ b/src/locales/se.js @@ -337,13 +337,6 @@ export default { list_of_relations_feature: 'Lista på egenskapens relationer', error_missing_father_field: "Fält saknas" }, - workflow: { - steps: { - title: 'Skeden' - }, - next: "Nästa", - - }, form: { loading: 'Laddning...', inputs: { diff --git a/src/services/application.js b/src/services/application.js index e57560f36..cecea2d03 100644 --- a/src/services/application.js +++ b/src/services/application.js @@ -369,7 +369,7 @@ const ApplicationService = function() { /** * Create application config object * @param initConfig - * @returns {Promise} + * @returns {Promise} */ this.createApplicationConfig = async function(initConfig) { const config = { ...appConfig }; diff --git a/src/services/index.js b/src/services/index.js index 2a26f1363..0844d4f84 100644 --- a/src/services/index.js +++ b/src/services/index.js @@ -17,7 +17,6 @@ import QueryBuilderService from './querybuilder'; import RelationsService from './relations'; import RouterService from './router'; import TaskService from './tasks'; -import WorkFlowsStack from './workflows'; /** * @FIXME importing directly from this file breaks application @@ -43,5 +42,4 @@ export { RelationsService, RouterService, TaskService, - WorkFlowsStack, }; \ No newline at end of file diff --git a/src/services/workflows.js b/src/services/workflows.js deleted file mode 100644 index 472321a63..000000000 --- a/src/services/workflows.js +++ /dev/null @@ -1,79 +0,0 @@ -/** - * @file - * @since v3.6 - */ - -// Store all workflow activated -const WorkFlowsStack = function() { - this._workflows = []; - this.push = function(workflow) { - if (this._workflows.indexOf(workflow) === -1) return this._workflows.push(workflow) - 1; - return this._workflows.indexOf(workflow); - }; - - /** - * Get parent - * @returns {boolean|*} - */ - this.getParent = function() { - const index = this._getCurrentIndex(); - return index > 0 && this._workflows[index -1]; - }; - - /** - * Get all list of parents - * @returns {boolean|T[]} - */ - this.getParents = function(){ - const index = this._getCurrentIndex(); - return index > 0 && this._workflows.slice(0, index); - }; - - this.pop = function() { - return this._workflows.pop() - }; - - this.getLength = function() { - return this._workflows.length; - }; - - this._getCurrentIndex = function() { - const currentWorkflow = this.getCurrent(); - return this._workflows.findIndex(workfow => workfow === currentWorkflow) - }; - - this.getCurrent = function() { - return this.getLast(); - }; - - this.getLast = function() { - const length = this._workflows.length; - return length ? this._workflows[length -1] : null; - }; - - this.getFirst = function() { - return this._workflows[0]; - }; - - this.removeAt = function(index) { - this._workflows.splice(index, 1); - }; - - this.getAt = function(index) { - return this._workflows[index]; - }; - - this.insertAt = function(index, workflow) { - this._workflows[index] = workflow; - }; - - this.clear = function(){ - while (this._workflows.length) { - const workflow = this.pop(); - workflow.stop(); - } - } - -}; - -export default new WorkFlowsStack(); \ No newline at end of file