Skip to content

Commit

Permalink
LITE-28566: Add applied pricelist to marketplace tables
Browse files Browse the repository at this point in the history
  • Loading branch information
riazhski committed Sep 22, 2023
1 parent e2fbda9 commit 7460bd3
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1842,6 +1842,7 @@ button + .c-text-field__append-inner > svg[data-v-b5bb9caa]:first-child {
margin-top: 0;
}
.pricing-tab__pricelist {
min-width: 226px;
max-width: 226px;
}

Expand Down

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.3c43b45d3e9e7cbf9863.js"></script><script defer src="index.ab2a9c611cfbbcb19f36.js"></script><link href="index.6f15022f4aecf590cc95.css" rel="stylesheet"></head>
<script defer src="vendors.3c43b45d3e9e7cbf9863.js"></script><script defer src="index.7dace5de4ae265038d36.js"></script><link href="index.79edc4161086dcc9a76c.css" rel="stylesheet"></head>

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

Large diffs are not rendered by default.

35 changes: 29 additions & 6 deletions ui/src/components/CreateDeploymentRequestDialog/PricingTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
template(v-else-if="header.value === 'pricing'")

c-menu(
v-if="row.pricelist",
v-if="row.batches.length > 0",
locator="batches-list",
outline,
small,
Expand All @@ -48,11 +48,17 @@
:icon-right="icons.googleArrowDropDownBaseline"
mode="outlined",
)
.truncate-text.pricing-tab__pricelist(
:title="row.pricelist.name",
) {{ row.pricelist.name }}
.pricing-tab__pricelist.truncate-text {{ selectedPricelist(row) }}

template(#default="")
c-button(
small,
:upper-case="false",
fluid,
@click="resetBatch(row)",
)
.assistive-color

div(
v-for="batch in row.batches",
:key="batch.id",
Expand Down Expand Up @@ -150,14 +156,30 @@ export default {
name: item.name,
icon: item.icon,
batches: item.batches,
pricelist: item.batches[0],
pricelist: item.pricelist,
};
},
findMarketplaceInList(id) {
return findIndex(propEq(id, 'id'), this.localValue);
},
setBatch(batch, marketplace) {
const index = findIndex(propEq(marketplace.id, 'id'), this.localValue);
const index = this.findMarketplaceInList(marketplace.id);
this.localValue[index].pricelist = pick(['id', 'name'], batch);
},
resetBatch(marketplace) {
const index = this.findMarketplaceInList(marketplace.id);
this.localValue[index].pricelist = undefined;
},
selectedPricelist(marketplace) {
const index = this.findMarketplaceInList(marketplace.id);
return this.localValue[index].pricelist
? this.localValue[index].pricelist.name : '';
},
},
async created() {
Expand Down Expand Up @@ -194,6 +216,7 @@ export default {
}
&__pricelist {
min-width: 226px;
max-width: 226px;
}
}
Expand Down
48 changes: 44 additions & 4 deletions ui/src/components/RequestMarketplacesTab.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template lang="pug">
.request-marketplaces-tab
c-data-table(
v-model="marketplaces",
v-model="marketplacesWithBatchesInfo",
:headers="headers",
:prepare-row="prepareRow",
:show-loader="loading",
Expand Down Expand Up @@ -34,20 +34,48 @@
:key="header.value",
)
span(v-if="row.externalId") {{ row.externalId }}
span.assistive-text(v-else)
.assistive-color(v-else)

//- Pricing Batch column
td.nowrap-cell(
v-if="header.value === 'pricelist'",
:key="header.value",
)
detail-item(
v-if="row.pricelist",
:assistive-text="row.pricelist.id",
)
template(#body-text="")
.truncate-text {{ row.pricelist.name }}

.assistive-color(v-else)


</template>

<script>
import {
path,
} from 'ramda';
import cDataTable from '~components/cDataTable.vue';
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 All @@ -56,22 +84,29 @@ export default {
},
props: {
requestId: {
type: String,
request: {
type: Object,
required: true,
},
},
data: () => ({
loading: true,
marketplaces: [],
marketplacesWithBatchesInfo: [],
headers: [
{ text: 'Marketplace', value: 'marketplace' },
{ text: 'External ID', value: 'externalId' },
{ text: 'Pricing Batch', value: 'pricelist' },
],
}),
computed: {
requestId: path(['request', 'id']),
deploymentId: path(['request', 'deployment', 'id']),
},
methods: {
prepareRow(item) {
return {
Expand All @@ -81,12 +116,17 @@ export default {
name: item.name,
icon: item.icon,
},
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;
},
};
Expand Down
3 changes: 2 additions & 1 deletion ui/src/pages/RequestDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ c-view.request-details(
span {{ request.delegate_l2 ? 'Delegated' : 'Not delegated' }}

c-tabs(
v-if="request",
:current-tab.sync="currentTab",
:tabs="tabs",
)
template(#marketplaces="")
request-marketplaces-tab(:request-id="requestId")
request-marketplaces-tab(:request="request")

template(#tasks="")
request-tasks-tab(
Expand Down

0 comments on commit 7460bd3

Please sign in to comment.