mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-02-16 17:25:58 +00:00
[Query Copilot] Dropdown hide and buttons disabled in specific occasions (#1534)
Co-authored-by: Predrag Klepic <v-prklepic@microsoft.com>
This commit is contained in:
parent
fb6eb635c1
commit
53cd78452b
@ -491,7 +491,7 @@ function createOpenTerminalButton(container: Explorer): CommandButtonComponentPr
|
|||||||
onCommandClick: () => container.openNotebookTerminal(ViewModels.TerminalKind.Default),
|
onCommandClick: () => container.openNotebookTerminal(ViewModels.TerminalKind.Default),
|
||||||
commandButtonLabel: label,
|
commandButtonLabel: label,
|
||||||
hasPopup: false,
|
hasPopup: false,
|
||||||
disabled: false,
|
disabled: useSelectedNode.getState().isQueryCopilotCollectionSelected(),
|
||||||
ariaLabel: label,
|
ariaLabel: label,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -246,6 +246,7 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
|
|||||||
commandButtonLabel: executeQueryBtnLabel,
|
commandButtonLabel: executeQueryBtnLabel,
|
||||||
ariaLabel: executeQueryBtnLabel,
|
ariaLabel: executeQueryBtnLabel,
|
||||||
hasPopup: false,
|
hasPopup: false,
|
||||||
|
disabled: query?.trim() === "",
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveQueryBtn = {
|
const saveQueryBtn = {
|
||||||
@ -256,6 +257,7 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
|
|||||||
commandButtonLabel: "Save Query",
|
commandButtonLabel: "Save Query",
|
||||||
ariaLabel: "Save Query",
|
ariaLabel: "Save Query",
|
||||||
hasPopup: false,
|
hasPopup: false,
|
||||||
|
disabled: query?.trim() === "",
|
||||||
};
|
};
|
||||||
|
|
||||||
const samplePromptsBtn = {
|
const samplePromptsBtn = {
|
||||||
@ -393,6 +395,8 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
|
|||||||
))}
|
))}
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
|
{filteredSuggestedPrompts?.length > 0 && (
|
||||||
|
<Stack>
|
||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
@ -418,6 +422,10 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
|
|||||||
{prompt.text}
|
{prompt.text}
|
||||||
</DefaultButton>
|
</DefaultButton>
|
||||||
))}
|
))}
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
{(filteredHistories?.length > 0 || filteredSuggestedPrompts?.length > 0) && (
|
||||||
|
<Stack>
|
||||||
<Separator
|
<Separator
|
||||||
styles={{
|
styles={{
|
||||||
root: {
|
root: {
|
||||||
@ -440,6 +448,8 @@ export const QueryCopilotTab: React.FC<QueryCopilotTabProps> = ({
|
|||||||
</Link>
|
</Link>
|
||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
</Callout>
|
</Callout>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
@ -823,7 +823,7 @@ export default class DocumentsTab extends TabsBase {
|
|||||||
commandButtonLabel: label,
|
commandButtonLabel: label,
|
||||||
ariaLabel: label,
|
ariaLabel: label,
|
||||||
hasPopup: false,
|
hasPopup: false,
|
||||||
disabled: !this.newDocumentButton.enabled(),
|
disabled: !this.newDocumentButton.enabled() || useSelectedNode.getState().isQueryCopilotCollectionSelected(),
|
||||||
id: "mongoNewDocumentBtn",
|
id: "mongoNewDocumentBtn",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -837,7 +837,8 @@ export default class DocumentsTab extends TabsBase {
|
|||||||
commandButtonLabel: label,
|
commandButtonLabel: label,
|
||||||
ariaLabel: label,
|
ariaLabel: label,
|
||||||
hasPopup: false,
|
hasPopup: false,
|
||||||
disabled: !this.saveNewDocumentButton.enabled(),
|
disabled:
|
||||||
|
!this.saveNewDocumentButton.enabled() || useSelectedNode.getState().isQueryCopilotCollectionSelected(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -850,7 +851,9 @@ export default class DocumentsTab extends TabsBase {
|
|||||||
commandButtonLabel: label,
|
commandButtonLabel: label,
|
||||||
ariaLabel: label,
|
ariaLabel: label,
|
||||||
hasPopup: false,
|
hasPopup: false,
|
||||||
disabled: !this.discardNewDocumentChangesButton.enabled(),
|
disabled:
|
||||||
|
!this.discardNewDocumentChangesButton.enabled() ||
|
||||||
|
useSelectedNode.getState().isQueryCopilotCollectionSelected(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,7 +866,8 @@ export default class DocumentsTab extends TabsBase {
|
|||||||
commandButtonLabel: label,
|
commandButtonLabel: label,
|
||||||
ariaLabel: label,
|
ariaLabel: label,
|
||||||
hasPopup: false,
|
hasPopup: false,
|
||||||
disabled: !this.saveExistingDocumentButton.enabled(),
|
disabled:
|
||||||
|
!this.saveExistingDocumentButton.enabled() || useSelectedNode.getState().isQueryCopilotCollectionSelected(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -876,7 +880,9 @@ export default class DocumentsTab extends TabsBase {
|
|||||||
commandButtonLabel: label,
|
commandButtonLabel: label,
|
||||||
ariaLabel: label,
|
ariaLabel: label,
|
||||||
hasPopup: false,
|
hasPopup: false,
|
||||||
disabled: !this.discardExisitingDocumentChangesButton.enabled(),
|
disabled:
|
||||||
|
!this.discardExisitingDocumentChangesButton.enabled() ||
|
||||||
|
useSelectedNode.getState().isQueryCopilotCollectionSelected(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -889,7 +895,9 @@ export default class DocumentsTab extends TabsBase {
|
|||||||
commandButtonLabel: label,
|
commandButtonLabel: label,
|
||||||
ariaLabel: label,
|
ariaLabel: label,
|
||||||
hasPopup: false,
|
hasPopup: false,
|
||||||
disabled: !this.deleteExisitingDocumentButton.enabled(),
|
disabled:
|
||||||
|
!this.deleteExisitingDocumentButton.enabled() ||
|
||||||
|
useSelectedNode.getState().isQueryCopilotCollectionSelected(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -933,7 +941,9 @@ export default class DocumentsTab extends TabsBase {
|
|||||||
commandButtonLabel: label,
|
commandButtonLabel: label,
|
||||||
ariaLabel: label,
|
ariaLabel: label,
|
||||||
hasPopup: true,
|
hasPopup: true,
|
||||||
disabled: useSelectedNode.getState().isDatabaseNodeOrNoneSelected(),
|
disabled:
|
||||||
|
useSelectedNode.getState().isDatabaseNodeOrNoneSelected() ||
|
||||||
|
useSelectedNode.getState().isQueryCopilotCollectionSelected(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user