Skip to content

Commit b14e05c

Browse files
authored
Merge pull request #137 from cloudblue/add-pagination
Make pagination to work and integrate with backend
2 parents 069c9bf + 6368fa3 commit b14e05c

19 files changed

+281
-205
lines changed

connect_ext_ppr/static/deployment-details.6821e06b1fbacca9d4c7.js renamed to connect_ext_ppr/static/deployment-details.fd87698951c89fbe5e69.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

connect_ext_ppr/static/index.8af7ae08238431f57421.js renamed to connect_ext_ppr/static/index.00751d4e28bf7cf9b010.js

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

connect_ext_ppr/static/index.078542b7141079d77ac1.css

Lines changed: 93 additions & 93 deletions
Large diffs are not rendered by default.

connect_ext_ppr/static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono&family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap" rel="stylesheet">
1313
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
1414
<title>Index</title>
15-
<script defer src="vendors.d43ac28a3eb5fa40c6ce.js"></script><script defer src="index.8af7ae08238431f57421.js"></script><link href="index.078542b7141079d77ac1.css" rel="stylesheet"></head>
15+
<script defer src="vendors.d43ac28a3eb5fa40c6ce.js"></script><script defer src="index.00751d4e28bf7cf9b010.js"></script><link href="index.078542b7141079d77ac1.css" rel="stylesheet"></head>
1616

1717
<body>
1818
<div id="app"></div>

