in streampark-console/streampark-console-webapp/src/views/resource/project/useProject.tsx [266:309]
async function handleBranches(values: Recordable) {
const hide = createMessage.loading('Getting branch');
try {
const url = values.url;
if (url) {
const userName = values.userName || null;
const password = values.password || null;
const prvkeyPath = values.prvkeyPath || null;
const userNull = userName === null || userName === undefined || userName === '';
const passNull = password === null || password === undefined || password === '';
if ((userNull && passNull) || (!userNull && !passNull)) {
const resp = await fetchBranches({ url, userName, password, prvkeyPath });
if (resp) {
const branches = (resp['branches'] || []).map((c: string) => {
return {
label: c,
value: 'refs/heads/' + c,
};
});
const tags = (resp['tags'] || []).map((c: string) => {
return {
label: c,
value: 'refs/tags/' + c,
};
});
branchList.value = [
{
label: 'Branches',
options: branches,
},
{
label: 'Tags',
options: tags,
},
];
}
}
}
} catch (error) {
console.error(error);
} finally {
hide();
}
}