Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 15, 2023
1 parent 3e1166f commit 45950bf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
3 changes: 1 addition & 2 deletions src/renderer/src/stories/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,8 @@ export class Table extends LitElement {
const initialCellsToUpdate = data.reduce((acc, v) => acc + v.length, 0);

table.addHook("afterValidate", (isValid, value, row, prop) => {

const isUserUpdate = initialCellsToUpdate <= validated;

if (isUserUpdate) {
const header = typeof prop === "number" ? colHeaders[prop] : prop;
let rowName = this.keyColumn ? rowHeaders[row] : row;
Expand Down
38 changes: 16 additions & 22 deletions src/renderer/src/stories/pages/guided-mode/options/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ export const openProgressSwal = (options, callback) => {

export const run = async (url, payload, options = {}) => {
const needsSwal = !options.swal && options.swal !== false;

if (needsSwal) {

if (needsSwal) {
if (!("showCancelButton" in options)) {
options.showCancelButton = true;
options.customClass = { actions: "swal-conversion-actions" };
Expand All @@ -36,37 +35,32 @@ export const run = async (url, payload, options = {}) => {

options.fetch = {
signal: cancelController.signal,
}
};

const popup = await openProgressSwal(options, (result) => {
if (!result.isConfirmed) cancelController.abort();
}).then(async (swal) => {
if (options.onOpen) await options.onOpen(swal)
return swal
if (options.onOpen) await options.onOpen(swal);
return swal;
});

const element = popup.getHtmlContainer();
const actions = popup.getActions()
const loader = actions.querySelector(".swal2-loader")
const actions = popup.getActions();
const loader = actions.querySelector(".swal2-loader");
const container = document.createElement("div");
container.append(loader)
container.append(loader);
element.innerText = "";
Object.assign(container.style, {
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
marginBottom: '25px'
})
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
marginBottom: "25px",
});

element.appendChild(container);

element.insertAdjacentHTML(
"beforeend",
`<hr style="margin-bottom: 0;">`
);


element.insertAdjacentHTML("beforeend", `<hr style="margin-bottom: 0;">`);
}

if (!("base" in options)) options.base = "/neuroconv";
Expand All @@ -79,8 +73,8 @@ export const run = async (url, payload, options = {}) => {
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
...(options.fetch ?? {}),
}).then((res) => res.json())
}).then((res) => res.json());

if (needsSwal) Swal.close();

if (results?.message) throw new Error(`Request to ${url} failed: ${results.message}`);
Expand Down

0 comments on commit 45950bf

Please sign in to comment.