Skip to content

Commit 04b93a7

Browse files
authored
Feature/help common cli (#107)
* restructuring and removing unused code * adding tab navigation component to help with reusability * adding icons * refactor to use component * adding alias for components * added more alias. trying to get mocha tests working again. * eslint * fixing help styling * added video embed * hiding faq section. * 3.12.0-beta.0 * adding slot to help to enable extention * 3.12.0-beta.1 * moving slot * 3.12.0-beta.2 * adding more slots for extra customization * 3.12.0-beta.3 * moving getting started slot. Making slack option able to be hidden * 3.12.0-beta.4 * adding option to hide stack overflow link * 3.12.0-beta.5 * adding cadence-web link * 3.12.0-beta.6 * removing hidden image for links on help screen * 3.12.0-beta.7 * making headers linkable which will navigate to that place in the page when copied. * 3.12.0-beta.8 * allow hiding docs link * 3.12.0-beta.9 * renaming intro to domain-search test. adding new tests for help page * fixing intgration tests * adding CLI section. placeholder content for now. * fixing link and adding tests for CLI * adding common cli commands * 3.12.0-beta.10 * adding see more cli commands link * 3.12.0-beta.11 * rename execution to workflow. making component folder for workflow. made domain folder and moved relevant screens. * making workflows url to be workflow to make it easier to recognize url and its structure. follows closer to REST syntax * updating API to follow REST syntax for workflows to use workflow * renaming queries to query to match REST syntax. * reformatting css * renaming event-details to event-detail * updating common cli with more commands * changing style and format * rename workflow to workflows. rename domain to domains. * fixing tests * fixing lint * 3.13.0-beta.0 * PR comments * 3.13.0-beta.1 * 3.13.0
1 parent 08ee2bc commit 04b93a7

File tree

9 files changed

+168
-51
lines changed

9 files changed

+168
-51
lines changed

client/main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import snapscroll from './directives/snapscroll';
1414

1515
import App from './App.vue';
1616
import Root from './routes/index.vue';
17-
import Help from './routes/help.vue';
17+
import Help from './routes/help/index.vue';
1818
import DomainList from './routes/domain-list.vue';
1919
import WorkflowList from './routes/domain/workflow-list.vue';
2020
import DomainConfig from './routes/domain/domain-config.vue';
@@ -38,22 +38,22 @@ const routeOpts = {
3838
name: 'domain-list',
3939
path: '/domains',
4040
components: {
41-
'domain-list': DomainList
41+
'domain-list': DomainList,
4242
},
4343
},
4444
{
4545
name: 'help',
4646
path: '/help',
4747
components: {
48-
help: Help
48+
help: Help,
4949
},
5050
},
5151
],
5252
},
5353
{
5454
name: 'domains-redirect',
5555
path: '/domain/*',
56-
redirect: '/domains/*'
56+
redirect: '/domains/*',
5757
},
5858
{
5959
name: 'workflow-list',

client/routes/help/constants.js

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
export const cliCommands = [
2+
{
3+
header: 'Domain commands',
4+
commands: [
5+
{
6+
id: 'cli-command-domain-register',
7+
label: 'Register a domain (local only)',
8+
value:
9+
'cadence --domain {domain-name} domain register --global_domain false',
10+
},
11+
{
12+
id: 'cli-command-domain-describe',
13+
label: 'List domain settings',
14+
value:
15+
'cadence --env {staging|prod|prod02} --domain {domain-name} domain describe',
16+
},
17+
{
18+
id: 'cli-command-domain-update-cluster',
19+
label:
20+
'Update domain active cluster (Make sure the domain_data has UberIgnoringLisa:true)',
21+
value:
22+
'cadence --env {staging|prod|prod02} --domain {domain-name} domain update -active_cluster {cluster-name}',
23+
},
24+
{
25+
id: 'cli-command-domain-update-bad-binary',
26+
label: 'Update domain bad binary',
27+
value:
28+
'cadence --env {staging|prod|prod02} --domain {domain-name} domain update --add_bad_binary {bad-binary-SHA} --reason \'"{reason}"\'',
29+
},
30+
],
31+
},
32+
{
33+
header: 'workflow commands',
34+
commands: [
35+
{
36+
id: 'cli-command-workflow-run',
37+
label: 'Run a workflow',
38+
value:
39+
'cadence --env {staging|prod|prod02} --domain {domain-name} workflow run --tl {task-list-name} --wt {workflow-type-name} --et 60 -i \'"{input-string}"\'',
40+
},
41+
{
42+
id: 'cli-command-workflow-describe',
43+
label: 'See workflow settings',
44+
value:
45+
'cadence --env {staging|prod|prod02} --domain {domain-name} workflow describe -w {workflow-id} -r {run-id}',
46+
},
47+
{
48+
id: 'cli-command-workflow-show',
49+
label: 'See workflow history',
50+
value:
51+
'cadence --env {staging|prod|prod02} --domain {domain-name} workflow show -w {workflow-id} -r {run-id}',
52+
},
53+
{
54+
id: 'cli-command-workflow-signal',
55+
label: 'Signal a workflow',
56+
value:
57+
'cadence --env {staging|prod|prod02} --domain {domain-name} workflow signal -w {workflow-id} -r {run-id} --name {signal-name} --input \'"{signal-payload}"\'',
58+
},
59+
60+
{
61+
description: [
62+
'Where event_id is the event to reset from',
63+
'and reset_type can be FirstDecisionTaskCompleted, LastDecisionTaskCompleted, LastContinueAsNew, BadBinary',
64+
],
65+
id: 'cli-command-workflow-reset',
66+
label: 'Reset a workflow',
67+
value:
68+
'cadence workflow reset -w {workflow-id} -r {run-id} --event_id {event-id} --reason \'"{reason}"\' --reset_type {reset-type} --reset_bad_binary_checksum {bad-binary-SHA}',
69+
},
70+
{
71+
description: [
72+
'Where query can be any query that returns a list of workflows',
73+
'and reset_type can be FirstDecisionTaskCompleted, LastDecisionTaskCompleted, LastContinueAsNew, BadBinary',
74+
],
75+
id: 'cli-command-workflow-reset-batch',
76+
label: 'Reset a batch of workflows',
77+
value:
78+
'cadence workflow reset-batch --query \'"{query}"\' --only_non_deterministic --reason \'"{reason}"\' --reset_type {reset-type}',
79+
},
80+
{
81+
id: 'cli-command-workflow-list',
82+
label: 'List closed workflows',
83+
value:
84+
'cadence --env {staging|prod|prod02} --domain {domain-name} workflow {list|listall}',
85+
},
86+
{
87+
id: 'cli-command-workflow-list-open',
88+
label: 'List open workflows',
89+
value:
90+
'cadence --env {staging|prod|prod02} --domain {domain-name} workflow {list|listall} --open',
91+
},
92+
{
93+
id: 'cli-command-workflow-query',
94+
label: 'Query for a workflow',
95+
value:
96+
'cadence workflow {list|listall} --query \'(CustomKeywordField = "keyword1" and CustomIntField >= 5) or CustomKeywordField = "keyword2" and CloseTime = missing\'',
97+
},
98+
],
99+
},
100+
];

client/routes/help.vue renamed to client/routes/help/index.vue

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -75,33 +75,31 @@
7575
Cadence UI source code on GitHub
7676
</a>
7777
</div>
78-
7978
</section>
8079
<section id="cli">
8180
<h3>
8281
<a href="#cli">
8382
Common CLI commands
8483
</a>
8584
</h3>
86-
<p>Here are a some useful common CLI commands to get started with Cadence.</p>
87-
88-
<label for="cli-command-domain-register">Register a domain (local only)</label>
89-
<pre id="cli-command-domain-register">cadence --domain {domain-name} domain register --global_domain false</pre>
90-
91-
<label for="cli-command-domain-describe">List domain settings</label>
92-
<pre id="cli-command-domain-describe">cadence --domain {domain-name} domain describe</pre>
93-
94-
<label for="cli-command-workflow-run">Run a workflow</label>
95-
<pre id="cli-command-workflow-run">cadence --domain {domain-name} workflow run --tl {task-list-name} --wt {workflow-type-name} --et 60 -i '"{input-string}"'</pre>
96-
97-
<label for="cli-command-workflow-show">See a workflow history</label>
98-
<pre id="cli-command-workflow-show">cadence --domain {domain-name} workflow show -w {workflow-id} -r {run-id}</pre>
99-
100-
<label for="cli-command-workflow-list">List closed workflows</label>
101-
<pre id="cli-command-workflow-list">cadence --domain {domain-name} workflow list</pre>
85+
<p>
86+
Here are a some useful common CLI commands to get started with Cadence.
87+
</p>
10288

103-
<label for="cli-command-workflow-list-open">List open workflows</label>
104-
<pre id="cli-command-workflow-list-open">cadence --domain {domain-name} workflow list --open</pre>
89+
<section v-for="commandGroup in cliCommands" :key="commandGroup.header">
90+
<h5>{{ commandGroup.header }}</h5>
91+
<div
92+
class="cli-command"
93+
v-for="command in commandGroup.commands"
94+
:key="command.id"
95+
>
96+
<label :for="command.id">{{ command.label }}</label>
97+
<pre :id="command.id">{{ command.value }}</pre>
98+
<p v-for="(description, index) in command.description" :key="index">
99+
{{ description }}
100+
</p>
101+
</div>
102+
</section>
105103

106104
<div>
107105
<a
@@ -180,16 +178,20 @@
180178
</template>
181179

182180
<script>
181+
import { cliCommands } from './constants';
182+
183183
export default {
184184
props: ['hideDocs', 'hideSlack', 'hideStackOverflow'],
185185
data() {
186-
return {};
186+
return {
187+
cliCommands,
188+
};
187189
},
188190
};
189191
</script>
190192

191193
<style lang="stylus">
192-
@require "../styles/definitions"
194+
@require "../../styles/definitions"
193195
194196
iframe-height = 315px;
195197
iframe-scrollbar-height = 15px;
@@ -209,6 +211,10 @@ section.help {
209211
margin: layout-spacing-large auto;
210212
}
211213
214+
.cli-command {
215+
margin-bottom: 25px;
216+
}
217+
212218
.video-outer-container {
213219
height: iframe-height + iframe-scrollbar-height;
214220
margin: 20px 0;
@@ -256,19 +262,22 @@ section.help {
256262
}
257263
}
258264
265+
h5 {
266+
margin: 1em 0 0.5em;
267+
}
268+
259269
label {
260270
display: block;
261-
margin: 20px 0 10px;
271+
font-weight: 500;
272+
margin: 1em 0 0.5em;
262273
}
263274
264275
p {
265-
margin: 1em 0 0.5em;
276+
margin: 0.5em 0 0.5em;
266277
}
267278
268279
pre {
269280
display: inline-block;
270-
margin-bottom: 5px;
271281
}
272282
}
273-
274283
</style>

