Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 331b06d

Browse filesBrowse files
Workflow: explain how to style a workflow dump
1 parent c19d405 commit 331b06d
Copy full SHA for 331b06d

File tree

2 files changed

+225
-0
lines changed
Filter options

2 files changed

+225
-0
lines changed
Loading

‎workflow/dumping-workflows.rst

Copy file name to clipboardExpand all lines: workflow/dumping-workflows.rst
+225Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,230 @@ files and ``PlantUmlDumper`` to create the PlantUML files::
5454
$ php dump-graph.php | dot -Tsvg -o graph.svg
5555
$ php dump-graph.php | java -jar plantuml.jar -p > graph.png
5656
57+
Styling
58+
-------
59+
60+
You can use `metadata` with the following keys to style the workflow:
61+
62+
* for places:
63+
* `bg_color`: a color
64+
* `description`: a string that describe the state
65+
* for transitions:
66+
* `label`: a string that replace the name of the transition
67+
* `color`: a color
68+
* `arrow_color`: a color
69+
70+
Colors can be:
71+
72+
* a color name from `PlantUML's color list`_
73+
* HEX value `#AABBCC`
74+
* short HEX value `#ABC`
75+
76+
You can use `\n` to insert a line return.
77+
78+
Below is the configuration for the pull request state machine with styling added.
79+
80+
.. configuration-block::
81+
82+
.. code-block:: yaml
83+
84+
# config/packages/workflow.yaml
85+
framework:
86+
workflows:
87+
pull_request:
88+
type: 'state_machine'
89+
supports:
90+
- App\Entity\PullRequest
91+
initial_place: start
92+
places:
93+
start: ~
94+
coding: ~
95+
test: ~
96+
review:
97+
metadata:
98+
description: Human review
99+
merged: ~
100+
closed:
101+
metadata:
102+
bg_color: DeepSkyBlue
103+
transitions:
104+
submit:
105+
from: start
106+
to: test
107+
update:
108+
from: [coding, test, review]
109+
to: test
110+
metadata:
111+
arrow_color: Turquoise
112+
wait_for_review:
113+
from: test
114+
to: review
115+
metadata:
116+
color: Orange
117+
request_change:
118+
from: review
119+
to: coding
120+
accept:
121+
from: review
122+
to: merged
123+
metadata:
124+
label: Accept PR
125+
reject:
126+
from: review
127+
to: closed
128+
reopen:
129+
from: closed
130+
to: review
131+
132+
.. code-block:: xml
133+
134+
<!-- config/packages/workflow.xml -->
135+
<?xml version="1.0" encoding="UTF-8" ?>
136+
<container xmlns="http://symfony.com/schema/dic/services"
137+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
138+
xmlns:framework="http://symfony.com/schema/dic/symfony"
139+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
140+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
141+
>
142+
143+
<framework:config>
144+
<framework:workflow name="pull_request" type="state_machine">
145+
<framework:marking-store type="single_state"/>
146+
147+
<framework:support>App\Entity\PullRequest</framework:support>
148+
149+
<framework:place>start</framework:place>
150+
<framework:place>coding</framework:place>
151+
<framework:place>test</framework:place>
152+
<framework:place name="review">
153+
<framework:metadata>
154+
<framework:description>Human review</framework:description>
155+
</framework:metadata>
156+
</framework:place>
157+
<framework:place>merged</framework:place>
158+
<framework:place name="closed">
159+
<framework:metadata>
160+
<framework:bg_color>DeepSkyBlue</framework:bg_color>
161+
</framework:metadata>
162+
</framework:place>
163+
</framework:place>
164+
165+
<framework:transition name="submit">
166+
<framework:from>start</framework:from>
167+
168+
<framework:to>test</framework:to>
169+
</framework:transition>
170+
171+
<framework:transition name="update">
172+
<framework:from>coding</framework:from>
173+
<framework:from>test</framework:from>
174+
<framework:from>review</framework:from>
175+
176+
<framework:to>test</framework:to>
177+
178+
<framework:metadata>
179+
<framework:arrow_color>Turquoise</framework:arrow_color>
180+
</framework:metadata>
181+
</framework:transition>
182+
183+
<framework:transition name="wait_for_review">
184+
<framework:from>test</framework:from>
185+
186+
<framework:to>review</framework:to>
187+
188+
<framework:metadata>
189+
<framework:color>Orange</framework:color>
190+
</framework:metadata>
191+
</framework:transition>
192+
193+
<framework:transition name="request_change">
194+
<framework:from>review</framework:from>
195+
196+
<framework:to>coding</framework:to>
197+
</framework:transition>
198+
199+
<framework:transition name="accept">
200+
<framework:from>review</framework:from>
201+
202+
<framework:to>merged</framework:to>
203+
204+
<framework:metadata>
205+
<framework:label>Accept PR</framework:label>
206+
</framework:metadata>
207+
</framework:transition>
208+
209+
<framework:transition name="reject">
210+
<framework:from>review</framework:from>
211+
212+
<framework:to>closed</framework:to>
213+
</framework:transition>
214+
215+
<framework:transition name="reopen">
216+
<framework:from>closed</framework:from>
217+
218+
<framework:to>review</framework:to>
219+
</framework:transition>
220+
221+
</framework:workflow>
222+
223+
</framework:config>
224+
</container>
225+
226+
.. code-block:: php
227+
228+
// config/packages/workflow.php
229+
$container->loadFromExtension('framework', [
230+
// ...
231+
'workflows' => [
232+
'pull_request' => [
233+
'type' => 'state_machine',
234+
'supports' => ['App\Entity\PullRequest'],
235+
'places' => [
236+
'start',
237+
'coding',
238+
'test',
239+
'review',
240+
'merged',
241+
'closed',
242+
],
243+
'transitions' => [
244+
'submit'=> [
245+
'from' => 'start',
246+
'to' => 'test',
247+
],
248+
'update'=> [
249+
'from' => ['coding', 'test', 'review'],
250+
'to' => 'test',
251+
],
252+
'wait_for_review'=> [
253+
'from' => 'test',
254+
'to' => 'review',
255+
],
256+
'request_change'=> [
257+
'from' => 'review',
258+
'to' => 'coding',
259+
],
260+
'accept'=> [
261+
'from' => 'review',
262+
'to' => 'merged',
263+
],
264+
'reject'=> [
265+
'from' => 'review',
266+
'to' => 'closed',
267+
],
268+
'reopen'=> [
269+
'from' => 'start',
270+
'to' => 'review',
271+
],
272+
],
273+
],
274+
],
275+
]);
276+
277+
The PlantUML image will look like this:
278+
279+
.. image:: /_images/components/workflow/pull_request_puml_styled.png
280+
57281
.. _`Graphviz`: http://www.graphviz.org
58282
.. _`PlantUML`: http://plantuml.com/
283+
.. _`PlantUML's color list`: http://plantuml.com/en/color

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.