Skip to content

Commit 4d036c3

Browse files
committed
fix(cli): Show organizations project only
1 parent b8a0628 commit 4d036c3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

templates/cli/lib/paginate.js.twig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
const paginate = async (action, args = {}, limit = 100, wrapper = '') => {
1+
const paginate = async (action, args = {}, limit = 100, wrapper = '', queries = []) => {
22
let pageNumber = 0;
33
let results = [];
44
let total = 0;
55

66
while (true) {
77
const offset = pageNumber * limit;
8+
89
// Merge the limit and offset into the args
910
const response = await action({
1011
...args,
1112
queries: [
13+
...queries,
1214
JSON.stringify({ method: 'limit', values: [limit] }),
1315
JSON.stringify({ method: 'offset', values: [offset] })
1416
]

templates/cli/lib/questions.js.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ const questionsInitProject = [
189189
message: "Choose your {{ spec.title|caseUcfirst }} project.",
190190
choices: async (answers) => {
191191
const queries = [
192-
JSON.stringify({ method: 'equal', attribute: 'teamId', values: [answers.organization.id] }),
193-
JSON.stringify({ method: 'orderDesc', attribute: 'Id' })
192+
JSON.stringify({ method: 'equal', attribute: 'teamId', values: [answers.organization] }),
193+
JSON.stringify({ method: 'orderDesc', attribute: '$id' })
194194
]
195195

196-
const { projects } = await paginate(projectsList, { parseOutput: false, queries, }, 100, 'projects');
196+
const { projects } = await paginate(projectsList, { parseOutput: false }, 100, 'projects', queries);
197197

198198
let choices = projects.map((project) => {
199199
return {

0 commit comments

Comments
 (0)