3
0

Adjust compose resource list UX

This commit is contained in:
Jože Fortun 2023-02-27 13:43:43 +01:00
parent 16a8a98770
commit b14412c69d
8 changed files with 435 additions and 412 deletions

View File

@ -6,7 +6,7 @@
:data="{children:list}" :data="{children:list}"
tag="ul" tag="ul"
mixin-parent-key="parent" mixin-parent-key="parent"
class="list-group pb-3" class="list-group"
@changePosition="handleChangePosition" @changePosition="handleChangePosition"
> >
<template <template

View File

@ -10,7 +10,7 @@ export default {
filter: {}, filter: {},
pagination: { pagination: {
limit: 12, limit: 100,
pageCursor: undefined, pageCursor: undefined,
prevPage: '', prevPage: '',
nextPage: '', nextPage: '',

View File

@ -1,12 +1,12 @@
<template> <template>
<div class="py-3"> <b-container
fluid="xl"
class="d-flex flex-column py-3"
>
<portal to="topbar-title"> <portal to="topbar-title">
{{ $t('navigation.chart') }} {{ $t('navigation.chart') }}
</portal> </portal>
<b-container fluid="xl">
<b-row no-gutters>
<b-col>
<c-resource-list <c-resource-list
:primary-key="primaryKey" :primary-key="primaryKey"
:filter="filter" :filter="filter"
@ -25,6 +25,8 @@
nextPagination: $t('general:resourceList.pagination.next'), nextPagination: $t('general:resourceList.pagination.next'),
}" }"
clickable clickable
sticky-header
class="h-100"
@search="filterList" @search="filterList"
@row-clicked="handleRowClicked" @row-clicked="handleRowClicked"
> >
@ -83,24 +85,24 @@
</template> </template>
<template #actions="{ item: c }"> <template #actions="{ item: c }">
<b-button-group>
<c-permissions-button <c-permissions-button
v-if="c.canGrant" v-if="c.canGrant"
:title="c.name || c.handle || c.chartID" :title="c.name || c.handle || c.chartID"
:target="c.name || c.handle || c.chartID" :target="c.name || c.handle || c.chartID"
:resource="`corteza::compose:chart/${namespace.namespaceID}/${c.chartID}`" :resource="`corteza::compose:chart/${namespace.namespaceID}/${c.chartID}`"
link :tooltip="$t('permissions:resources.compose.chart.tooltip')"
class="btn px-2" button-variant="outline-light"
class="text-dark d-print-none border-0"
/> />
</b-button-group>
</template> </template>
<template #changedAt="{ item }"> <template #changedAt="{ item }">
{{ (item.deletedAt || item.updatedAt || item.createdAt) | locFullDateTime }} {{ (item.deletedAt || item.updatedAt || item.createdAt) | locFullDateTime }}
</template> </template>
</c-resource-list> </c-resource-list>
</b-col>
</b-row>
</b-container> </b-container>
</div>
</template> </template>
<script> <script>
import { mapGetters, mapActions } from 'vuex' import { mapGetters, mapActions } from 'vuex'

View File

@ -1,12 +1,12 @@
"<template> "<template>
<div class="py-3"> <b-container
fluid="xl"
class="d-flex flex-column py-3"
>
<portal to="topbar-title"> <portal to="topbar-title">
{{ $t('navigation.module') }} {{ $t('navigation.module') }}
</portal> </portal>
<b-container fluid="xl">
<b-row>
<b-col>
<c-resource-list <c-resource-list
data-test-id="table-modules-list" data-test-id="table-modules-list"
:primary-key="primaryKey" :primary-key="primaryKey"
@ -26,6 +26,8 @@
nextPagination: $t('general:resourceList.pagination.next'), nextPagination: $t('general:resourceList.pagination.next'),
}" }"
clickable clickable
sticky-header
class="h-100"
@search="filterList" @search="filterList"
@row-clicked="handleRowClicked" @row-clicked="handleRowClicked"
> >
@ -108,23 +110,32 @@
:namespace="namespace" :namespace="namespace"
:module="m" :module="m"
/> />
<b-button-group
class="ml-2"
>
<b-button <b-button
data-test-id="button-all-records" data-test-id="button-all-records"
variant="link" variant="outline-light"
:title="$t('allRecords.label')"
:to="{name: 'admin.modules.record.list', params: { moduleID: m.moduleID }}" :to="{name: 'admin.modules.record.list', params: { moduleID: m.moduleID }}"
class="text-dark text-decoration-none" class="text-primary d-print-none border-0"
> >
{{ $t('allRecords.label') }} <font-awesome-icon
:icon="['fas', 'columns']"
/>
</b-button> </b-button>
<c-permissions-button <c-permissions-button
v-if="m.canGrant" v-if="m.canGrant"
:title="m.name || m.handle || m.moduleID" :title="m.name || m.handle || m.moduleID"
:target="m.name || m.handle || m.moduleID" :target="m.name || m.handle || m.moduleID"
:resource="`corteza::compose:module/${m.namespaceID}/${m.moduleID}`" :resource="`corteza::compose:module/${m.namespaceID}/${m.moduleID}`"
:tooltip="$t('permissions:resources.compose.module.tooltip')" :tooltip="$t('permissions:resources.compose.module.tooltip')"
class="btn px-2" button-variant="outline-light"
link class="text-dark d-print-none border-0"
/> />
</b-button-group>
</template> </template>
<template #name="{ item: m }"> <template #name="{ item: m }">
@ -150,10 +161,7 @@
{{ (item.deletedAt || item.updatedAt || item.createdAt) | locFullDateTime }} {{ (item.deletedAt || item.updatedAt || item.createdAt) | locFullDateTime }}
</template> </template>
</c-resource-list> </c-resource-list>
</b-col>
</b-row>
</b-container> </b-container>
</div>
</template> </template>
<script> <script>
import { mapGetters, mapActions } from 'vuex' import { mapGetters, mapActions } from 'vuex'

View File

@ -1,19 +1,19 @@
<template> <template>
<div class="py-3"> <b-container
fluid="xl"
class="d-flex flex-column py-3"
>
<portal to="topbar-title"> <portal to="topbar-title">
{{ $t('navigation.page') }} {{ $t('navigation.page') }}
</portal> </portal>
<b-container fluid="xl">
<b-row no-gutters>
<b-col>
<b-card <b-card
no-body no-body
class="shadow-sm" class="shadow-sm h-100"
> >
<b-card-header <b-card-header
header-bg-variant="white" header-bg-variant="white"
class="py-3" class="border-bottom"
> >
<b-row <b-row
no-gutters no-gutters
@ -56,23 +56,18 @@
/> />
</div> </div>
</b-row> </b-row>
</b-card-header>
<b-row <b-row
class="pages-list-header border-top align-content-center" class="align-content-center mt-2"
no-gutters
> >
<b-col <b-col
cols="12" cols="12"
class="pl-4"
> >
<span class="font-weight-bold"> <span class="text-muted font-italic">
{{ $t('newPlaceholder') }}
</span>
<span class="text-muted font-italic ml-3">
{{ $t('instructions') }} {{ $t('instructions') }}
</span> </span>
</b-col> </b-col>
</b-row> </b-row>
</b-card-header>
<div <div
v-if="processing" v-if="processing"
@ -90,14 +85,11 @@
v-else v-else
v-model="tree" v-model="tree"
:namespace="namespace" :namespace="namespace"
class="pb-2" class="card overflow-auto"
@reorder="handleReorder" @reorder="handleReorder"
/> />
</b-card> </b-card>
</b-col>
</b-row>
</b-container> </b-container>
</div>
</template> </template>
<script> <script>
@ -170,7 +162,7 @@ export default {
//!important usage to over-ride library styling //!important usage to over-ride library styling
$input-height: 42px; $input-height: 42px;
$content-height: 48px; $content-height: 48px;
$blank-li-height: 5px; $blank-li-height: 10px;
$left-padding: 5px; $left-padding: 5px;
$border-color: $light; $border-color: $light;
$hover-color: $gray-200; $hover-color: $gray-200;
@ -181,6 +173,10 @@ $dropping-color: $secondary;
} }
.sortable-tree { .sortable-tree {
.content {
height: 0px !important;
}
ul { ul {
.content { .content {
height: 100% !important; height: 100% !important;
@ -200,6 +196,10 @@ $dropping-color: $secondary;
&.blank-li { &.blank-li {
height: $blank-li-height !important; height: $blank-li-height !important;
.sortable-tree {
max-height: 100%;
}
&:nth-last-of-type(1)::before { &:nth-last-of-type(1)::before {
border-left-color: white !important; border-left-color: white !important;
height: 0; height: 0;

View File

@ -1,6 +1,7 @@
<template> <template>
<div <b-container
class="d-flex w-100 overflow-auto" fluid="xl"
class="d-flex flex-column py-3"
> >
<portal to="topbar-title"> <portal to="topbar-title">
{{ $t('title') }} {{ $t('title') }}
@ -22,15 +23,8 @@
</b-btn> </b-btn>
</portal> </portal>
<b-container
class="ns-wrapper"
fluid="xl"
>
<b-row
class="my-3"
no-gutters
>
<c-resource-list <c-resource-list
data-test-id="table-namespaces-list"
:primary-key="primaryKey" :primary-key="primaryKey"
:filter="filter" :filter="filter"
:sorting="sorting" :sorting="sorting"
@ -48,7 +42,8 @@
nextPagination: $t('general:resourceList.pagination.next'), nextPagination: $t('general:resourceList.pagination.next'),
}" }"
clickable clickable
class="h-100 w-100" sticky-header
class="h-100"
@search="filterList" @search="filterList"
@row-clicked="handleRowClicked" @row-clicked="handleRowClicked"
> >
@ -93,10 +88,22 @@
<template #changedAt="{ item }"> <template #changedAt="{ item }">
{{ (item.deletedAt || item.updatedAt || item.createdAt) | locFullDateTime }} {{ (item.deletedAt || item.updatedAt || item.createdAt) | locFullDateTime }}
</template> </template>
<template #actions="{ item: n }">
<b-button-group>
<c-permissions-button
v-if="n.canGrant"
:title="n.name || n.slug || n.namespaceID"
:target="n.name || n.slug || n.namespaceID"
:resource="`corteza::compose:namespace/${n.namespaceID}`"
:tooltip="$t('permissions:resources.compose.namespace.tooltip')"
button-variant="outline-light"
class="text-dark d-print-none border-0"
/>
</b-button-group>
</template>
</c-resource-list> </c-resource-list>
</b-row>
</b-container> </b-container>
</div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
@ -121,10 +128,6 @@ export default {
return { return {
primaryKey: 'namespaceID', primaryKey: 'namespaceID',
pagination: {
limit: 13,
},
filter: { filter: {
query: '', query: '',
}, },

View File

@ -51,18 +51,19 @@
id="resource-list" id="resource-list"
ref="resourceList" ref="resourceList"
head-variant="light" head-variant="light"
:fields="_fields"
:items="_items"
:sort-by.sync="sorting.sortBy"
:sort-desc.sync="sorting.sortDesc"
:sticky-header="stickyHeader"
:tbody-tr-class="tableRowClasses"
hover hover
responsive responsive
show-empty show-empty
no-sort-reset no-sort-reset
no-local-sorting no-local-sorting
:primary-key="primaryKey" :primary-key="primaryKey"
:sort-by.sync="sorting.sortBy" class="mh-100 h-100 mb-0"
:sort-desc.sync="sorting.sortDesc"
:items="_items"
:fields="_fields"
:tbody-tr-class="tableRowClasses"
class="mb-0"
@sort-changed="pagination.page = 1" @sort-changed="pagination.page = 1"
@row-clicked="$emit('row-clicked', $event)" @row-clicked="$emit('row-clicked', $event)"
> >
@ -137,7 +138,7 @@
</div> </div>
<b-button-group <b-button-group
v-if="!hidePagination" v-if="showPagination"
> >
<b-button <b-button
:disabled="!hasPrevPage" :disabled="!hasPrevPage"
@ -230,6 +231,10 @@ export default {
type: Boolean, type: Boolean,
}, },
stickyHeader: {
type: Boolean,
},
// Are rows clickable // Are rows clickable
clickable: { clickable: {
type: Boolean, type: Boolean,
@ -321,6 +326,10 @@ export default {
hasNextPage () { hasNextPage () {
return !!this.pagination.nextPage return !!this.pagination.nextPage
}, },
showPagination () {
return !this.hidePagination && (this.hasPrevPage || this.hasNextPage)
}
}, },
methods: { methods: {

View File

@ -38,6 +38,7 @@ resources:
chart: chart:
all: all charts all: all charts
specific: chart "{{target}}" specific: chart "{{target}}"
tooltip: Chart permissions
operations: operations:
delete: delete:
description: 'Default: deny' description: 'Default: deny'