mirror of https://github.com/buster-so/buster.git
share menu updates
This commit is contained in:
parent
c5fb34228f
commit
0e2b655653
|
@ -1,5 +1,5 @@
|
|||
import { type BusterShare, ShareAssetType, ShareRole } from '@/api/asset_interfaces';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { ShareMenuTopBar, ShareMenuTopBarOptions } from './ShareMenuTopBar';
|
||||
import { ShareMenuContentBody } from './ShareMenuContentBody';
|
||||
import { useMemoizedFn } from '@/hooks';
|
||||
|
|
|
@ -203,14 +203,14 @@ const ShareMenuContentShare: React.FC<{
|
|||
</div>
|
||||
)}
|
||||
|
||||
{hasUserTeams && (
|
||||
{/* {hasUserTeams && (
|
||||
<>
|
||||
<div className="bg-border my-2 h-[0.5px]" />
|
||||
{hasIndividualPermissions && <div className="bg-border my-2 h-[0.5px]" />}
|
||||
<ShareWithGroupAndTeamOption
|
||||
onOpenShareWithGroupAndTeam={onOpenShareWithGroupAndTeam}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
)} */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ const ShareWithGroupAndTeamOption: React.FC<{
|
|||
return (
|
||||
<div
|
||||
onClick={onOpenShareWithGroupAndTeam}
|
||||
className={cn('hover:bg-item-hover flex cursor-pointer items-center space-x-1.5 px-3 py-2')}>
|
||||
className={cn('hover:bg-item-hover flex cursor-pointer items-center space-x-1.5')}>
|
||||
<Button prefix={<UserGroup />} />
|
||||
<div className={cn('flex w-full items-center justify-between space-x-1.5')}>
|
||||
<Text>Share with groups & teams</Text>
|
||||
|
|
|
@ -30,6 +30,7 @@ export const MetricContainerHeaderButtons: React.FC<FileContainerButtonsProps> =
|
|||
<SaveToDashboardButton metricId={metricId} />
|
||||
<ShareMetricButton metricId={metricId} />
|
||||
<ThreeDotMenuButton metricId={metricId} />
|
||||
|
||||
<HideButtonContainer show={renderViewLayoutKey === 'file'}>
|
||||
<CreateChatButton />
|
||||
</HideButtonContainer>
|
||||
|
@ -78,7 +79,7 @@ const EditSQLButton = React.memo(() => {
|
|||
|
||||
return (
|
||||
<SelectableButton
|
||||
tooltipText="Edit SQL"
|
||||
tooltipText="SQL editor"
|
||||
icon={<SquareCode />}
|
||||
onClick={onClickButton}
|
||||
selected={isSelectedView}
|
||||
|
|
|
@ -36,7 +36,7 @@ import { ASSET_ICONS } from '@/components/features/config/assetIcons';
|
|||
import { useSaveToDashboardDropdownContent } from '@/components/features/dropdowns/SaveToDashboardDropdown';
|
||||
import { useMemoizedFn } from '@/hooks';
|
||||
import { useSaveToCollectionsDropdownContent } from '@/components/features/dropdowns/SaveToCollectionsDropdown';
|
||||
import { ShareAssetType, VerificationStatus } from '@/api/asset_interfaces/share';
|
||||
import { ShareAssetType, ShareRole, VerificationStatus } from '@/api/asset_interfaces/share';
|
||||
import { useStatusDropdownContent } from '@/components/features/metrics/StatusBadgeIndicator/StatusDropdownContent';
|
||||
import { StatusBadgeIndicator } from '@/components/features/metrics/StatusBadgeIndicator';
|
||||
import { useFavoriteStar } from '@/components/features/list/FavoriteStar';
|
||||
|
@ -432,20 +432,24 @@ const useRenameMetricSelectMenu = ({ metricId }: { metricId: string }) => {
|
|||
|
||||
export const useShareMenuSelectMenu = ({ metricId }: { metricId: string }) => {
|
||||
const { data: metric } = useGetMetric(metricId);
|
||||
const isOwner = metric?.permission === ShareRole.OWNER;
|
||||
|
||||
return useMemo(
|
||||
() => ({
|
||||
label: 'Share metric',
|
||||
value: 'share-metric',
|
||||
icon: <ShareRight />,
|
||||
items: [
|
||||
<ShareMenuContent
|
||||
key={metricId}
|
||||
shareAssetConfig={metric!}
|
||||
assetId={metricId}
|
||||
assetType={ShareAssetType.METRIC}
|
||||
/>
|
||||
]
|
||||
disabled: !isOwner,
|
||||
items: isOwner
|
||||
? [
|
||||
<ShareMenuContent
|
||||
key={metricId}
|
||||
shareAssetConfig={metric!}
|
||||
assetId={metricId}
|
||||
assetType={ShareAssetType.METRIC}
|
||||
/>
|
||||
]
|
||||
: undefined
|
||||
}),
|
||||
[metricId]
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue