mirror of
https://github.com/fluxscape/fluxscape.git
synced 2026-01-11 14:52:54 +01:00
Compare commits
3 Commits
feature/im
...
feature/cl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9433cde97f | ||
|
|
fcf3a740e7 | ||
|
|
985d609f03 |
@@ -52,9 +52,11 @@ export class ExternalCloudService {
|
|||||||
const broker = brokers.find((x) => x.id === options.id);
|
const broker = brokers.find((x) => x.id === options.id);
|
||||||
if (!broker) return false;
|
if (!broker) return false;
|
||||||
|
|
||||||
if (options.name) broker.name = options.name;
|
if (typeof options.name !== undefined) broker.name = options.name;
|
||||||
if (options.description) broker.description = options.description;
|
if (typeof options.description !== undefined) broker.description = options.description;
|
||||||
if (options.masterKey) broker.masterKey = options.masterKey;
|
if (typeof options.appId !== undefined) broker.appId = options.appId;
|
||||||
|
if (typeof options.masterKey !== undefined) broker.masterKey = options.masterKey;
|
||||||
|
if (typeof options.url !== undefined) broker.endpoint = options.url;
|
||||||
|
|
||||||
await JSONStorage.set('externalBrokers', { brokers });
|
await JSONStorage.set('externalBrokers', { brokers });
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ export type UpdateEnvironmentRequest = {
|
|||||||
id: string;
|
id: string;
|
||||||
name: string | undefined;
|
name: string | undefined;
|
||||||
description: string | undefined;
|
description: string | undefined;
|
||||||
|
appId: string | undefined;
|
||||||
masterKey: string | undefined;
|
masterKey: string | undefined;
|
||||||
|
url: string | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CreateEnvironment = {
|
export type CreateEnvironment = {
|
||||||
|
|||||||
@@ -42,16 +42,31 @@ 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,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
masterKey
|
appId,
|
||||||
|
masterKey,
|
||||||
|
url
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
ToastLayer.showSuccess(`Updated Cloud Service`);
|
ToastLayer.showSuccess(`Updated Cloud Service`);
|
||||||
@@ -86,12 +101,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 +142,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>
|
||||||
|
|||||||
Reference in New Issue
Block a user