Skip to content

Commit

Permalink
fix(admin-ui): agama projects are not deploying properly (#1977)
Browse files Browse the repository at this point in the history
fix: agama projects are not deploying properly
  • Loading branch information
mjatin-dev authored Jan 27, 2025
1 parent 6df74ea commit c3b2cda
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions admin-ui/plugins/auth-server/components/Agama/AgamaListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ function AgamaListPage() {
});
}

const convertFileFrombase64 = (base64String) => {
// Decode Base64 string to a Uint8Array
const byteCharacters = atob(base64String);
const byteArray = new Uint8Array(byteCharacters.length);

// Fill the Uint8Array with the byte values
for (let i = 0; i < byteCharacters.length; i++) {
byteArray[i] = byteCharacters.charCodeAt(i);
}
return byteArray;
};

async function fetchRespositoryData() {
try {
dispatch(getAgamaRepository());
Expand All @@ -110,10 +122,9 @@ function AgamaListPage() {
dispatch(getJsonConfig({ action: {} }));
}
}, []);

useEffect(() => {
if (agamaFileResponse) {
const byteArray = new Uint8Array(agamaFileResponse);
const byteArray = convertFileFrombase64(agamaFileResponse);
let object = {
name: projectName,
file: byteArray,
Expand Down Expand Up @@ -370,7 +381,6 @@ function AgamaListPage() {
{ name: t("menus.add_community_project"), path: "" },
];


const handleDeploy = async () => {
try {
const repo = agamaRepostoriesList.projects.find(
Expand All @@ -379,7 +389,6 @@ function AgamaListPage() {
setProjectName(repo["repository-name"]);
dispatch(getAgamaRepositoryFile({ downloadurl: repo["download-link"] }));
} catch (error) {
console.log(error);
toast.error("File not found");
}
};
Expand Down

0 comments on commit c3b2cda

Please sign in to comment.