Skip to content

Commit 9310776

Browse files
Saas improve step (#340)
1 parent 08a4cdd commit 9310776

File tree

4 files changed

+95
-20
lines changed

4 files changed

+95
-20
lines changed

lib/interface/cli/commands/step/get.cmd.js

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,34 @@ const command = new Command({
2626
describe: 'Step name/id',
2727
})
2828
.option('name', {
29-
describe: 'Filter steps by name',
29+
describe: 'Filter by name pattern',
3030
})
31-
.option('label', {
32-
describe: 'Filter by a label',
33-
alias: 'l',
31+
.option('tag', {
32+
describe: 'Filter by a tag',
33+
alias: 't',
3434
default: [],
3535
})
36+
.option('category', {
37+
describe: 'Filter by category',
38+
alias: 'c',
39+
default: [],
40+
})
41+
.option('stage', {
42+
describe: 'Filter by stage',
43+
choices: ['graduated', 'incubating'],
44+
})
45+
.option('official', {
46+
describe: 'Filter only official steps',
47+
boolean: true,
48+
})
49+
.option('public', {
50+
describe: 'Filter only public steps',
51+
boolean: true,
52+
})
53+
.option('private', {
54+
describe: 'Filter only private steps',
55+
boolean: true,
56+
})
3657
.option('limit', {
3758
describe: 'Limit amount of returned results',
3859
default: DEFAULTS.GET_LIMIT_RESULTS,
@@ -46,7 +67,12 @@ const command = new Command({
4667
const { id: ids, name } = argv;
4768
const limit = argv.limit;
4869
const offset = (argv.page - 1) * limit;
49-
const labels = prepareKeyValueFromCLIEnvOption(argv.label);
70+
const isPublic = argv.public;
71+
const isPrivate = argv.private;
72+
const category = argv.category;
73+
const stage = argv.stage;
74+
const official = argv.official;
75+
const tag = argv.tag;
5076

5177
if (!_.isEmpty(ids)) {
5278
const steps = [];
@@ -73,7 +99,12 @@ const command = new Command({
7399
limit,
74100
offset,
75101
id: name,
76-
labels,
102+
public: isPublic,
103+
private: isPrivate,
104+
category,
105+
stage,
106+
official,
107+
tag,
77108
});
78109
Output.print(_.map(_.get(steps, 'docs'), Step.fromResponse));
79110
}

lib/logic/entities/Step.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ class Step extends Entity {
66
super();
77
this.entityType = 'step';
88
this.info = data;
9-
this.id = this.info.metadata.id;
109
this.name = this.info.metadata.name;
10+
this.visibility = this.info.metadata.isPublic ? 'public' : 'private';
11+
this.official = this.info.metadata.official ? "true": "false";
12+
this.category = this.info.metadata.categories;
13+
this.stage = this.info.metadata.stage;
1114
this.created = this.info.metadata.created_at ? new Date(this.info.metadata.created_at) : undefined;
1215
this.updated = this.info.metadata.updated_at ? new Date(this.info.metadata.updated_at) : undefined;
13-
this.defaultColumns = ['name', 'updated', 'created'];
14-
this.wideColumns = ['id'].concat(this.defaultColumns);
16+
this.defaultColumns = ['name', 'category', 'official', 'visibility', 'stage', 'updated', 'created'];
17+
this.wideColumns = this.defaultColumns;
1518
}
1619

1720
static fromResponse(response) {
18-
return new Step(_.pick(response, 'id', 'version', 'kind', 'metadata', 'spec'));
21+
return new Step(_.pick(response, 'version', 'kind', 'metadata', 'spec'));
1922
}
2023
}
2124

openapi.json

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5407,36 +5407,77 @@
54075407
],
54085408
"parameters": [
54095409
{
5410-
"name": "offset",
5410+
"name": "id",
54115411
"in": "query",
54125412
"schema": {
5413-
"type": "integer"
5413+
"type": "string"
54145414
},
5415-
"description": "Offset"
5415+
"description": "Id or name"
54165416
},
54175417
{
5418-
"name": "id",
54195418
"in": "query",
5419+
"name": "official",
54205420
"schema": {
54215421
"type": "string"
54225422
},
5423-
"description": "Id"
5423+
"description": "Filter only official steps"
54245424
},
54255425
{
54265426
"in": "query",
5427-
"name": "limit",
5427+
"name": "category",
54285428
"schema": {
54295429
"type": "string"
54305430
},
5431-
"description": "Limit"
5431+
"description": "Filter by a specific category"
54325432
},
54335433
{
54345434
"in": "query",
5435-
"name": "labels",
5435+
"name": "tag",
54365436
"schema": {
54375437
"type": "string"
54385438
},
5439-
"description": "Labels"
5439+
"description": "Filter by a specific tag"
5440+
},
5441+
{
5442+
"in": "query",
5443+
"name": "public",
5444+
"schema": {
5445+
"type": "string"
5446+
},
5447+
"description": "Filter only public steps"
5448+
},
5449+
{
5450+
"in": "query",
5451+
"name": "private",
5452+
"schema": {
5453+
"type": "string"
5454+
},
5455+
"description": "Filter only private steps"
5456+
},
5457+
{
5458+
"in": "query",
5459+
"name": "stage",
5460+
"schema": {
5461+
"type": "string",
5462+
"enum": ["graduated", "incubating"]
5463+
},
5464+
"description": "Filter by stage"
5465+
},
5466+
{
5467+
"name": "offset",
5468+
"in": "query",
5469+
"schema": {
5470+
"type": "integer"
5471+
},
5472+
"description": "Offset"
5473+
},
5474+
{
5475+
"in": "query",
5476+
"name": "limit",
5477+
"schema": {
5478+
"type": "string"
5479+
},
5480+
"description": "Limit"
54405481
}
54415482
],
54425483
"operationId": "steps-list",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.21.1",
3+
"version": "0.23.0",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)