resolve conflict: improve ui

This commit is contained in:
Yuri Kuznetsov
2025-02-11 11:39:41 +02:00
parent 1e1ee6ba8c
commit fbfa219615
2 changed files with 53 additions and 36 deletions
@@ -1,34 +0,0 @@
<div class="margin-bottom-3x">
<p>{{translate 'resolveSaveConflict' category='messages'}}</p>
</div>
<table class="table" style="table-layout: fixed;">
<thead>
<tr>
<th style="width: 25%">{{translate 'Field'}}</th>
<th style="width: 25%">{{translate 'Resolution'}}</th>
<th>{{translate 'Value'}}</th>
</tr>
</thead>
<tbody>
{{#each dataList}}
<tr>
<td class="cell cell-nowrap">
<span>
{{translate field category='fields' scope=../entityType}}
</span>
</td>
<td class="cell">
<select class="form-control" data-name="resolution" data-field="{{field}}">
{{options ../resolutionList resolution field='saveConflictResolution'}}
</select>
</td>
<td class="cell">
<div data-name="field" data-field="{{field}}">
{{{var viewKey ../this}}}
</div>
</td>
</tr>
{{/each}}
</tbody>
</table>
@@ -27,10 +27,49 @@
************************************************************************/
import ModalView from 'views/modal';
import Select from 'ui/select';
class ResolveSaveConflictModalView extends ModalView {
template = 'modals/resolve-save-conflict'
// language=Handlebars
templateContent = `
<div class="margin-bottom-3x">
<p>{{translate 'resolveSaveConflict' category='messages'}}</p>
</div>
<div class="panel panel-default no-side-margin">
<table class="table" style="table-layout: fixed;">
<thead>
<tr>
<th style="width: 25%">{{translate 'Field'}}</th>
<th style="width: 25%">{{translate 'Resolution'}}</th>
<th>{{translate 'Value'}}</th>
</tr>
</thead>
<tbody>
{{#each dataList}}
<tr>
<td class="cell cell-nowrap">
<span>
{{translate field category='fields' scope=../entityType}}
</span>
</td>
<td class="cell">
<select class="form-control" data-name="resolution" data-field="{{field}}">
{{options ../resolutionList resolution field='saveConflictResolution'}}
</select>
</td>
<td class="cell">
<div data-name="field" data-field="{{field}}">
{{{var viewKey ../this}}}
</div>
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
`
backdrop = true
@@ -42,6 +81,12 @@ class ResolveSaveConflictModalView extends ModalView {
defaultResolution = 'current'
/**
* @private
* @type {string[]}
*/
fieldList
data() {
const dataList = [];
@@ -153,7 +198,7 @@ class ResolveSaveConflictModalView extends ModalView {
readOnly: true,
model: this.model,
name: field,
selector: '[data-name="field"][data-field="' + field + '"]',
selector: `[data-name="field"][data-field="${field}"]`,
mode: 'list',
});
}
@@ -167,6 +212,12 @@ class ResolveSaveConflictModalView extends ModalView {
this.setResolution(field, resolution);
});
this.fieldList.forEach(field => {
const selectElement = this.element.querySelector(`select[data-field="${field}"]`);
Select.init(selectElement);
});
}
// noinspection JSUnusedGlobalSymbols