loadResources()

in src/main/resources/static/components/resource/EcsInstances.tsx [39:64]


    loadResources(regionId: string, pageIndex: number = 1, pageSize: number = 20) {
        const url = `/api/ecs/regions/${regionId}/instances?pageIndex=${pageIndex}&pageSize=${pageSize}`
        axios.get(url).then(response => {
            // noinspection TypeScriptValidateTypes
            this.setState({
                instances: response.data.instances,
                total: response.data.totalCount,
                loading: false,
                updated: Date.now(),
            })
            return response.data.instances;
        }).then(instances => {
            if (instances.length == 0) return
            const query = instances.map((vm: any) => 'instanceId=' + vm.instanceId).join("&")
            const url = `/api/ecs/regions/${regionId}/assistants?${query}`;
            axios.get(url).then(result => {
                result.data.instanceCloudAssistantStatusSet.forEach((status: any) => {
                    this.assistants.set(status.instanceId, status)
                })
                // noinspection TypeScriptValidateTypes
                this.setState({
                    updated: Date.now()
                })
            })
        })
    }