Skip to content

Commit 3b8b63c

Browse files
-
1 parent d9947eb commit 3b8b63c

File tree

2 files changed

+76
-123
lines changed

2 files changed

+76
-123
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#modal{{ modalReference }}">
2+
{{ title }}
3+
</button>
4+
5+
<div class="modal fade" id="modal{{ modalReference }}" tabindex="-1" role="dialog" aria-labelledby="modalLabel{{ modalReference }}" aria-hidden="true">
6+
<div class="modal-dialog" role="document">
7+
<div class="modal-content">
8+
<form action="{{ form_action }}">
9+
<div class="modal-header">
10+
<h5 class="modal-title" id="modalLabel{{ modalReference }}">{{ title }}</h5>
11+
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'cancel'|trans }}">
12+
<span aria-hidden="true">&times;</span>
13+
</button>
14+
</div>
15+
<div class="modal-body text-left">
16+
<p>
17+
<strong>{{ 'index'|trans }}</strong><br>
18+
{{ row.index }}
19+
</p>
20+
<p>
21+
<strong>{{ 'shard'|trans }}</strong><br>
22+
{{ row.number }}
23+
</p>
24+
25+
{% block content %}
26+
{% endblock %}
27+
</div>
28+
<div class="modal-footer">
29+
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ 'cancel'|trans }}</button>
30+
<button type="submit" class="btn btn-primary">{{ 'confirm'|trans }}</button>
31+
</div>
32+
</form>
33+
</div>
34+
</div>
35+
</div>

templates/Modules/shard/shard_list.html.twig

Lines changed: 41 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -151,141 +151,59 @@
151151
<td>
152152
{% if is_granted_shards_reroute and 'relocating' != row.state %}
153153
{% if nodesAvailable[row.index][row.number] is defined and 0 < nodesAvailable[row.index][row.number]|length and row.node %}
154-
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#modal{{ modalReference }}">
155-
{{ 'reroute_commands.move'|trans }}
156-
</button>
157-
<div class="modal fade" id="modal{{ modalReference }}" tabindex="-1" role="dialog" aria-labelledby="modalLabel{{ modalReference }}" aria-hidden="true">
158-
<div class="modal-dialog" role="document">
159-
<div class="modal-content">
160-
<form action="{{ path('shards_move', {'index': row.index, 'number': row.number}) }}">
161-
<div class="modal-header">
162-
<h5 class="modal-title" id="modalLabel{{ modalReference }}">{{ 'reroute_commands.move'|trans }}</h5>
163-
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'cancel'|trans }}">
164-
<span aria-hidden="true">&times;</span>
165-
</button>
166-
</div>
167-
<div class="modal-body text-left">
168-
<p>
169-
<strong>{{ 'index'|trans }}</strong><br>
170-
{{ row.index }}
171-
</p>
172-
<p>
173-
<strong>{{ 'shard'|trans }}</strong><br>
174-
{{ row.number }}
175-
</p>
176-
<p>
177-
<strong>{{ 'from_node'|trans }}</strong><br>
178-
{{ row.node }}
179-
</p>
154+
{% embed 'Embed/shard_reroute_cluster.html.twig' with {'title': 'reroute_commands.move'|trans, 'form_action': path('shards_move', {'index': row.index, 'number': row.number})} %}
155+
{% block content %}
156+
<p>
157+
<strong>{{ 'from_node'|trans }}</strong><br>
158+
{{ row.node }}
159+
</p>
180160

181-
<input type="hidden" name="redirect" value="{{ redirect_url }}">
182-
<input type="hidden" name="from_node" value="{{ row.node }}">
183-
<div class="form-group mb-3">
184-
<label for="move-to-{{ row.node }}" class="form-label"><strong>{{ 'to_node'|trans }}</strong></label>
185-
<select id="move-to-{{ row.node }}" class="form-control" name="to_node" required="required">
186-
<option value="">-</option>
187-
{% for nodeAvailable in nodesAvailable[row.index][row.number] %}
188-
<option value="{{ nodeAvailable }}">{{ nodeAvailable }}</option>
189-
{% endfor %}
190-
</select>
191-
</div>
192-
</div>
193-
<div class="modal-footer">
194-
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ 'cancel'|trans }}</button>
195-
<button type="submit" class="btn btn-primary">{{ 'confirm'|trans }}</button>
196-
</div>
197-
</form>
161+
<input type="hidden" name="redirect" value="{{ redirect_url }}">
162+
<input type="hidden" name="from_node" value="{{ row.node }}">
163+
<div class="form-group mb-3">
164+
<label for="move-to-{{ row.node }}" class="form-label"><strong>{{ 'to_node'|trans }}</strong></label>
165+
<select id="move-to-{{ row.node }}" class="form-control" name="to_node" required="required">
166+
<option value="">-</option>
167+
{% for nodeAvailable in nodesAvailable[row.index][row.number] %}
168+
<option value="{{ nodeAvailable }}">{{ nodeAvailable }}</option>
169+
{% endfor %}
170+
</select>
198171
</div>
199-
</div>
200-
</div>
172+
{% endblock %}
173+
{% endembed %}
201174
{% set modalReference = modalReference + 1 %}
202175
{% endif %}
203176

204177
{% if row.node %}
205-
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#modal{{ modalReference }}">
206-
{{ 'reroute_commands.cancel'|trans }}
207-
</button>
208-
<div class="modal fade" id="modal{{ modalReference }}" tabindex="-1" role="dialog" aria-labelledby="modalLabel{{ modalReference }}" aria-hidden="true">
209-
<div class="modal-dialog" role="document">
210-
<div class="modal-content">
211-
<form action="{{ path('shards_cancel_allocation', {'index': row.index, 'number': row.number}) }}">
212-
<div class="modal-header">
213-
<h5 class="modal-title" id="modalLabel{{ modalReference }}">{{ 'reroute_commands.cancel'|trans }}</h5>
214-
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'cancel'|trans }}">
215-
<span aria-hidden="true">&times;</span>
216-
</button>
217-
</div>
218-
<div class="modal-body text-left">
219-
<p>
220-
<strong>{{ 'index'|trans }}</strong><br>
221-
{{ row.index }}
222-
</p>
223-
<p>
224-
<strong>{{ 'shard'|trans }}</strong><br>
225-
{{ row.number }}
226-
</p>
227-
<p>
228-
<strong>{{ 'node'|trans }}</strong><br>
229-
{{ row.node }}
230-
</p>
178+
{% embed 'Embed/shard_reroute_cluster.html.twig' with {'title': 'reroute_commands.cancel'|trans, 'form_action': path('shards_cancel_allocation', {'index': row.index, 'number': row.number})} %}
179+
{% block content %}
180+
<p>
181+
<strong>{{ 'node'|trans }}</strong><br>
182+
{{ row.node }}
183+
</p>
231184

232-
<input type="hidden" name="redirect" value="{{ redirect_url }}">
233-
<input type="hidden" name="node" value="{{ row.node }}">
234-
</div>
235-
<div class="modal-footer">
236-
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ 'cancel'|trans }}</button>
237-
<button type="submit" class="btn btn-primary">{{ 'confirm'|trans }}</button>
238-
</div>
239-
</form>
240-
</div>
241-
</div>
242-
</div>
185+
<input type="hidden" name="redirect" value="{{ redirect_url }}">
186+
<input type="hidden" name="node" value="{{ row.node }}">
187+
{% endblock %}
188+
{% endembed %}
243189
{% set modalReference = modalReference + 1 %}
244190
{% endif %}
245191

246192
{% if nodesAvailable[row.index][row.number] is defined and 0 < nodesAvailable[row.index][row.number]|length and 'unassigned' == row.state %}
247-
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#modal{{ modalReference }}">
248-
{{ 'reroute_commands.allocate_replica'|trans }}
249-
</button>
250-
<div class="modal fade" id="modal{{ modalReference }}" tabindex="-1" role="dialog" aria-labelledby="modalLabel{{ modalReference }}" aria-hidden="true">
251-
<div class="modal-dialog" role="document">
252-
<div class="modal-content">
253-
<form action="{{ path('shards_allocate_replica', {'index': row.index, 'number': row.number}) }}">
254-
<div class="modal-header">
255-
<h5 class="modal-title" id="modalLabel{{ modalReference }}">{{ 'reroute_commands.allocate_replica'|trans }}</h5>
256-
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'cancel'|trans }}">
257-
<span aria-hidden="true">&times;</span>
258-
</button>
259-
</div>
260-
<div class="modal-body text-left">
261-
<p>
262-
<strong>{{ 'index'|trans }}</strong><br>
263-
{{ row.index }}
264-
</p>
265-
<p>
266-
<strong>{{ 'shard'|trans }}</strong><br>
267-
{{ row.number }}
268-
</p>
269-
270-
<input type="hidden" name="redirect" value="{{ redirect_url }}">
271-
<div class="form-group mb-3">
272-
<label for="allocate-to-{{ row.node }}" class="form-label"><strong>{{ 'node'|trans }}</strong></label>
273-
<select id="allocate-to-{{ row.node }}" class="form-control" name="node" required="required">
274-
<option value="">-</option>
275-
{% for nodeAvailable in nodesAvailable[row.index][row.number] %}
276-
<option value="{{ nodeAvailable }}">{{ nodeAvailable }}</option>
277-
{% endfor %}
278-
</select>
279-
</div>
280-
</div>
281-
<div class="modal-footer">
282-
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ 'cancel'|trans }}</button>
283-
<button type="submit" class="btn btn-primary">{{ 'confirm'|trans }}</button>
284-
</div>
285-
</form>
193+
{% embed 'Embed/shard_reroute_cluster.html.twig' with {'title': 'reroute_commands.allocate_replica'|trans, 'form_action': path('shards_allocate_replica', {'index': row.index, 'number': row.number})} %}
194+
{% block content %}
195+
<input type="hidden" name="redirect" value="{{ redirect_url }}">
196+
<div class="form-group mb-3">
197+
<label for="allocate-to-{{ row.node }}" class="form-label"><strong>{{ 'node'|trans }}</strong></label>
198+
<select id="allocate-to-{{ row.node }}" class="form-control" name="node" required="required">
199+
<option value="">-</option>
200+
{% for nodeAvailable in nodesAvailable[row.index][row.number] %}
201+
<option value="{{ nodeAvailable }}">{{ nodeAvailable }}</option>
202+
{% endfor %}
203+
</select>
286204
</div>
287-
</div>
288-
</div>
205+
{% endblock %}
206+
{% endembed %}
289207
{% set modalReference = modalReference + 1 %}
290208
{% endif %}
291209
{% endif %}

0 commit comments

Comments
 (0)