client/routes/workflow/history.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ export default {
526526
'event-detail': EventDetail,
527527
prism: Prism,
528528
RecycleScroller,
529-
'timeline': Timeline,
529+
timeline: Timeline,
530530
},
531531
};
532532
</script>

client/test/domain-list.test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ describe('Domain search', () => {
1212

1313
it('should validate the existance of domains as the user types', async function test() {
1414
const [testEl, scenario] = new Scenario(this.test).go();
15-
const domainNav = await testEl.waitUntilExists('section.domain-search .domain-navigation');
15+
const domainNav = await testEl.waitUntilExists(
16+
'section.domain-search .domain-navigation'
17+
);
1618
const domainInput = domainNav.querySelector('input');
1719

1820
domainInput.value.should.be.empty;
@@ -105,7 +107,9 @@ describe('Domain search', () => {
105107

106108
it('should activate the change-domain button when the domain is valid and navigate to it', async function test() {
107109
const [testEl, scenario] = new Scenario(this.test).go();
108-
const domainNav = await testEl.waitUntilExists('section.domain-search .domain-navigation');
110+
const domainNav = await testEl.waitUntilExists(
111+
'section.domain-search .domain-navigation'
112+
);
109113
const domainInput = domainNav.querySelector('input');
110114
const changeDomain = domainNav.querySelector('a.change-domain');
111115

client/test/help.test.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
describe('Help', () => {
22
async function helpTest(mochaTest) {
3-
const [testEl, scenario] = new Scenario(mochaTest)
4-
.startingAt('/help')
5-
.go();
3+
const [testEl, scenario] = new Scenario(mochaTest).startingAt('/help').go();
64

75
const helpEl = await testEl.waitUntilExists('section.help');
86

@@ -31,11 +29,7 @@ describe('Help', () => {
3129

3230
linksEl
3331
.textNodes('a')
34-
.should.deep.equal([
35-
'Latest release notes',
36-
'Cadence',
37-
'Cadence UI',
38-
]);
32+
.should.deep.equal(['Latest release notes', 'Cadence', 'Cadence UI']);
3933
});
4034

4135
it('should provide commands under common CLI commands', async function test() {
@@ -45,12 +39,19 @@ describe('Help', () => {
4539
linksEl
4640
.textNodes('pre')
4741
.should.deep.equal([
48-
"cadence --domain {domain-name} domain register --global_domain false",
49-
"cadence --domain {domain-name} domain describe",
50-
"cadence --domain {domain-name} workflow run --tl {task-list-name} --wt {workflow-type-name} --et 60 -i '\"{input-string}\"'",
51-
"cadence --domain {domain-name} workflow show -w {workflow-id} -r {run-id}",
52-
"cadence --domain {domain-name} workflow list",
53-
"cadence --domain {domain-name} workflow list --open",
42+
'cadence --domain {domain-name} domain register --global_domain false',
43+
'cadence --env {staging|prod|prod02} --domain {domain-name} domain describe',
44+
'cadence --env {staging|prod|prod02} --domain {domain-name} domain update -active_cluster {cluster-name}',
45+
'cadence --env {staging|prod|prod02} --domain {domain-name} domain update --add_bad_binary {bad-binary-SHA} --reason \'"{reason}"\'',
46+
'cadence --env {staging|prod|prod02} --domain {domain-name} workflow run --tl {task-list-name} --wt {workflow-type-name} --et 60 -i \'"{input-string}"\'',
47+
'cadence --env {staging|prod|prod02} --domain {domain-name} workflow describe -w {workflow-id} -r {run-id}',
48+
'cadence --env {staging|prod|prod02} --domain {domain-name} workflow show -w {workflow-id} -r {run-id}',
49+
'cadence --env {staging|prod|prod02} --domain {domain-name} workflow signal -w {workflow-id} -r {run-id} --name {signal-name} --input \'"{signal-payload}"\'',
50+
'cadence workflow reset -w {workflow-id} -r {run-id} --event_id {event-id} --reason \'"{reason}"\' --reset_type {reset-type} --reset_bad_binary_checksum {bad-binary-SHA}',
51+
'cadence workflow reset-batch --query \'"{query}"\' --only_non_deterministic --reason \'"{reason}"\' --reset_type {reset-type}',
52+
'cadence --env {staging|prod|prod02} --domain {domain-name} workflow {list|listall}',
53+
'cadence --env {staging|prod|prod02} --domain {domain-name} workflow {list|listall} --open',
54+
'cadence workflow {list|listall} --query \'(CustomKeywordField = "keyword1" and CustomIntField >= 5) or CustomKeywordField = "keyword2" and CloseTime = missing\'',
5455
]);
5556
});
5657

@@ -67,4 +68,4 @@ describe('Help', () => {
6768
'Join our slack channel',
6869
]);
6970
});
70-
});
71+
});

client/test/workflow-list.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ describe('Workflow list', () => {
132132
it('should respect query parameters for range and status', async function test() {
133133
const [testEl] = new Scenario(this.test)
134134
.withDomain('ci-test')
135-
.startingAt('/domains/ci-test/workflows?status=FAILED&range=last-24-hours')
135+
.startingAt(
136+
'/domains/ci-test/workflows?status=FAILED&range=last-24-hours'
137+
)
136138
.withWorkflows('closed', {
137139
startTime: moment()
138140
.subtract(24, 'hours')

client/test/workflow.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,8 +1241,9 @@ describe('Workflow', () => {
12411241
.querySelector('section.workflow > nav a#nav-link-summary')
12421242
.should.have.class('router-link-active');
12431243
await retry(() => {
1244-
scenario.vm.$el.querySelector('section.workflow > nav a#nav-link-stack-trace')
1245-
.should.not.be.displayed;
1244+
scenario.vm.$el.querySelector(
1245+
'section.workflow > nav a#nav-link-stack-trace'
1246+
).should.not.be.displayed;
12461247
scenario.vm.$el.querySelector('section.workflow > nav a#nav-link-query')
12471248
.should.not.be.displayed;
12481249
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cadence-web",
3-
"version": "3.12.0",
3+
"version": "3.13.0",
44
"description": "Cadence Web UI",
55
"main": "server/index.js",
66
"licence": "MIT",

0 commit comments

Comments
 (0)