connect_ext_ppr/static/request-details.eba3a5545dfa7b83b78d.js renamed to connect_ext_ppr/static/request-details.d2e1e1181d6531e0ff8b.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/src/components/CreateDeploymentRequestDialog/MarketplacesTab.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ export default {
137137
async created() {
138138
try {
139139
this.loading = true;
140-
this.marketplaces = await getDeploymentMarketplaces(this.deploymentId);
140+
const depMktps = await getDeploymentMarketplaces(this.deploymentId);
141+
this.marketplaces = depMktps.collection;
141142
if (this.value.all) this.isAllSelected = true;
142143
else if (this.value.choices.length) this.selectedMarketplaces = this.value.choices;
143144
} catch (e) {

ui/src/components/CreateDeploymentRequestDialog/PprTab.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ export default {
110110
async created() {
111111
try {
112112
this.loading = true;
113-
this.pprs = await getPPRs(this.deploymentId);
113+
const pprs = await getPPRs(this.deploymentId);
114+
this.pprs = pprs.collection;
114115
if (this.localValue?.id) this.selectedPprVersion = this.localValue.id;
115116
} catch (e) {
116117
this.pprs = [];

ui/src/components/CreateDeploymentRequestDialog/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,13 @@ export default {
260260
261261
async fetchDeployment() {
262262
if (this.deployment) return;
263-
264-
[this.localDeployment] = await getDeployments({
263+
const deployments = await getDeployments({
265264
hubId: this.form.hub.id,
266265
productId: this.form.product.id,
267266
});
268267
268+
[this.localDeployment] = deployments.collection;
269+
269270
this.goToNextStep();
270271
},
271272

ui/src/components/DeploymentConfigurationTab.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
hide-go-to-page-section,
77
:prepare-row="prepareRow",
88
:updating="loading",
9-
showManagePanel,
9+
show-manage-panel,
10+
:update="load",
1011
)
1112
template(#buttons="")
1213
c-button(
@@ -202,6 +203,7 @@ export default {
202203
uploadErrorText: '',
203204
showErrorSnackbar: false,
204205
errorSnackbarText: '',
206+
localParams: { limit: 10, offset: 0 },
205207
};
206208
},
207209
@@ -264,7 +266,8 @@ export default {
264266
async getConfigs() {
265267
this.loading = true;
266268
try {
267-
this.localValue = await getDeploymentConfigurations(this.deploymentId);
269+
const conf = await getDeploymentConfigurations(this.deploymentId, this.localParams);
270+
this.localValue = conf.collection;
268271
} catch (e) {
269272
this.showErrorSnackbar = true;
270273
this.errorSnackbarText = e.message;
@@ -282,6 +285,12 @@ export default {
282285
this.errorSnackbarText = e.message;
283286
}
284287
},
288+
289+
load(params) {
290+
this.localParams = params;
291+
292+
return getDeploymentConfigurations(this.deploymentId, params);
293+
},
285294
},
286295
287296
created() {

ui/src/components/DeploymentMarketplacesTab.vue

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:headers="headers",
66
:prepare-row="prepareRow",
77
:updating="loading",
8-
hide-all-pagination-sections,
8+
:update="load",
99
)
1010
template(#items="{ row, visibleHeaders }")
1111
tr.table__row.hoverable(:id="row.id")
@@ -61,20 +61,13 @@
6161

6262
<script>
6363
import {
64-
getDeploymentBatches,
6564
getDeploymentMarketplaces,
6665
} from '@/utils';
6766
6867
import cDataTable from '~components/cDataTable.vue';
6968
import DetailItem from '~components/DetailItem.vue';
7069
import Pic from '~components/Pic.vue';
7170
72-
import {
73-
enrich,
74-
} from '~utils';
75-
76-
77-
const enrichByBatchInfo = enrich('id', ['pricelist', 'id'], 'pricelist');
7871
7972
export default {
8073
components: {
@@ -109,15 +102,13 @@ export default {
109102
priceList: item.pricelist,
110103
};
111104
},
105+
106+
load(params) {
107+
return getDeploymentMarketplaces(this.deploymentId, params);
108+
},
112109
},
113110
114-
async created() {
115-
const marketplaces = await getDeploymentMarketplaces(this.deploymentId);
116-
const batches = await getDeploymentBatches(this.deploymentId);
117111
118-
this.marketplaces = enrichByBatchInfo(batches, marketplaces);
119-
this.loading = false;
120-
},
121112
};
122113
123114
</script>

ui/src/components/DeploymentRequestsTab.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
:headers="headers",
66
:prepare-row="prepareRow",
77
:updating="loading",
8-
hide-all-pagination-sections,
98
fix-layout,
109
show-manage-panel,
10+
:update="load",
1111
)
1212
template(#buttons="")
1313
c-button.ppr-table__upload-btn(
@@ -132,6 +132,8 @@ export default {
132132
width: 140,
133133
},
134134
],
135+
136+
localParams: { limit: 10, offset: 0 },
135137
}),
136138
137139
computed: {
@@ -155,13 +157,16 @@ export default {
155157
156158
async loadRequests() {
157159
this.loading = true;
158-
this.requests = await getDeploymentRequests(this.deploymentId);
160+
const rq = await getDeploymentRequests(this.deploymentId, this.localParams);
161+
this.requests = rq.collection;
159162
this.loading = false;
160163
},
161-
},
162164
163-
created() {
164-
this.loadRequests();
165+
load(params) {
166+
this.localParams = params;
167+
168+
return getDeploymentRequests(this.deploymentId, params);
169+
},
165170
},
166171
};
167172

ui/src/components/DeploymentRequestsTable.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ c-data-table(
55
hide-go-to-page-section,
66
:prepare-row="prepareRow",
77
:updating="localUpdating",
8+
:update="load",
89
)
910
template(#items="{ row, visibleHeaders}")
1011
tr.table__row.hoverable(:id="row.id")
@@ -166,17 +167,25 @@ export default {
166167
align: 'left',
167168
},
168169
],
170+
171+
localParams: { limit: 10, offset: 0 },
169172
};
170173
},
171174
172175
methods: {
173176
prepareRow,
177+
178+
load(params) {
179+
this.localParams = params;
180+
181+
return getDeploymentsRequests(params);
182+
},
174183
},
175184
176185
watch: {
177186
async localUpdating(v) {
178187
if (v) {
179-
this.localValue = await getDeploymentsRequests();
188+
await getDeploymentsRequests(this.localParams);
180189
this.localUpdating = false;
181190
}
182191
},

ui/src/components/DeploymentsTable.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ c-data-table(
33
v-model="localValue",
44
:headers="headers",
55
hide-go-to-page-section,
6+
:update="load",
67
:prepare-row="prepareRow",
78
:updating="loading",
89
)
@@ -155,13 +156,12 @@ export default {
155156
156157
methods: {
157158
prepareRow,
158-
},
159159
160-
async created() {
161-
this.loading = true;
162-
const allDeployments = await getDeployments();
163-
this.localValue = allDeployments;
164-
this.loading = false;
160+
load(params) {
161+
return getDeployments({
162+
queryParameters: params,
163+
});
164+
},
165165
},
166166
};
167167
</script>

ui/src/components/PprTab.vue

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
:headers="headers",
66
:prepare-row="prepareRow",
77
:updating="loading",
8-
hide-all-pagination-sections,
9-
fix-layout,
8+
:update="load",
109
show-manage-panel,
10+
hide-go-to-page-section,
1111
)
1212
template(#buttons="")
1313
c-button.ppr-table__upload-btn(
@@ -236,6 +236,7 @@ export default {
236236
237237
showErrorSnackbar: false,
238238
errorSnackbarText: '',
239+
localParams: { limit: 10, offset: 0 },
239240
};
240241
},
241242
@@ -267,7 +268,8 @@ export default {
267268
async loadPPRs() {
268269
try {
269270
this.loading = true;
270-
this.localValue = await getPPRs(this.deploymentId);
271+
const pprs = await getPPRs(this.deploymentId, this.localParams);
272+
this.localValue = pprs.collection;
271273
} catch (e) {
272274
this.showErrorSnackbar = true;
273275
this.errorSnackbarText = e.message;
@@ -279,10 +281,12 @@ export default {
279281
openUploadPPRDialog() {
280282
this.isUploadPPRDialogOpen = true;
281283
},
282-
},
283284
284-
created() {
285-
this.loadPPRs();
285+
load(params) {
286+
this.localParams = params;
287+
288+
return getPPRs(this.deploymentId, params);
289+
},
286290
},
287291
};
288292
</script>

ui/src/components/RequestMarketplacesTab.vue

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:headers="headers",
66
:prepare-row="prepareRow",
77
:updating="loading",
8-
hide-all-pagination-sections,
8+
:update="load",
99
)
1010
template(#items="{ row, visibleHeaders }")
1111
tr.table__row.hoverable(:id="row.id")
@@ -64,18 +64,10 @@ import DetailItem from '~components/DetailItem.vue';
6464
import Pic from '~components/Pic.vue';
6565
6666
import {
67-
enrich,
68-
} from '@/tools/utils';
69-
70-
import {
71-
getDeploymentBatches,
7267
getDeploymentRequestMarketplaces,
7368
} from '@/utils';
7469
7570
76-
const enrichByBatchInfo = enrich('id', ['pricelist', 'id'], 'pricelist');
77-
78-
7971
export default {
8072
components: {
8173
cDataTable,
@@ -120,14 +112,10 @@ export default {
120112
pricelist: item.pricelist,
121113
};
122114
},
123-
},
124-
125-
async created() {
126-
this.marketplaces = await getDeploymentRequestMarketplaces(this.requestId);
127-
const batches = await getDeploymentBatches(this.deploymentId);
128115
129-
this.marketplacesWithBatchesInfo = enrichByBatchInfo(batches, this.marketplaces);
130-
this.loading = false;
116+
load(params) {
117+
return getDeploymentRequestMarketplaces(this.requestId, this.deploymentId, params);
118+
},
131119
},
132120
};
133121

ui/src/components/RequestTasksTab.vue

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:headers="headers",
66
:prepare-row="prepareRow",
77
:updating="loading",
8-
hide-all-pagination-sections,
8+
:update="load",
99
)
1010
template(#items="{ row, visibleHeaders }")
1111
tr.table__row.hoverable(:id="row.id")
@@ -156,6 +156,7 @@ export default {
156156
isInfoDialogOpen: false,
157157
currentError: '',
158158
isErrorDialogOpen: false,
159+
localParams: { limit: 10, offset: 0 },
159160
}),
160161
161162
methods: {
@@ -191,11 +192,10 @@ export default {
191192
this.isErrorDialogOpen = true;
192193
},
193194
194-
async loadTasks() {
195-
this.loading = true;
196-
this.tasks = await getDeploymentRequestTasks(this.requestId);
197-
this.loading = false;
198-
this.localUpdating = false;
195+
load(params) {
196+
this.localParams = params;
197+
198+
return getDeploymentRequestTasks(this.requestId, params);
199199
},
200200
},
201201
@@ -204,14 +204,12 @@ export default {
204204
if (!v) this.currentItem = null;
205205
},
206206
207-
localUpdating(v) {
208-
if (v) this.loadTasks();
207+
async localUpdating(v) {
208+
if (v) {
209+
this.tasks = await getDeploymentRequestTasks(this.requestId, this.localParams);
210+
}
209211
},
210212
},
211-
212-
created() {
213-
this.loadTasks();
214-
},
215213
};
216214
217215
</script>

0 commit comments

Comments
 (0)