convert published store to ts
This commit is contained in:
parent
1248e55bc2
commit
867d162751
|
@ -1,13 +1,16 @@
|
||||||
import { appStore } from "./app"
|
import { appStore } from "./app"
|
||||||
import { appsStore } from "@/stores/portal/apps"
|
import { appsStore } from "@/stores/portal/apps"
|
||||||
import { deploymentStore } from "./deployments"
|
import { deploymentStore } from "./deployments"
|
||||||
import { derived } from "svelte/store"
|
import { derived, type Readable } from "svelte/store"
|
||||||
|
import { DeploymentProgressResponse, DeploymentStatus } from "@budibase/types"
|
||||||
|
|
||||||
export const appPublished = derived(
|
export const appPublished: Readable<boolean> = derived(
|
||||||
[appStore, appsStore, deploymentStore],
|
[appStore, appsStore, deploymentStore],
|
||||||
([$appStore, $appsStore, $deploymentStore]) => {
|
([$appStore, $appsStore, $deploymentStore]) => {
|
||||||
const app = $appsStore.apps.find(app => app.devId === $appStore.appId)
|
const app = $appsStore.apps.find(app => app.devId === $appStore.appId)
|
||||||
const deployments = $deploymentStore.filter(x => x.status === "SUCCESS")
|
const deployments = $deploymentStore.filter(
|
||||||
|
(x: DeploymentProgressResponse) => x.status === DeploymentStatus.SUCCESS
|
||||||
|
)
|
||||||
return app?.status === "published" && deployments.length > 0
|
return app?.status === "published" && deployments.length > 0
|
||||||
}
|
}
|
||||||
)
|
)
|
Loading…
Reference in New Issue