feat: Cloud Services, allow changing all fields

This commit is contained in:
Eric Tuvesson
2024-03-25 09:21:59 +01:00
parent 6e514f2521
commit 985d609f03

View File

@@ -42,10 +42,23 @@ function AsSelfHosted({
}: CloudServiceModalProps) { }: CloudServiceModalProps) {
const [name, setName] = useState(environment.name); const [name, setName] = useState(environment.name);
const [description, setDescription] = useState(environment.description); const [description, setDescription] = useState(environment.description);
const [appId, setAppId] = useState(environment.appId);
const [url, setUrl] = useState(environment.url);
const [showMasterKey, setShowMasterKey] = useState(false); const [showMasterKey, setShowMasterKey] = useState(false);
const [masterKey, setMasterKey] = useState(environment.masterKey); const [masterKey, setMasterKey] = useState(environment.masterKey);
function update() { function update() {
// Early return if none of the values changed
if (
name === environment.name &&
description === environment.description &&
appId === environment.appId &&
masterKey === environment.masterKey &&
url === environment.url
) {
return;
}
CloudService.instance.backend CloudService.instance.backend
.update({ .update({
id: environment.id, id: environment.id,
@@ -86,12 +99,14 @@ function AsSelfHosted({
<Columns hasXGap={4} layoutString="1 1"> <Columns hasXGap={4} layoutString="1 1">
<TextInput <TextInput
value={environment.appId} value={appId}
variant={TextInputVariant.InModal} variant={TextInputVariant.InModal}
label="App Id" label="App Id"
isReadonly
isCopyable isCopyable
UNSAFE_style={{ flex: 1 }} UNSAFE_style={{ flex: 1 }}
onChange={(e) => setAppId(e.target.value)}
onBlur={update}
onEnter={update}
/> />
<VStack> <VStack>
<TextInput <TextInput
@@ -125,11 +140,13 @@ function AsSelfHosted({
</Columns> </Columns>
<TextInput <TextInput
value={environment.url} value={url}
variant={TextInputVariant.InModal} variant={TextInputVariant.InModal}
label="Endpoint" label="Endpoint"
isReadonly
isCopyable isCopyable
onChange={(e) => setUrl(e.target.value)}
onBlur={update}
onEnter={update}
/> />
</VStack> </VStack>
</Box> </Box>