Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LITE-28299: create deployment request dialog #87

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

497 changes: 0 additions & 497 deletions connect_ext_ppr/static/deployment-details.css

Large diffs are not rendered by default.

Large diffs are not rendered by default.

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: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.179057bad5fafaf6a016.js"></script><script defer src="index.b6eb29f46e003ae8f9a4.js"></script><link href="index.5c5477c3e81eb95e1456.css" rel="stylesheet"></head>
<script defer src="vendors.3c43b45d3e9e7cbf9863.js"></script><script defer src="index.4e92fe096c8c41ecf7ea.js"></script><link href="index.7f54bf0dcbb9dc626487.css" rel="stylesheet"></head>

<body>
<div id="app"></div>
Expand Down
2 changes: 1 addition & 1 deletion connect_ext_ppr/static/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap" rel="stylesheet">
<title>Settings</title>
<script defer src="vendors.179057bad5fafaf6a016.js"></script><script defer src="settings.bd5ea671e480c7aabff3.js"></script><link href="settings.228c534170f31239141d.css" rel="stylesheet"></head>
<script defer src="vendors.3c43b45d3e9e7cbf9863.js"></script><script defer src="settings.bd5ea671e480c7aabff3.js"></script><link href="settings.228c534170f31239141d.css" rel="stylesheet"></head>

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

158 changes: 158 additions & 0 deletions ui/src/components/CheckboxTable.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
<template lang="pug">
.checkbox-table
p.checkbox-table__title {{ title }}

c-search.checkbox-table__search(v-model="localSearch")

c-data-table.checkbox-table__table(
:value="computedItems",
:headers="processedHeaders",
:prepare-row="prepareRow",
:updating="loading",
hide-all-pagination-sections,
fix-layout,
)
template(#items="{ item, row, visibleHeaders }")
tr.table__row.hoverable
template(v-if="item.type === 'all'")
td(
v-for="(header, index) in visibleHeaders"
:key="header.value",
)
span(v-if="index === 0") All
c-checkbox(
v-if="header.value === 'radio'"
v-model="localIsAllSelected",
)

template(v-else)
td(
v-for="header in visibleHeaders"
:key="header.value",
)
c-checkbox(
v-if="header.value === 'radio'"
:value="localValue.includes(row[valueProp])",
@input="toggleSelected(row[valueProp])",
)
slot(
v-else,
:name="header.value",
:row="row",
)

</template>

<script>
import cDataTable from '~components/cDataTable.vue';
import cCheckbox from '~components/cCheckbox.vue';
import cSearch from '~components/cSearch.vue';

import sync from '~mixins/sync';


export default {
mixins: [sync([
{ prop: 'value', local: 'localValue' },
{ prop: 'search', local: 'localSearch' },
{ prop: 'isAllSelected', local: 'localIsAllSelected' },
])],

components: {
cDataTable,
cCheckbox,
cSearch,
},

props: {
value: {
type: Array,
default: () => [],
},

valueProp: {
type: String,
default: 'id',
},

loading: Boolean,
title: String,
prepareRow: Function,
headers: {
type: Array,
required: true,
},

includeAll: Boolean,
isAllSelected: Boolean,
items: {
type: Array,
default: () => [],
},

search: String,
},

data: () => ({
localValue: [],
localSearch: '',
localIsAllSelected: false,
}),

computed: {
processedHeaders: ({ headers }) => [
...headers,
{
notResizable: true,
text: '',
value: 'radio',
width: 80,
},
],

computedItems: ({ items, includeAll }) => {
if (includeAll) return [{ type: 'all' }, ...items];

return items;
},
},

methods: {
toggleSelected(value) {
const index = this.localValue.indexOf(value);

if (index > -1) {
this.localValue.splice(index, 1);
} else {
this.localValue.push(value);
}
},
},

watch: {
isAllSelected(v) {
if (v) {
this.localValue = this.items.map(item => item[this.valueProp]);
} else {
this.localValue = [];
}
},
},
};

</script>

<style lang="stylus" scoped>
.checkbox-table {
&__title {
font-size: 18px;
font-weight: 500;
line-height: 24px;
margin-bottom: 24px;
}

&__search {
margin-bottom: 12px;
}
}
</style>
Loading