Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemitchel committed Nov 6, 2024
1 parent a1d6c9a commit 8f7ac83
Showing 1 changed file with 45 additions and 4 deletions.
49 changes: 45 additions & 4 deletions src/health-tab/health-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,58 @@ import DefineMap from 'can-define/map/map'
import Component from 'can-component'
import template from './health-tab.stache'

export const GuideHealthReport = DefineMap.extend('GuideHealthReport', {
guideId: { default: '' }, // generated by author app
authorId: { default: '' }, // number tied to author login, coerce to string
title: { default: '' }, // author set
version: { default: '' }, // author set version
createdate: { default: '' }, // this gets set on GI creation
modifydate: { default: '' }, // does this update on save?
emailContact: { default: '' }, // email tobias
sortedPages: [], // iterate guide.sortedPages and sum up messages
vars: [] // isUnused
})

export const HealthTabVM = DefineMap.extend('HealthTabVM', {
// passed in via app.stache
guide: {set (guide) {
console.log('g', guide)
return guide
}},
guide: {},
guideId: {},
waiting: {
type: 'boolean',
default: false
},
get vars () { return this.guide && this.guide.vars },

get pages () { return this.guide && this.guide.pages },

get fields () {
const fields = []

this.guide.pages.forEach(page => fields.push(...page.fields.splice(0)))

return fields
},

connectedCallback () {
// createHealthChecks(checks:[]) - returns a runHealthCheck function
// use compute for results of runHealtCheck
// check: {page: }
// this.guide.forEach(prop => console.log('prop', prop))
const guide = this.guide
const guideId = this.guideId

console.log('g', guide)

const { authorId, title, version, createdate, modifydate, emailContact, sortedPages, vars } = guide
const ghr = new GuideHealthReport({ guideId, authorId, title, version, createdate, modifydate, emailContact, sortedPages, vars })

guide.sortedPages.forEach(page => {
// check buttons
// check fields/var types
// check logic?
})
console.log('stuffs', ghr)
}
})

export default Component.extend({
Expand Down

0 comments on commit 8f7ac83

Please sign in to comment.