Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Web report containing a complex javascript code fails 2023.1 #2017

Merged
merged 2 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 3 additions & 20 deletions frontend-html/src/gui/connections/CScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ import { ErrorBoundaryEncapsulated } from "gui/Components/Utilities/ErrorBoundar
import { IFormScreenEnvelope } from "model/entities/types/IFormScreen";
import { onIFrameClick } from "model/actions/WebScreen/onIFrameClick";
import { onScreenTabCloseClick } from "model/actions-ui/ScreenTabHandleRow/onScreenTabCloseClick";
import { getApi } from "model/selectors/getApi";

const WebScreenComposite: React.FC<{ openedScreen: IOpenedScreen }> = observer((props) => {
const {openedScreen} = props;
const [isLoading, setLoading] = useState(false);
const [source, setSource] = useState("");
const refIFrame = useRef<any>(null);

const setTabTitleFromIFrame = useMemo(
Expand All @@ -48,28 +46,13 @@ const WebScreenComposite: React.FC<{ openedScreen: IOpenedScreen }> = observer((
},
[openedScreen]
);
function loadInternalApiDataWithAuthentication() {
const fetchData = async () => {
if (!openedScreen.screenUrl) {
return;
}
if (1){
setSource(openedScreen.screenUrl);
return;
}
const api = getApi(props.openedScreen);
const url = openedScreen.screenUrl.replace("internalApi/", "")
const content = await api.callUserApi(url);
setSource(URL.createObjectURL(content));
}
fetchData().catch(error => console.error(error));
}

useEffect(() => {
if (openedScreen.screenUrl) {
setLoading(true);
}
loadInternalApiDataWithAuthentication();
}, []); // eslint-disable-line react-hooks/exhaustive-deps

useEffect(() => {
const handle = setInterval(() => {
setTabTitleFromIFrame();
Expand Down Expand Up @@ -118,7 +101,7 @@ const WebScreenComposite: React.FC<{ openedScreen: IOpenedScreen }> = observer((
return (
<Screen isHidden={!getIsTopmostNonDialogScreen(openedScreen)}>
<WebScreen
source={source || ""}
source={openedScreen.screenUrl ?? ""}
isLoading={isLoading}
onLoad={(event: any) => {
event.persist();
Expand Down
7 changes: 0 additions & 7 deletions frontend-html/src/model/entities/OrigamAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -872,13 +872,6 @@ export class OrigamAPI implements IApi {
fileDownload(response.data, fileName);
}

async callUserApi(screenUrl: string): Promise<Blob>{
return (await this.axiosInstance.get(
screenUrl,
{ responseType: 'blob'}))
.data;
}

async getMenuIdByReference(data: { Category: string; ReferenceId: any }): Promise<string> {
return (await this.axiosInstance.post(`/DeepLink/GetMenuId`, data)).data;
}
Expand Down
2 changes: 0 additions & 2 deletions frontend-html/src/model/entities/types/IApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,6 @@ export interface IApi {
RowIds: any[];
LazyLoadedEntityInput: ILazyLoadedEntityInput | undefined;
}): Promise<any>;

callUserApi(screenUrl: string): Promise<Blob>;
}

export interface ILazyLoadedEntityInput {
Expand Down