Fix Appwrite models typings in dashboard
This commit is contained in:
parent
c38cd74732
commit
1b58f28caf
3 changed files with 15 additions and 11 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Execution, ID, Query } from 'appwrite'
|
||||
import { ID, Query, type Models } from 'appwrite'
|
||||
import { FormEvent, useEffect, useState } from 'react'
|
||||
import {
|
||||
appwriteCollectionCloudflareAccountsId,
|
||||
|
|
@ -32,7 +32,7 @@ export default function Cloudflare() {
|
|||
const [credentials, setCredentials] = useState<{ $id: string; label: string }[]>([])
|
||||
const [zones, setZones] = useState<Zone[]>([])
|
||||
const [workers, setWorkers] = useState<Worker[]>([])
|
||||
const [execution, setExecution] = useState<Execution | null>(null)
|
||||
const [execution, setExecution] = useState<Models.Execution | null>(null)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [modalOpen, setModalOpen] = useState(false)
|
||||
const [newZone, setNewZone] = useState('')
|
||||
|
|
@ -56,9 +56,13 @@ export default function Cloudflare() {
|
|||
const loadWorkers = async () => {
|
||||
if (!appwriteDatabaseId || !appwriteCollectionServersId) return
|
||||
try {
|
||||
const servers = await databases.listDocuments<{ status?: string }>(appwriteDatabaseId, appwriteCollectionServersId, [
|
||||
Query.equal('status', 'online'),
|
||||
])
|
||||
const servers = await databases.listDocuments<Models.Document & { status?: string }>(
|
||||
appwriteDatabaseId,
|
||||
appwriteCollectionServersId,
|
||||
[
|
||||
Query.equal('status', 'online'),
|
||||
],
|
||||
)
|
||||
setOnlineCount(servers.total)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Execution } from 'appwrite'
|
||||
import { type Models } from 'appwrite'
|
||||
import { useState } from 'react'
|
||||
import { functions } from '../lib/appwrite'
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ type Repo = {
|
|||
|
||||
export default function Github() {
|
||||
const [accountId, setAccountId] = useState('')
|
||||
const [execution, setExecution] = useState<Execution | null>(null)
|
||||
const [execution, setExecution] = useState<Models.Execution | null>(null)
|
||||
const [repos, setRepos] = useState<Repo[]>([])
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Query } from 'appwrite'
|
||||
import { Query, type Models } from 'appwrite'
|
||||
import { useEffect, useState } from 'react'
|
||||
import {
|
||||
appwriteCollectionAuditLogsId,
|
||||
|
|
@ -16,11 +16,11 @@ const statCard = (label: string, value: string | number, helper?: string) => (
|
|||
</div>
|
||||
)
|
||||
|
||||
type DeploymentLog = { timestamp?: string }
|
||||
type DeploymentLog = Models.Document & { timestamp?: string }
|
||||
|
||||
type Server = { status?: string }
|
||||
type Server = Models.Document & { status?: string }
|
||||
|
||||
type Repo = { $id: string }
|
||||
type Repo = Models.Document & { $id: string }
|
||||
|
||||
export default function Home() {
|
||||
const [projectsTotal, setProjectsTotal] = useState<number | null>(null)
|
||||
|
|
|
|||
Loading…
Reference in a new issue