93 lines
2.4 KiB
TypeScript
93 lines
2.4 KiB
TypeScript
namespace $.$$ {
|
|
$hyoo_crus_yard.masters = [
|
|
$mol_dom_context.document.location.origin +'/',
|
|
]
|
|
|
|
export class $hd_canary_app extends $.$hd_canary_app {
|
|
|
|
@ $mol_mem
|
|
home() {
|
|
const ref = $hyoo_crus_ref( this.$.$mol_fetch.text( '/ref' ) )
|
|
return this.$.$hyoo_crus_glob.Node( ref, $hd_canary_app_home )
|
|
}
|
|
|
|
sites() {
|
|
return this.home().Sites(null)!.remote_list().map( key => this.Site( key ) ) ?? []
|
|
}
|
|
|
|
status( prop: $hd_canary_app_home_site ) {
|
|
return this.last_ping_status(prop) + " " + this.domain(prop)
|
|
}
|
|
|
|
domain( prop: $hd_canary_app_home_site ) {
|
|
return prop.domain()!.val() ?? prop.ref().description!
|
|
}
|
|
last_ping_time( prop: $hd_canary_app_home_site ) {
|
|
return prop.last_ping_time()!.val() ?? prop.ref().description! as any
|
|
}
|
|
last_ping_status( prop: $hd_canary_app_home_site ) {
|
|
return prop.last_ping_status()!.val()? "🟢" : "🔴"
|
|
}
|
|
|
|
click() {
|
|
// const new_site = new $hd_canary_app_home_site()
|
|
// new_site.domain("some_value")
|
|
|
|
// const site = this.home().land().Node( $hd_canary_app_home_site ).Item('')
|
|
// console.log( site )
|
|
|
|
// console.log( this.home().can_change())
|
|
|
|
// const new_site = this.home().Sites(null)!.make({ '': $hyoo_crus_rank_read })
|
|
// new_site.domain("test")
|
|
|
|
for (const site of this.home().Sites(null)!.remote_list()) {
|
|
console.log({site})
|
|
console.log({domain: site.domain()?.val()})
|
|
}
|
|
|
|
console.log({landaaa: this.home().Sites(null)?.land_ref()})
|
|
|
|
|
|
// console.log(
|
|
// this.home().Sites(null)!.remote_list()
|
|
// )
|
|
|
|
|
|
// const masters = this.$.$hyoo_crus_glob.yard().masters()//$mol_wire_sync( this.$.$hyoo_crus_glob.yard() ).masters()
|
|
// this.Port_masters( null )!.tick_instant( masters ) // pct
|
|
// console.log( {masters} )
|
|
}
|
|
|
|
add_site() {
|
|
const domain = this.New_site_string().value()
|
|
|
|
// const new_site = this.home().Sites(null)!.make({ '': $hyoo_crus_rank_rule })
|
|
// new_site.domain(null)!.val(domain)
|
|
|
|
$mol_fetch.response("/sites", {
|
|
method: "POST",
|
|
headers: {
|
|
'Content-Type': 'application/json;charset=utf-8'
|
|
},
|
|
body: JSON.stringify({
|
|
domain
|
|
})
|
|
})
|
|
}
|
|
|
|
delete_site( prop: $hd_canary_app_home_site ) {
|
|
|
|
$mol_fetch.response("/sites", {
|
|
method: "DELETE",
|
|
headers: {
|
|
'Content-Type': 'application/json;charset=utf-8'
|
|
},
|
|
body: JSON.stringify({
|
|
ref: prop.ref().description!
|
|
})
|
|
})
|
|
|
|
}
|
|
}
|
|
}
|