mirror of
https://github.com/ragestudio/relic.git
synced 2025-06-09 10:34:18 +00:00
improve patch apply
This commit is contained in:
parent
26179d09cc
commit
3b7d37ba7f
@ -1,7 +1,6 @@
|
||||
import React from "react"
|
||||
import * as antd from "antd"
|
||||
import { Icons, Icon } from "components/Icons"
|
||||
import { useParams } from "react-router-dom"
|
||||
|
||||
import PKGConfigItem from "components/PackageConfigItem"
|
||||
|
||||
@ -59,6 +58,8 @@ const PKGPatches = (props) => {
|
||||
}
|
||||
|
||||
const PackageOptions = (props) => {
|
||||
const [loading, setLoading] = React.useState(false)
|
||||
|
||||
const { manifest } = props
|
||||
|
||||
if (!Array.isArray(manifest.applied_patches)) {
|
||||
@ -72,15 +73,22 @@ const PackageOptions = (props) => {
|
||||
})) : null
|
||||
})
|
||||
|
||||
function applyChanges() {
|
||||
async function applyChanges() {
|
||||
if (props.onClose) {
|
||||
props.onClose()
|
||||
}
|
||||
|
||||
if (props.close) {
|
||||
props.close()
|
||||
}
|
||||
|
||||
ipc.exec("pkg:apply", manifest.id, changes)
|
||||
setLoading(true)
|
||||
|
||||
await ipc.exec("pkg:apply", manifest.id, changes).catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
function handleChanges(field, key, value) {
|
||||
@ -226,19 +234,11 @@ const PackageOptions = (props) => {
|
||||
icon={<Icons.MdReplay />}
|
||||
type="default"
|
||||
size="small"
|
||||
disabled={loading}
|
||||
>
|
||||
Reinstall
|
||||
</antd.Button>
|
||||
|
||||
{/* <antd.Button
|
||||
disabled
|
||||
icon={<Icons.MdCheck />}
|
||||
type="default"
|
||||
size="small"
|
||||
>
|
||||
Verify
|
||||
</antd.Button> */}
|
||||
|
||||
{
|
||||
manifest.install_ask_configs && <antd.Button
|
||||
onClick={() => {
|
||||
@ -247,6 +247,7 @@ const PackageOptions = (props) => {
|
||||
icon={<Icons.MdSettings />}
|
||||
type="default"
|
||||
size="small"
|
||||
disabled={loading}
|
||||
>
|
||||
Wizard
|
||||
</antd.Button>
|
||||
@ -255,7 +256,8 @@ const PackageOptions = (props) => {
|
||||
<antd.Button
|
||||
type="primary"
|
||||
onClick={applyChanges}
|
||||
disabled={!canApplyChanges()}
|
||||
disabled={loading || !canApplyChanges()}
|
||||
loading={loading}
|
||||
>
|
||||
Apply Changes
|
||||
</antd.Button>
|
||||
|
Loading…
x
Reference in New Issue
Block a user