Преглед изворни кода

Fix endpoint details loading animation

Sometimes, when visiting the endpoint details page, the loading
animation would be shown, even though the connection info was already
loaded.
Sergiu Miclea пре 5 година
родитељ
комит
872d477989

+ 1 - 1
src/components/organisms/EndpointDetailsContent/EndpointDetailsContent.tsx

@@ -257,7 +257,7 @@ class EndpointDetailsContent extends React.Component<Props> {
             <Label>Used in replicas/migrations ({usage.length})</Label>
             <Label>Used in replicas/migrations ({usage.length})</Label>
             {usage.length > 0 ? this.renderUsage(usage) : <Value>-</Value>}
             {usage.length > 0 ? this.renderUsage(usage) : <Value>-</Value>}
           </Field>
           </Field>
-          {this.renderConnectionInfoLoading()}
+          {!this.props.connectionInfo ? this.renderConnectionInfoLoading() : null}
           {this.renderConnectionInfo(this.props.connectionInfo)}
           {this.renderConnectionInfo(this.props.connectionInfo)}
         </Info>
         </Info>
         {this.renderButtons()}
         {this.renderButtons()}

+ 1 - 1
src/sources/EndpointSource.ts

@@ -87,7 +87,7 @@ class EndpointSource {
   }
   }
 
 
   async getSecretPayload(uuid: string, count: number = 0) {
   async getSecretPayload(uuid: string, count: number = 0) {
-    const delay = () => new Promise(r => { setTimeout(() => { r() }, 2000) })
+    const delay = () => new Promise<void>(r => { setTimeout(() => { r() }, 2000) })
 
 
     if (count >= 10) {
     if (count >= 10) {
       return Promise.reject({ secretCustomError: `The secret '${uuid}' is not active after ${count} retries.` })
       return Promise.reject({ secretCustomError: `The secret '${uuid}' is not active after ${count} retries.` })