Skip to content

Commit

Permalink
Handle vector layer relations (#110)
Browse files Browse the repository at this point in the history
* Clean code

* Clean code

* 🐛 Fix tool relation editing

* clean code

* Can pass custom selected stylefor handle relation vector features

* Handle movevertex and movefeature relation tool

* Fix show vertex for multipolygon feature

* Enable disable tools and save

* Add index relationTools to avoid to has same id of tool between more than one feature relation

* clean code

* clean code

* Fix add relation and relation tools of new relation feature.
Remove startVectorTool and startTableTool and unify it inside startTool method

* Need to check only if the previous form is valid

* Fix enable/disable relation tools element

* scoped css

* code format

* Delete FormRelations.vue

* `<divider />` → `<span class="divider"></span>`

* comments

* Delete unused isRequired method

* remove unusued stuff

* Reomve unused showallfieldsindex property and methods related to it

* remove unusued

* code spacing

* code format

* Fix resize relations table

* refactor `OpenFormStep`

* move `SaveAll.vue` into `OpenFormStep`

* promisify `startTool`

* debug: `Uncaught (in promise)`

* move function: `updateExternalKeyValueRelations` into `FormRelation.vue`

* promisify add/link relation + remove unusued

* wrong variable name

* Fix double disabled class

* 🐛 _new_relations_ids set as not reactive. Issue on delete relation

* clen code- remove empty spaces

* convert to ES6 class: `RelationService`

* remove private variable: `_editingService`

* `save-all-icon`

* array `some` → `includes`

* refactor `getLayersDependencyFeatures`

* 🐛 Fix delete relation feature and add new feature

* Clean code - spaces

* Remove old deprecated h-resize

* Fix relation getType

* await promise

* Exclude foreignKey attribute. Fix show relations table of unlinked relation features not binding to parent feature

* Fix link vector relations

* simplify ternary condition

* @todo

* promisify inner loop: `getLayersDependencyFeatures `

* Fix delete new insert feature relation, set the state of saveAll button

* failsafe check

* Substitute reduce with find to best performance.
Fix issue on instanceof. Wrong right side

* Clen code - Move same condition code to unique point

* Clen code - readibility

* Fix save all relation on  table

* convert to ES6 class: `TableService`

* convert to ES6 class: `EditingService`

* Get layer on editing. Get layer of session is wrong because it can be a parent layer

* In case of parent feature new and pk field as relation field, get feature id

* Fix save relation from parent new feature

---------

Co-authored-by: Raruto <[email protected]>
  • Loading branch information
volterra79 and Raruto authored May 3, 2024
1 parent b91ef76 commit 0356053
Show file tree
Hide file tree
Showing 13 changed files with 4,471 additions and 4,783 deletions.
711 changes: 394 additions & 317 deletions components/FormRelation.vue

Large diffs are not rendered by default.

28 changes: 0 additions & 28 deletions components/FormRelations.vue

This file was deleted.

125 changes: 0 additions & 125 deletions components/SaveAll.vue

This file was deleted.

8 changes: 1 addition & 7 deletions components/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

<div class="editing_table_header_content">
<h3 class="editing_table_title">{{ state.title }}</h3>
<h-resize @h_size_change="changeSize" />
</div>

<div
Expand Down Expand Up @@ -169,17 +168,12 @@

methods: {

async changeSize() {
await this.$nextTick();
setTimeout(() => this.resize());
},

showTool(type) {
return undefined !== this.state.capabilities.find(capability => capability === type);
},

async resize() {
// skip when element is hidden
// skip when an element is hidden
if (this.$el.style.display === 'none') {
return;
}
Expand Down
5 changes: 2 additions & 3 deletions g3wsdk/workflow/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class EditingTask extends Task {

super(options);

this._editingService;
this.selectStyle = options.selectStyle; /* @since 3.8.0 */

this._mapService = GUI.getService('map');

Expand Down Expand Up @@ -225,8 +225,7 @@ export class EditingTask extends Task {
* @returns {*|EditingService|{}}
*/
getEditingService() {
this._editingService = this._editingService || require('../../services/editingservice');
return this._editingService;
return require('../../services/editingservice');
}

/**
Expand Down
22 changes: 7 additions & 15 deletions g3wsdk/workflow/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,26 +389,18 @@ proto.start = function(options = {}) {
this._flow
.start(this)
.then(outputs => {
if (showUserMessage) {
setTimeout(() => { this.clearUserMessagesSteps(); d.resolve(outputs); }, 500);
} else {
d.resolve(outputs);
}
if (showUserMessage) { setTimeout(() => { this.clearUserMessagesSteps(); d.resolve(outputs); }, 500); }
else { d.resolve(outputs); }
})
.fail(error => {
if (showUserMessage) {
this.clearUserMessagesSteps();
}
d.reject(error);
.fail(e => {
if (showUserMessage) { this.clearUserMessagesSteps(); }
d.reject(e);
})
.always(() => {
if (this.runOnce) {
this.stop();
}
if (this.runOnce) { this.stop(); }
});

this.emit('start');

return d.promise();
};

Expand Down Expand Up @@ -613,7 +605,7 @@ export class EditingWorkflow extends Workflow {
* @FIXME add description
*/
getLayer() {
return this.getSession().getEditor().getLayer();
return this.getInputs().layer;
}

/**
Expand Down
Loading

0 comments on commit 0356053

Please sign in to comment.