Merge pull request #10 from rede5/codex/fix-typescript-errors-in-build
Fix Appwrite models typings in dashboard
This commit is contained in:
commit
7e32d1017d
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 { FormEvent, useEffect, useState } from 'react'
|
||||||
import {
|
import {
|
||||||
appwriteCollectionCloudflareAccountsId,
|
appwriteCollectionCloudflareAccountsId,
|
||||||
|
|
@ -32,7 +32,7 @@ export default function Cloudflare() {
|
||||||
const [credentials, setCredentials] = useState<{ $id: string; label: string }[]>([])
|
const [credentials, setCredentials] = useState<{ $id: string; label: string }[]>([])
|
||||||
const [zones, setZones] = useState<Zone[]>([])
|
const [zones, setZones] = useState<Zone[]>([])
|
||||||
const [workers, setWorkers] = useState<Worker[]>([])
|
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 [error, setError] = useState<string | null>(null)
|
||||||
const [modalOpen, setModalOpen] = useState(false)
|
const [modalOpen, setModalOpen] = useState(false)
|
||||||
const [newZone, setNewZone] = useState('')
|
const [newZone, setNewZone] = useState('')
|
||||||
|
|
@ -56,9 +56,13 @@ export default function Cloudflare() {
|
||||||
const loadWorkers = async () => {
|
const loadWorkers = async () => {
|
||||||
if (!appwriteDatabaseId || !appwriteCollectionServersId) return
|
if (!appwriteDatabaseId || !appwriteCollectionServersId) return
|
||||||
try {
|
try {
|
||||||
const servers = await databases.listDocuments<{ status?: string }>(appwriteDatabaseId, appwriteCollectionServersId, [
|
const servers = await databases.listDocuments<Models.Document & { status?: string }>(
|
||||||
Query.equal('status', 'online'),
|
appwriteDatabaseId,
|
||||||
])
|
appwriteCollectionServersId,
|
||||||
|
[
|
||||||
|
Query.equal('status', 'online'),
|
||||||
|
],
|
||||||
|
)
|
||||||
setOnlineCount(servers.total)
|
setOnlineCount(servers.total)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Execution } from 'appwrite'
|
import { type Models } from 'appwrite'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { functions } from '../lib/appwrite'
|
import { functions } from '../lib/appwrite'
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ type Repo = {
|
||||||
|
|
||||||
export default function Github() {
|
export default function Github() {
|
||||||
const [accountId, setAccountId] = useState('')
|
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 [repos, setRepos] = useState<Repo[]>([])
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [error, setError] = useState<string | null>(null)
|
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 { useEffect, useState } from 'react'
|
||||||
import {
|
import {
|
||||||
appwriteCollectionAuditLogsId,
|
appwriteCollectionAuditLogsId,
|
||||||
|
|
@ -16,11 +16,11 @@ const statCard = (label: string, value: string | number, helper?: string) => (
|
||||||
</div>
|
</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() {
|
export default function Home() {
|
||||||
const [projectsTotal, setProjectsTotal] = useState<number | null>(null)
|
const [projectsTotal, setProjectsTotal] = useState<number | null>(null)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue