Skip to content

Commit

Permalink
Make pagination to work and integrate with backend
Browse files Browse the repository at this point in the history
  • Loading branch information
nerimartinez committed Jan 8, 2024
1 parent 069c9bf commit 6368fa3
Show file tree
Hide file tree
Showing 19 changed files with 281 additions and 205 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

186 changes: 93 additions & 93 deletions connect_ext_ppr/static/index.078542b7141079d77ac1.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion connect_ext_ppr/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<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">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<title>Index</title>
<script defer src="vendors.d43ac28a3eb5fa40c6ce.js"></script><script defer src="index.8af7ae08238431f57421.js"></script><link href="index.078542b7141079d77ac1.css" rel="stylesheet"></head>
<script defer src="vendors.d43ac28a3eb5fa40c6ce.js"></script><script defer src="index.00751d4e28bf7cf9b010.js"></script><link href="index.078542b7141079d77ac1.css" rel="stylesheet"></head>

<body>
<div id="app"></div>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ export default {
async created() {
try {
this.loading = true;
this.marketplaces = await getDeploymentMarketplaces(this.deploymentId);
const depMktps = await getDeploymentMarketplaces(this.deploymentId);
this.marketplaces = depMktps.collection;
if (this.value.all) this.isAllSelected = true;
else if (this.value.choices.length) this.selectedMarketplaces = this.value.choices;
} catch (e) {
Expand Down
3 changes: 2 additions & 1 deletion ui/src/components/CreateDeploymentRequestDialog/PprTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ export default {
async created() {
try {
this.loading = true;
this.pprs = await getPPRs(this.deploymentId);
const pprs = await getPPRs(this.deploymentId);
this.pprs = pprs.collection;
if (this.localValue?.id) this.selectedPprVersion = this.localValue.id;
} catch (e) {
this.pprs = [];
Expand Down
5 changes: 3 additions & 2 deletions ui/src/components/CreateDeploymentRequestDialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,13 @@ export default {
async fetchDeployment() {
if (this.deployment) return;
[this.localDeployment] = await getDeployments({
const deployments = await getDeployments({
hubId: this.form.hub.id,
productId: this.form.product.id,
});
[this.localDeployment] = deployments.collection;
this.goToNextStep();
},
Expand Down
13 changes: 11 additions & 2 deletions ui/src/components/DeploymentConfigurationTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
hide-go-to-page-section,
:prepare-row="prepareRow",
:updating="loading",
showManagePanel,
show-manage-panel,
:update="load",
)
template(#buttons="")
c-button(
Expand Down Expand Up @@ -202,6 +203,7 @@ export default {
uploadErrorText: '',
showErrorSnackbar: false,
errorSnackbarText: '',
localParams: { limit: 10, offset: 0 },
};
},
Expand Down Expand Up @@ -264,7 +266,8 @@ export default {
async getConfigs() {
this.loading = true;
try {
this.localValue = await getDeploymentConfigurations(this.deploymentId);
const conf = await getDeploymentConfigurations(this.deploymentId, this.localParams);
this.localValue = conf.collection;
} catch (e) {
this.showErrorSnackbar = true;
this.errorSnackbarText = e.message;
Expand All @@ -282,6 +285,12 @@ export default {
this.errorSnackbarText = e.message;
}
},
load(params) {
this.localParams = params;
return getDeploymentConfigurations(this.deploymentId, params);
},
},
created() {
Expand Down
19 changes: 5 additions & 14 deletions ui/src/components/DeploymentMarketplacesTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:headers="headers",
:prepare-row="prepareRow",
:updating="loading",
hide-all-pagination-sections,
:update="load",
)
template(#items="{ row, visibleHeaders }")
tr.table__row.hoverable(:id="row.id")
Expand Down Expand Up @@ -61,20 +61,13 @@

<script>
import {
getDeploymentBatches,
getDeploymentMarketplaces,
} from '@/utils';
import cDataTable from '~components/cDataTable.vue';
import DetailItem from '~components/DetailItem.vue';
import Pic from '~components/Pic.vue';
import {
enrich,
} from '~utils';
const enrichByBatchInfo = enrich('id', ['pricelist', 'id'], 'pricelist');
export default {
components: {
Expand Down Expand Up @@ -109,15 +102,13 @@ export default {
priceList: item.pricelist,
};
},
load(params) {
return getDeploymentMarketplaces(this.deploymentId, params);
},
},
async created() {
const marketplaces = await getDeploymentMarketplaces(this.deploymentId);
const batches = await getDeploymentBatches(this.deploymentId);
this.marketplaces = enrichByBatchInfo(batches, marketplaces);
this.loading = false;
},
};
</script>
15 changes: 10 additions & 5 deletions ui/src/components/DeploymentRequestsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
:headers="headers",
:prepare-row="prepareRow",
:updating="loading",
hide-all-pagination-sections,
fix-layout,
show-manage-panel,
:update="load",
)
template(#buttons="")
c-button.ppr-table__upload-btn(
Expand Down Expand Up @@ -132,6 +132,8 @@ export default {
width: 140,
},
],
localParams: { limit: 10, offset: 0 },
}),
computed: {
Expand All @@ -155,13 +157,16 @@ export default {
async loadRequests() {
this.loading = true;
this.requests = await getDeploymentRequests(this.deploymentId);
const rq = await getDeploymentRequests(this.deploymentId, this.localParams);
this.requests = rq.collection;
this.loading = false;
},
},
created() {
this.loadRequests();
load(params) {
this.localParams = params;
return getDeploymentRequests(this.deploymentId, params);
},
},
};
Expand Down
11 changes: 10 additions & 1 deletion ui/src/components/DeploymentRequestsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ c-data-table(
hide-go-to-page-section,
:prepare-row="prepareRow",
:updating="localUpdating",
:update="load",
)
template(#items="{ row, visibleHeaders}")
tr.table__row.hoverable(:id="row.id")
Expand Down Expand Up @@ -166,17 +167,25 @@ export default {
align: 'left',
},
],
localParams: { limit: 10, offset: 0 },
};
},
methods: {
prepareRow,
load(params) {
this.localParams = params;
return getDeploymentsRequests(params);
},
},
watch: {
async localUpdating(v) {
if (v) {
this.localValue = await getDeploymentsRequests();
await getDeploymentsRequests(this.localParams);
this.localUpdating = false;
}
},
Expand Down
12 changes: 6 additions & 6 deletions ui/src/components/DeploymentsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ c-data-table(
v-model="localValue",
:headers="headers",
hide-go-to-page-section,
:update="load",
:prepare-row="prepareRow",
:updating="loading",
)
Expand Down Expand Up @@ -155,13 +156,12 @@ export default {
methods: {
prepareRow,
},
async created() {
this.loading = true;
const allDeployments = await getDeployments();
this.localValue = allDeployments;
this.loading = false;
load(params) {
return getDeployments({
queryParameters: params,
});
},
},
};
</script>
16 changes: 10 additions & 6 deletions ui/src/components/PprTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
:headers="headers",
:prepare-row="prepareRow",
:updating="loading",
hide-all-pagination-sections,
fix-layout,
:update="load",
show-manage-panel,
hide-go-to-page-section,
)
template(#buttons="")
c-button.ppr-table__upload-btn(
Expand Down Expand Up @@ -236,6 +236,7 @@ export default {
showErrorSnackbar: false,
errorSnackbarText: '',
localParams: { limit: 10, offset: 0 },
};
},
Expand Down Expand Up @@ -267,7 +268,8 @@ export default {
async loadPPRs() {
try {
this.loading = true;
this.localValue = await getPPRs(this.deploymentId);
const pprs = await getPPRs(this.deploymentId, this.localParams);
this.localValue = pprs.collection;
} catch (e) {
this.showErrorSnackbar = true;
this.errorSnackbarText = e.message;
Expand All @@ -279,10 +281,12 @@ export default {
openUploadPPRDialog() {
this.isUploadPPRDialogOpen = true;
},
},
created() {
this.loadPPRs();
load(params) {
this.localParams = params;
return getPPRs(this.deploymentId, params);
},
},
};
</script>
Expand Down
20 changes: 4 additions & 16 deletions ui/src/components/RequestMarketplacesTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:headers="headers",
:prepare-row="prepareRow",
:updating="loading",
hide-all-pagination-sections,
:update="load",
)
template(#items="{ row, visibleHeaders }")
tr.table__row.hoverable(:id="row.id")
Expand Down Expand Up @@ -64,18 +64,10 @@ import DetailItem from '~components/DetailItem.vue';
import Pic from '~components/Pic.vue';
import {
enrich,
} from '@/tools/utils';
import {
getDeploymentBatches,
getDeploymentRequestMarketplaces,
} from '@/utils';
const enrichByBatchInfo = enrich('id', ['pricelist', 'id'], 'pricelist');
export default {
components: {
cDataTable,
Expand Down Expand Up @@ -120,14 +112,10 @@ export default {
pricelist: item.pricelist,
};
},
},
async created() {
this.marketplaces = await getDeploymentRequestMarketplaces(this.requestId);
const batches = await getDeploymentBatches(this.deploymentId);
this.marketplacesWithBatchesInfo = enrichByBatchInfo(batches, this.marketplaces);
this.loading = false;
load(params) {
return getDeploymentRequestMarketplaces(this.requestId, this.deploymentId, params);
},
},
};
Expand Down
22 changes: 10 additions & 12 deletions ui/src/components/RequestTasksTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:headers="headers",
:prepare-row="prepareRow",
:updating="loading",
hide-all-pagination-sections,
:update="load",
)
template(#items="{ row, visibleHeaders }")
tr.table__row.hoverable(:id="row.id")
Expand Down Expand Up @@ -156,6 +156,7 @@ export default {
isInfoDialogOpen: false,
currentError: '',
isErrorDialogOpen: false,
localParams: { limit: 10, offset: 0 },
}),
methods: {
Expand Down Expand Up @@ -191,11 +192,10 @@ export default {
this.isErrorDialogOpen = true;
},
async loadTasks() {
this.loading = true;
this.tasks = await getDeploymentRequestTasks(this.requestId);
this.loading = false;
this.localUpdating = false;
load(params) {
this.localParams = params;
return getDeploymentRequestTasks(this.requestId, params);
},
},
Expand All @@ -204,14 +204,12 @@ export default {
if (!v) this.currentItem = null;
},
localUpdating(v) {
if (v) this.loadTasks();
async localUpdating(v) {
if (v) {
this.tasks = await getDeploymentRequestTasks(this.requestId, this.localParams);
}
},
},
created() {
this.loadTasks();
},
};
</script>
Expand Down
Loading

0 comments on commit 6368fa3

Please sign in to comment.