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