Removed ability to share with API keys
This commit is contained in:
parent
68a777b230
commit
a464c3d1d4
4 changed files with 17 additions and 41 deletions
|
|
@ -44,7 +44,6 @@ export default function ShareModal({
|
||||||
const { hasApiKey, hasStore } = useContext(StoreContext);
|
const { hasApiKey, hasStore } = useContext(StoreContext);
|
||||||
const { setSuccessData, setErrorData } = useContext(alertContext);
|
const { setSuccessData, setErrorData } = useContext(alertContext);
|
||||||
const { reactFlowInstance } = useContext(typesContext);
|
const { reactFlowInstance } = useContext(typesContext);
|
||||||
const [checked, setChecked] = useState(false);
|
|
||||||
const [internalOpen, internalSetOpen] = useState(children ? false : true);
|
const [internalOpen, internalSetOpen] = useState(children ? false : true);
|
||||||
const [openConfirmationModal, setOpenConfirmationModal] = useState(false);
|
const [openConfirmationModal, setOpenConfirmationModal] = useState(false);
|
||||||
const nameComponent = is_component ? "component" : "flow";
|
const nameComponent = is_component ? "component" : "flow";
|
||||||
|
|
@ -99,16 +98,7 @@ export default function ShareModal({
|
||||||
const handleShareComponent = async (update = false) => {
|
const handleShareComponent = async (update = false) => {
|
||||||
//remove file names from flows before sharing
|
//remove file names from flows before sharing
|
||||||
removeFileNameFromComponents(component);
|
removeFileNameFromComponents(component);
|
||||||
const flow: FlowType = checked
|
const flow: FlowType = removeApiKeys({
|
||||||
? {
|
|
||||||
id: component!.id,
|
|
||||||
data: component!.data,
|
|
||||||
description,
|
|
||||||
name,
|
|
||||||
last_tested_version: version,
|
|
||||||
is_component: is_component,
|
|
||||||
}
|
|
||||||
: removeApiKeys({
|
|
||||||
id: component!.id,
|
id: component!.id,
|
||||||
data: component!.data,
|
data: component!.data,
|
||||||
description,
|
description,
|
||||||
|
|
@ -157,9 +147,7 @@ export default function ShareModal({
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleExportComponent = () => {
|
const handleExportComponent = () => {
|
||||||
if (!checked) {
|
|
||||||
component = removeApiKeys(component);
|
component = removeApiKeys(component);
|
||||||
}
|
|
||||||
downloadNode(component);
|
downloadNode(component);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -221,7 +209,7 @@ export default function ShareModal({
|
||||||
>
|
>
|
||||||
<span className="pr-2">Share</span>
|
<span className="pr-2">Share</span>
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name="Share2"
|
name="Share"
|
||||||
className="h-6 w-6 pl-1 text-foreground"
|
className="h-6 w-6 pl-1 text-foreground"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
/>
|
/>
|
||||||
|
|
@ -239,35 +227,21 @@ export default function ShareModal({
|
||||||
setSelectedTags={setSelectedTags}
|
setSelectedTags={setSelectedTags}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-5 flex items-center space-x-2">
|
<div className="mb-2 mt-5 flex items-center space-x-2">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id="public"
|
id="public"
|
||||||
checked={sharePublic}
|
checked={sharePublic}
|
||||||
onCheckedChange={(event: boolean) => {
|
onCheckedChange={(event: boolean) => {
|
||||||
setSharePublic(event);
|
setSharePublic(event);
|
||||||
setChecked(false);
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="public" className="export-modal-save-api text-sm ">
|
<label htmlFor="public" className="export-modal-save-api text-sm ">
|
||||||
Make {nameComponent} public
|
Make {nameComponent} public
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-3 flex items-center space-x-2">
|
|
||||||
<Checkbox
|
|
||||||
id="terms"
|
|
||||||
checked={checked}
|
|
||||||
onCheckedChange={(event: boolean) => {
|
|
||||||
setChecked(event);
|
|
||||||
}}
|
|
||||||
disabled={sharePublic}
|
|
||||||
/>
|
|
||||||
<label htmlFor="terms" className="export-modal-save-api text-sm ">
|
|
||||||
Save with my API keys
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<span className=" text-xs text-destructive ">
|
<span className=" text-xs text-destructive ">
|
||||||
Warning: Deselecting this box will exclusively eliminate API keys
|
<b>Warning:</b> The {nameComponent} will be shared without the API
|
||||||
from fields explicitly designated for API keys.
|
keys for its specific fields.
|
||||||
</span>
|
</span>
|
||||||
</BaseModal.Content>
|
</BaseModal.Content>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ export default function ExtraSidebar(): JSX.Element {
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name="Share2"
|
name="Share"
|
||||||
className={classNames(
|
className={classNames(
|
||||||
"side-bar-button-size",
|
"side-bar-button-size",
|
||||||
!hasApiKey || !validApiKey || !hasStore
|
!hasApiKey || !validApiKey || !hasStore
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ export default function NodeToolbarComponent({
|
||||||
>
|
>
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name="Share2"
|
name="Share"
|
||||||
className="relative top-0.5 mr-2 h-4 w-4"
|
className="relative top-0.5 mr-2 h-4 w-4"
|
||||||
/>{" "}
|
/>{" "}
|
||||||
Share{" "}
|
Share{" "}
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ import {
|
||||||
Scissors,
|
Scissors,
|
||||||
Search,
|
Search,
|
||||||
Settings2,
|
Settings2,
|
||||||
|
Share,
|
||||||
Share2,
|
Share2,
|
||||||
Shield,
|
Shield,
|
||||||
Sparkles,
|
Sparkles,
|
||||||
|
|
@ -358,6 +359,7 @@ export const nodeIconsLucide: iconsType = {
|
||||||
Maximize2,
|
Maximize2,
|
||||||
SaveAll,
|
SaveAll,
|
||||||
Share2,
|
Share2,
|
||||||
|
Share,
|
||||||
GitBranchPlus,
|
GitBranchPlus,
|
||||||
Loader2,
|
Loader2,
|
||||||
BookmarkPlus,
|
BookmarkPlus,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue