Skip to content

Commit a6238e8

Browse files
Merge pull request #343 from microsoft/vite_update
fix: Updated npm packages and vite version
2 parents f707954 + 8b84608 commit a6238e8

22 files changed

+1540
-1332
lines changed

App/frontend-app/.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

App/frontend-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"ts-node": "^10.9.2",
8989
"tslib": "^2.6.2",
9090
"typescript": "^5.8.2",
91-
"vite": "^6.2.0"
91+
"vite": "^6.2.6"
9292
},
9393
"volta": {
9494
"node": "18.16.0",

App/frontend-app/src/components/sidecarCopilot/sidecar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ export function SidecarCopilot({
164164
onSourceChange={handleSourceChange}
165165
disabled={disableSources}
166166
selectedDocuments={selectedDocuments}
167+
isSticky={false}
167168
/>
168169

169170
<CopilotProvider>
Lines changed: 118 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useCallback } from "react";
1+
import React, { useState, useCallback, useEffect } from "react";
22
import { useDropzone } from "react-dropzone";
33
import {
44
Button,
@@ -24,9 +24,22 @@ import { getFileTypeIconProps } from "@fluentui/react-file-type-icons";
2424
const UploadDocumentsDialog = () => {
2525
const [isOpen, setIsOpen] = useState(false);
2626
const [uploadingFiles, setUploadingFiles] = useState<
27-
{ name: string; progress: number; status: string; errorMsg:string }[]
27+
{ name: string; progress: number; status: string; errorMsg: string }[]
2828
>([]);
2929
const [isUploading, setIsUploading] = useState(false);
30+
const [isUploadBtnVisible, setIsUploadBtnVisible] = useState<boolean>(false);
31+
32+
33+
function toBoolean(value: unknown): boolean {
34+
return String(value).toLowerCase() === "true";
35+
}
36+
37+
useEffect(() => {
38+
if (import.meta.env.VITE_ENABLE_UPLOAD_BUTTON != undefined){
39+
const flag = import.meta.env.VITE_ENABLE_UPLOAD_BUTTON;
40+
setIsUploadBtnVisible(toBoolean(flag))
41+
}
42+
}, [import.meta.env.VITE_ENABLE_UPLOAD_BUTTON])
3043

3144
// Handle file drop and simulate upload
3245
const onDrop = useCallback(async (acceptedFiles: any[]) => {
@@ -35,7 +48,7 @@ const UploadDocumentsDialog = () => {
3548
name: file.name,
3649
progress: 0,
3750
status: "uploading",
38-
errorMsg : ""
51+
errorMsg: ""
3952
}));
4053
setUploadingFiles((prev) => [...prev, ...newFiles]);
4154

@@ -57,15 +70,15 @@ const UploadDocumentsDialog = () => {
5770
: f
5871
)
5972
);
60-
} catch (error:any) {
73+
} catch (error: any) {
6174
const errorMessage = error.message.replace(/^Error:\s*/, ""); // Remove "Error: " prefix
6275
const parsedError = JSON.parse(errorMessage);
6376

6477
// Update file status to error
6578
setUploadingFiles((prev) =>
6679
prev.map((f, index) =>
6780
index === prev.length - acceptedFiles.length + i
68-
? { ...f, progress: 100, status: "error", errorMsg: parsedError.summary}
81+
? { ...f, progress: 100, status: "error", errorMsg: parsedError.summary }
6982
: f
7083
)
7184
);
@@ -80,63 +93,63 @@ const UploadDocumentsDialog = () => {
8093
noKeyboard: true,
8194
});
8295

83-
return (
84-
<Dialog open={isOpen} onOpenChange={(event, data) => setIsOpen(data.open)}>
85-
<DialogTrigger>
86-
<Button icon={<ArrowUpload24Regular />} onClick={() => setIsOpen(true)}>
87-
Upload documents
88-
</Button>
89-
</DialogTrigger>
90-
91-
<DialogSurface>
92-
<DialogBody>
93-
<DialogTitle>
94-
Upload Documents
95-
<Button
96-
icon={<DismissRegular />}
97-
appearance="subtle"
98-
onClick={() => setIsOpen(false)}
99-
style={{ position: "absolute", right: 20, top: 20 }}
100-
/>
101-
</DialogTitle>
102-
103-
<DialogContent>
104-
{isUploading ? (
105-
<div style={{ textAlign: "center", padding: "40px 0" }}>
106-
<Icon
107-
{...getFileTypeIconProps({ extension: "pdf", size: 32, imageFileType: "svg" })}
108-
/>
109-
<p style={{ fontSize: "1.25rem" }}>Uploading documents...</p>
110-
</div>
111-
) : (
112-
<div
113-
{...getRootProps()}
114-
style={{
115-
border: "2px dashed #ccc",
116-
borderRadius: "4px",
117-
padding: "20px",
118-
textAlign: "center",
119-
marginBottom: "20px",
120-
}}
121-
>
122-
<input {...getInputProps()} />
123-
<CloudArrowUp24Regular
96+
return (<>
97+
{isUploadBtnVisible == true ?
98+
<Dialog open={isOpen} onOpenChange={(event, data) => setIsOpen(data.open)}>
99+
<DialogTrigger>
100+
<Button icon={<ArrowUpload24Regular />} onClick={() => setIsOpen(true)}>
101+
Upload documents
102+
</Button>
103+
</DialogTrigger>
104+
<DialogSurface>
105+
<DialogBody>
106+
<DialogTitle>
107+
Upload Documents
108+
<Button
109+
icon={<DismissRegular />}
110+
appearance="subtle"
111+
onClick={() => setIsOpen(false)}
112+
style={{ position: "absolute", right: 20, top: 20 }}
113+
/>
114+
</DialogTitle>
115+
116+
<DialogContent>
117+
{isUploading ? (
118+
<div style={{ textAlign: "center", padding: "40px 0" }}>
119+
<Icon
120+
{...getFileTypeIconProps({ extension: "pdf", size: 32, imageFileType: "svg" })}
121+
/>
122+
<p style={{ fontSize: "1.25rem" }}>Uploading documents...</p>
123+
</div>
124+
) : (
125+
<div
126+
{...getRootProps()}
124127
style={{
125-
fontSize: "48px",
126-
color: "#551A8B",
127-
marginBottom: "10px",
128+
border: "2px dashed #ccc",
129+
borderRadius: "4px",
130+
padding: "20px",
131+
textAlign: "center",
132+
marginBottom: "20px",
128133
}}
129-
/>
130-
<p>Drag and drop files</p>
131-
<p>or</p>
132-
<Button appearance="secondary" onClick={open}>
133-
Browse files
134-
</Button>
135-
</div>
136-
)}
134+
>
135+
<input {...getInputProps()} />
136+
<CloudArrowUp24Regular
137+
style={{
138+
fontSize: "48px",
139+
color: "#551A8B",
140+
marginBottom: "10px",
141+
}}
142+
/>
143+
<p>Drag and drop files</p>
144+
<p>or</p>
145+
<Button appearance="secondary" onClick={open}>
146+
Browse files
147+
</Button>
148+
</div>
149+
)}
137150

138-
{/* Upload link section */}
139-
{/* <div style={{ marginTop: "20px" }}>
151+
{/* Upload link section */}
152+
{/* <div style={{ marginTop: "20px" }}>
140153
<h3>Upload link</h3>
141154
<div style={{ display: "flex", alignItems: "center" }}>
142155
<input
@@ -160,54 +173,58 @@ const UploadDocumentsDialog = () => {
160173
</div>
161174
</div> */}
162175

163-
{/* File progress display */}
164-
{uploadingFiles.map((file, index) => (
165-
<div
166-
key={index}
167-
style={{
168-
marginTop: "20px",
169-
border: "1px solid #ccc",
170-
borderRadius: "4px",
171-
padding: "10px",
172-
}}
173-
>
176+
{/* File progress display */}
177+
{uploadingFiles.map((file, index) => (
174178
<div
179+
key={index}
175180
style={{
176-
display: "flex",
177-
alignItems: "center",
178-
justifyContent: "space-between",
181+
marginTop: "20px",
182+
border: "1px solid #ccc",
183+
borderRadius: "4px",
184+
padding: "10px",
179185
}}
180186
>
181-
<div style={{ display: "flex", alignItems: "center" }}>
182-
<Icon {...getFileTypeIconProps({ extension: "pdf", size: 32, imageFileType: "svg" })}/>
183-
<span>{file.name}</span>
187+
<div
188+
style={{
189+
display: "flex",
190+
alignItems: "center",
191+
justifyContent: "space-between",
192+
}}
193+
>
194+
<div style={{ display: "flex", alignItems: "center" }}>
195+
<Icon {...getFileTypeIconProps({ extension: "pdf", size: 32, imageFileType: "svg" })} />
196+
<span>{file.name}</span>
197+
</div>
198+
{file.status === "success" && (
199+
<CheckmarkCircle24Regular style={{ color: "green" }} />
200+
)}
201+
{file.status === "error" && (
202+
<DismissCircle24Regular style={{ color: "red" }} />
203+
)}
184204
</div>
185-
{file.status === "success" && (
186-
<CheckmarkCircle24Regular style={{ color: "green" }} />
187-
)}
188-
{file.status === "error" && (
189-
<DismissCircle24Regular style={{ color: "red" }} />
190-
)}
205+
<ProgressBar value={file.progress} />
206+
<span
207+
style={{
208+
color: file.status === "error" ? "red" : "inherit", // Apply red color only for error messages
209+
}}>
210+
{file.status === "uploading"
211+
? "Uploading..."
212+
: file.status === "success"
213+
? "Upload complete"
214+
: file.errorMsg}
215+
</span>
216+
<span>{ }</span>
191217
</div>
192-
<ProgressBar value={file.progress} />
193-
<span
194-
style={{
195-
color: file.status === "error" ? "red" : "inherit", // Apply red color only for error messages
196-
}}>
197-
{file.status === "uploading"
198-
? "Uploading..."
199-
: file.status === "success"
200-
? "Upload complete"
201-
: file.errorMsg}
202-
</span>
203-
<span>{}</span>
204-
</div>
205-
))}
206-
</DialogContent>
207-
</DialogBody>
208-
</DialogSurface>
209-
</Dialog>
210-
);
218+
))}
219+
</DialogContent>
220+
</DialogBody>
221+
</DialogSurface>
222+
</Dialog> : <></>
223+
}
224+
</>
225+
)
226+
227+
211228
};
212229

213230
export default UploadDocumentsDialog;

App/frontend-app/src/types/searchRequest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export interface SearchRequest {
33
searchFacets: SearchFacet[];
44
currentPage: number;
55
incomingFilter: string;
6-
filters?: string[];
6+
filters?: { [key: string]: string };
77
parameters: {
88
scoringProfile: string;
99
inOrderBy: string[];

App/frontend-app/src/vite-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
interface ImportMetaEnv {
44
VITE_API_ENDPOINT: string
5+
VITE_ENABLE_UPLOAD_BUTTON : string
56
// Add other environment variables here
67
}
78

0 commit comments

Comments
 (0)