-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LITE-28565: Add pricelists to request create wizard
- Loading branch information
Showing
10 changed files
with
346 additions
and
16 deletions.
There are no files selected for viewing
File renamed without changes.
93 changes: 85 additions & 8 deletions
93
..._ppr/static/index.b74401130aa96499b74b.js → ..._ppr/static/index.ab2a9c611cfbbcb19f36.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
200 changes: 200 additions & 0 deletions
200
ui/src/components/CreateDeploymentRequestDialog/PricingTab.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
<template lang="pug"> | ||
.pricing-tab | ||
p.pricing-tab__title Link Pricing Stream Batches to Marketplaces | ||
|
||
c-data-table.pricing-tab__table( | ||
:value="marketplacesWithPriceLists", | ||
:headers="headers", | ||
:prepare-row="prepareRow", | ||
:updating="loading", | ||
hide-all-pagination-sections, | ||
fix-layout, | ||
) | ||
template(#items="{ row, visibleHeaders }") | ||
tr.table__row.hoverable | ||
td( | ||
v-for="header in visibleHeaders" | ||
:key="header.value", | ||
) | ||
template(v-if="header.value === 'marketplace'") | ||
detail-item.pricing-tab__detail | ||
template(#image="") | ||
pic.object-image( | ||
:src="row.icon", | ||
:width="32", | ||
:height="32", | ||
size="contain", | ||
) | ||
template(#body-text="") | ||
.truncate-text | ||
span {{ row.name }} | ||
template(#assistive-text="") | ||
span {{ row.id }} | ||
|
||
template(v-else-if="header.value === 'pricing'") | ||
|
||
c-menu( | ||
v-if="row.pricelist", | ||
locator="batches-list", | ||
outline, | ||
small, | ||
:min-width="266", | ||
) | ||
template(#trigger="") | ||
c-button.c-menu-list__open( | ||
locator="c-menu-list_open-button", | ||
small, | ||
:upperCase="false", | ||
:icon-right="icons.googleArrowDropDownBaseline" | ||
mode="outlined", | ||
) | ||
.truncate-text.pricing-tab__pricelist( | ||
:title="row.pricelist.name", | ||
) {{ row.pricelist.name }} | ||
|
||
template(#default="") | ||
div( | ||
v-for="batch in row.batches", | ||
:key="batch.id", | ||
) | ||
c-button( | ||
small, | ||
:upper-case="false", | ||
@click="setBatch(batch, row)", | ||
) | ||
.truncate-text {{ batch.name }} | ||
|
||
.assistive-color(v-else) — | ||
</template> | ||
|
||
<script> | ||
import { | ||
googleArrowDropDownBaseline, | ||
} from '@cloudblueconnect/material-svg/baseline'; | ||
import { | ||
filter, | ||
findIndex, | ||
map, | ||
pathEq, | ||
pick, | ||
propEq, | ||
} from 'ramda'; | ||
import cButton from '~components/cButton.vue'; | ||
import cDataTable from '~components/cDataTable.vue'; | ||
import cMenu from '~components/cMenu.vue'; | ||
import DetailItem from '~components/DetailItem.vue'; | ||
import Pic from '~components/Pic.vue'; | ||
import sync from '~mixins/sync'; | ||
import { | ||
getDeploymentBatches, | ||
} from '@/utils'; | ||
export default { | ||
mixins: [sync([{ prop: 'value', local: 'localValue' }])], | ||
components: { | ||
cButton, | ||
cDataTable, | ||
cMenu, | ||
DetailItem, | ||
Pic, | ||
}, | ||
props: { | ||
value: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
marketplaces: { | ||
type: Array, | ||
required: true, | ||
}, | ||
deploymentId: String, | ||
}, | ||
data: () => ({ | ||
localValue: [], | ||
marketplacesWithPriceLists: [], | ||
loading: false, | ||
icons: { | ||
googleArrowDropDownBaseline, | ||
}, | ||
headers: [ | ||
{ | ||
text: 'Marketplace', | ||
value: 'marketplace', | ||
align: 'left', | ||
}, | ||
{ | ||
text: 'Pricing stream batch', | ||
value: 'pricing', | ||
align: 'left', | ||
width: 266, | ||
}, | ||
], | ||
}), | ||
methods: { | ||
prepareRow(item) { | ||
return { | ||
id: item.id, | ||
name: item.name, | ||
icon: item.icon, | ||
batches: item.batches, | ||
pricelist: item.batches[0], | ||
}; | ||
}, | ||
setBatch(batch, marketplace) { | ||
const index = findIndex(propEq(marketplace.id, 'id'), this.localValue); | ||
this.localValue[index].pricelist = pick(['id', 'name'], batch); | ||
}, | ||
}, | ||
async created() { | ||
this.localValue = this.marketplaces; | ||
try { | ||
this.loading = true; | ||
const batchesList = await getDeploymentBatches(this.deploymentId); | ||
const getBatchesForMarketplace = item => ({ | ||
...item, | ||
batches: filter(pathEq(item.id, ['stream', 'context', 'marketplace', 'id']))(batchesList), | ||
}); | ||
this.marketplacesWithPriceLists = map(getBatchesForMarketplace, this.marketplaces); | ||
} catch (e) { | ||
this.$emit('error', e); | ||
} finally { | ||
this.loading = false; | ||
} | ||
}, | ||
}; | ||
</script> | ||
|
||
<style lang="stylus"> | ||
.pricing-tab { | ||
&__title { | ||
font-size: 18px; | ||
font-weight: 500; | ||
line-height: 24px; | ||
margin-bottom: 24px; | ||
} | ||
&__detail { | ||
margin-top: 0; | ||
} | ||
&__pricelist { | ||
max-width: 226px; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters