Merge remote-tracking branch 'origin/dev' into celery

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-09-05 08:19:40 -03:00
commit 2e09d53ced
57 changed files with 230 additions and 211 deletions

View file

@ -39,9 +39,7 @@ export default function DropdownButton({
}}
>
{!showOptions ? (
<IconComponent
name="ChevronDown"
/>
<IconComponent name="ChevronDown" />
) : (
<IconComponent name="ChevronUp" />
)}

View file

@ -54,7 +54,7 @@ export default function InputComponent({
</Form.Control>
) : (
<Input
type={password && !pwdVisible ? "password" : "text"}
type="text"
value={value}
disabled={disabled}
required={required}

View file

@ -315,9 +315,11 @@ export function TabsProvider({ children }: { children: ReactNode }) {
input.type = "file";
input.accept = ".json";
// add a change event listener to the file input
id = await new Promise(resolve => {
id = await new Promise((resolve) => {
input.onchange = async (e: Event) => {
if ((e.target as HTMLInputElement).files![0].type === "application/json") {
if (
(e.target as HTMLInputElement).files![0].type === "application/json"
) {
const currentfile = (e.target as HTMLInputElement).files![0];
let text = await currentfile.text();
let flow: FlowType = JSON.parse(text);

View file

@ -164,7 +164,7 @@ export async function readFlowsFromDatabase() {
try {
const response = await api.get(`${BASE_URL_API}flows/`);
if (response?.status !== 200) {
throw new Error(`HTTP error! status: ${response.status}`);
throw new Error(`HTTP error! status: ${response?.status}`);
}
return response.data;
} catch (error) {
@ -177,7 +177,7 @@ export async function downloadFlowsFromDatabase() {
try {
const response = await api.get(`${BASE_URL_API}flows/download/`);
if (response?.status !== 200) {
throw new Error(`HTTP error! status: ${response.status}`);
throw new Error(`HTTP error! status: ${response?.status}`);
}
return response.data;
} catch (error) {
@ -190,8 +190,8 @@ export async function uploadFlowsToDatabase(flows: FormData) {
try {
const response = await api.post(`${BASE_URL_API}flows/upload/`, flows);
if (response.status !== 201) {
throw new Error(`HTTP error! status: ${response.status}`);
if (response?.status !== 201) {
throw new Error(`HTTP error! status: ${response?.status}`);
}
return response.data;
} catch (error) {
@ -468,7 +468,7 @@ export async function updateUser(user_id: string, user: Users) {
export async function getApiKey() {
try {
const res = await api.get(`${BASE_URL_API}api_key`);
const res = await api.get(`${BASE_URL_API}api_key/`);
if (res.status === 200) {
return res.data;
}
@ -480,7 +480,7 @@ export async function getApiKey() {
export async function createApiKey(name: string) {
try {
const res = await api.post(`${BASE_URL_API}api_key`, { name });
const res = await api.post(`${BASE_URL_API}api_key/`, { name });
if (res.status === 200) {
return res.data;
}

View file

@ -32,8 +32,8 @@ export default function LoginPage(): JSX.Element {
function signIn() {
const user: LoginType = {
username: username,
password: password,
username: username.trim(),
password: password.trim(),
};
onLogin(user)
.then((user) => {

View file

@ -33,8 +33,8 @@ export default function SignUp(): JSX.Element {
function handleSignup(): void {
const { username, password } = inputState;
const newUser: UserInputType = {
username,
password,
username: username.trim(),
password: password.trim(),
};
addUser(newUser)
.then((user) => {

View file

@ -548,5 +548,5 @@ export type fetchErrorComponentType = {
export type dropdownButtonPropsType = {
firstButtonName: string;
onFirstBtnClick: () => void;
options: Array<{ name: string; onBtnClick: () => void; }>;
options: Array<{ name: string; onBtnClick: () => void }>;
};