update sidebar styling and fix bugs
This commit is contained in:
parent
356d6525e8
commit
7bb9829165
|
@ -2,4 +2,4 @@
|
||||||
export let value
|
export let value
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>{value.name}</div>
|
<div>{value?.name || "N/A"}</div>
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<script>
|
<script>
|
||||||
import { Avatar } from "@budibase/bbui"
|
import { Avatar, Tooltip } from "@budibase/bbui"
|
||||||
export let row
|
export let row
|
||||||
|
|
||||||
|
let showTooltip
|
||||||
const getInitials = user => {
|
const getInitials = user => {
|
||||||
let initials = ""
|
let initials = ""
|
||||||
initials += user.firstName ? user.firstName[0] : ""
|
initials += user.firstName ? user.firstName[0] : ""
|
||||||
|
@ -11,4 +12,34 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Avatar size="M" initials={getInitials(row.user)} />
|
<div
|
||||||
|
class="container"
|
||||||
|
on:mouseover={() => (showTooltip = true)}
|
||||||
|
on:focus={() => (showTooltip = true)}
|
||||||
|
on:mouseleave={() => (showTooltip = false)}
|
||||||
|
>
|
||||||
|
<Avatar size="M" initials={getInitials(row.user)} />
|
||||||
|
</div>
|
||||||
|
{#if showTooltip}
|
||||||
|
<div class="tooltip">
|
||||||
|
<Tooltip textWrapping text={row.user.email} direction="bottom" />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.container {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.tooltip {
|
||||||
|
z-index: 1;
|
||||||
|
position: absolute;
|
||||||
|
top: 85%;
|
||||||
|
left: calc(90% - 8px);
|
||||||
|
transform: translateX(-100%) translateY(-50%);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-end;
|
||||||
|
width: 130px;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
clickOutside,
|
clickOutside,
|
||||||
CoreTextArea,
|
CoreTextArea,
|
||||||
DatePicker,
|
DatePicker,
|
||||||
|
Pagination,
|
||||||
|
Divider,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { licensing, users, apps, auditLogs } from "stores/portal"
|
import { licensing, users, apps, auditLogs } from "stores/portal"
|
||||||
import LockedFeature from "../../_components/LockedFeature.svelte"
|
import LockedFeature from "../../_components/LockedFeature.svelte"
|
||||||
|
@ -62,16 +64,15 @@
|
||||||
let startDate, endDate
|
let startDate, endDate
|
||||||
|
|
||||||
$: fetchUsers(userPage, userSearchTerm)
|
$: fetchUsers(userPage, userSearchTerm)
|
||||||
$: fetchLogs(
|
$: fetchLogs({
|
||||||
logsPage,
|
logsPage,
|
||||||
logSearchTerm,
|
logSearchTerm,
|
||||||
startDate,
|
startDate,
|
||||||
endDate,
|
endDate,
|
||||||
selectedUsers,
|
selectedUsers,
|
||||||
selectedApps,
|
selectedApps,
|
||||||
selectedEvents
|
selectedEvents,
|
||||||
)
|
})
|
||||||
|
|
||||||
$: userPage = $userPageInfo.page
|
$: userPage = $userPageInfo.page
|
||||||
$: logsPage = $logsPageInfo.page
|
$: logsPage = $logsPageInfo.page
|
||||||
|
|
||||||
|
@ -97,38 +98,38 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchLogs = async (
|
const fetchLogs = async ({
|
||||||
logsPage,
|
logsPage,
|
||||||
search,
|
logSearchTerm,
|
||||||
startDate,
|
startDate,
|
||||||
endDate,
|
endDate,
|
||||||
selectedUsers,
|
selectedUsers,
|
||||||
selectedApps,
|
selectedApps,
|
||||||
selectedEvents
|
selectedEvents,
|
||||||
) => {
|
}) => {
|
||||||
if ($logsPageInfo.loading) {
|
if ($logsPageInfo.loading) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// need to remove the page if they've started searching
|
// need to remove the page if they've started searching
|
||||||
if (search && !prevLogSearch) {
|
if (logSearchTerm && !prevLogSearch) {
|
||||||
logsPageInfo.reset()
|
logsPageInfo.reset()
|
||||||
logsPage = undefined
|
logsPage = undefined
|
||||||
}
|
}
|
||||||
prevLogSearch = search
|
prevLogSearch = logSearchTerm
|
||||||
try {
|
try {
|
||||||
logsPageInfo.loading()
|
logsPageInfo.loading()
|
||||||
await auditLogs.search({
|
await auditLogs.search({
|
||||||
logsPage,
|
bookmark: logsPage,
|
||||||
startDate,
|
startDate,
|
||||||
endDate,
|
endDate,
|
||||||
metadataSearch: search,
|
fullSearch: logSearchTerm,
|
||||||
userIds: selectedUsers,
|
userIds: selectedUsers,
|
||||||
appIds: selectedApps,
|
appIds: selectedApps,
|
||||||
events: selectedEvents,
|
events: selectedEvents,
|
||||||
})
|
})
|
||||||
logsPageInfo.fetched(
|
logsPageInfo.fetched(
|
||||||
$auditLogs.logs.hasNextPage,
|
$auditLogs.logs.hasNextPage,
|
||||||
$auditLogs.logs.nextPage
|
$auditLogs.logs.bookmark
|
||||||
)
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
@ -161,6 +162,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const viewDetails = detail => {
|
const viewDetails = detail => {
|
||||||
|
console.log(detail)
|
||||||
selectedLog = detail
|
selectedLog = detail
|
||||||
sidePanelVisible = true
|
sidePanelVisible = true
|
||||||
}
|
}
|
||||||
|
@ -206,9 +208,15 @@
|
||||||
range={true}
|
range={true}
|
||||||
label="Date Range"
|
label="Date Range"
|
||||||
on:change={e => {
|
on:change={e => {
|
||||||
if (e.detail[0].length > 1) {
|
console.log(e)
|
||||||
|
if (e.detail[0]?.length === 1) {
|
||||||
|
startDate = e.detail[0][0].toISOString()
|
||||||
|
} else if (e.detail[0]?.length > 1) {
|
||||||
startDate = e.detail[0][0].toISOString()
|
startDate = e.detail[0][0].toISOString()
|
||||||
endDate = e.detail[0][1].toISOString()
|
endDate = e.detail[0][1].toISOString()
|
||||||
|
} else {
|
||||||
|
startDate = null
|
||||||
|
endDate = null
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -258,14 +266,23 @@
|
||||||
</div>
|
</div>
|
||||||
<Layout noPadding>
|
<Layout noPadding>
|
||||||
<Table
|
<Table
|
||||||
|
on:click={({ detail }) => viewDetails(detail)}
|
||||||
{customRenderers}
|
{customRenderers}
|
||||||
on:click={viewDetails}
|
|
||||||
data={$auditLogs.logs.data}
|
data={$auditLogs.logs.data}
|
||||||
allowEditColumns={false}
|
allowEditColumns={false}
|
||||||
allowEditRows={false}
|
allowEditRows={false}
|
||||||
allowSelectRows={false}
|
allowSelectRows={false}
|
||||||
{schema}
|
{schema}
|
||||||
/>
|
/>
|
||||||
|
<div class="pagination">
|
||||||
|
<Pagination
|
||||||
|
page={$logsPageInfo.pageNumber}
|
||||||
|
hasPrevPage={$logsPageInfo.loading ? false : $logsPageInfo.hasPrevPage}
|
||||||
|
hasNextPage={$logsPageInfo.loading ? false : $logsPageInfo.hasNextPage}
|
||||||
|
goToPrevPage={logsPageInfo.prevPage}
|
||||||
|
goToNextPage={logsPageInfo.nextPage}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
</LockedFeature>
|
</LockedFeature>
|
||||||
|
|
||||||
|
@ -298,7 +315,9 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="padding-top: 10px; height: 95%">
|
<Divider />
|
||||||
|
|
||||||
|
<div class="side-panel-body">
|
||||||
<CoreTextArea
|
<CoreTextArea
|
||||||
disabled
|
disabled
|
||||||
minHeight={"300px"}
|
minHeight={"300px"}
|
||||||
|
@ -312,16 +331,28 @@
|
||||||
<style>
|
<style>
|
||||||
.side-panel-header {
|
.side-panel-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
padding: 20px 10px 10px 10px;
|
||||||
gap: var(--spacing-s);
|
gap: var(--spacing-s);
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pagination {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: var(--spacing-xl);
|
||||||
|
}
|
||||||
|
|
||||||
|
.side-panel-body {
|
||||||
|
padding: 10px;
|
||||||
|
height: 95%;
|
||||||
|
}
|
||||||
#side-panel {
|
#side-panel {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
padding: 24px;
|
padding-bottom: 24px;
|
||||||
background: var(--background);
|
background: var(--background);
|
||||||
border-left: var(--border-light);
|
border-left: var(--border-light);
|
||||||
width: 320px;
|
width: 320px;
|
||||||
|
@ -330,7 +361,7 @@
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
transform: translateX(100%);
|
transform: translateX(100%);
|
||||||
transition: transform 130ms ease-in-out;
|
transition: transform 130ms ease-in-out;
|
||||||
height: calc(100% - 48px);
|
height: calc(100% - 25px);
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
#side-panel.visible {
|
#side-panel.visible {
|
||||||
|
|
|
@ -26,8 +26,6 @@ export function createAuditLogsStore() {
|
||||||
update(state => {
|
update(state => {
|
||||||
return { ...state, ...events }
|
return { ...state, ...events }
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(events)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function downloadLogs(opts = {}) {
|
async function downloadLogs(opts = {}) {
|
||||||
|
|
|
@ -1,32 +1,39 @@
|
||||||
const buildOpts = ({
|
const buildOpts = ({
|
||||||
|
bookmark,
|
||||||
userIds,
|
userIds,
|
||||||
appIds,
|
appIds,
|
||||||
startDate,
|
startDate,
|
||||||
endDate,
|
endDate,
|
||||||
metadataSearch,
|
fullSearch,
|
||||||
events,
|
events,
|
||||||
}) => {
|
}) => {
|
||||||
const opts = {}
|
const opts = {}
|
||||||
|
|
||||||
|
if (bookmark) {
|
||||||
|
opts.bookmark = bookmark
|
||||||
|
}
|
||||||
|
|
||||||
if (startDate && endDate) {
|
if (startDate && endDate) {
|
||||||
opts.startDate = startDate
|
opts.startDate = startDate
|
||||||
opts.endDate = endDate
|
opts.endDate = endDate
|
||||||
|
} else if (startDate && !endDate) {
|
||||||
|
opts.startDate = startDate
|
||||||
}
|
}
|
||||||
|
|
||||||
if (metadataSearch) {
|
if (fullSearch) {
|
||||||
opts.metadataSearch = metadataSearch
|
opts.fullSearch = fullSearch
|
||||||
}
|
}
|
||||||
|
|
||||||
if (events) {
|
if (events.length) {
|
||||||
opts.event = events
|
opts.events = events
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userIds) {
|
if (userIds.length) {
|
||||||
opts.userId = userIds
|
opts.userIds = userIds
|
||||||
}
|
}
|
||||||
|
|
||||||
if (appIds) {
|
if (appIds.length) {
|
||||||
opts.appId = appIds
|
opts.appIds = appIds
|
||||||
}
|
}
|
||||||
|
|
||||||
return opts
|
return opts
|
||||||
|
|
Loading…
Reference in New Issue