Documentation ¶
Index ¶
- func MapSiteDBtoVM(site *database.Site, siteVM *SitesEditViewModel)
- func MapSiteVMtoDB(siteVM *SitesEditViewModel, site *database.Site) error
- type AboutViewModel
- type ContactViewModel
- type ContactsAllSitesViewModel
- type ContactsEditViewModel
- type ContactsViewModel
- type HomeViewModel
- type LoginViewModel
- type MonthlytItems
- type NavViewModel
- type ProfileEditViewModel
- type ProfileViewModel
- type ReportItemViewModel
- type ReportViewModel
- type SettingsViewModel
- type SiteContactsSelectedViewModel
- type SiteDashboardViewModel
- type SiteEditViewModel
- type SiteViewModel
- func EditSiteViewModel(siteVM *SitesEditViewModel, allContacts database.Contacts, ...) SiteViewModel
- func GetSiteDetailsViewModel(site *database.Site, isAuthenticated bool, user httpauth.UserData) SiteViewModel
- func NewSiteViewModel(siteVM *SitesEditViewModel, allContacts database.Contacts, ...) SiteViewModel
- type SitesAllContactsViewModel
- type SitesEditViewModel
- type UserViewModel
- func DeleteUserViewModel(formUser *UsersEditViewModel, isAuthenticated bool, user httpauth.UserData, ...) UserViewModel
- func EditUserViewModel(formUser *UsersEditViewModel, roles map[string]httpauth.Role, ...) UserViewModel
- func NewUserViewModel(formUser *UsersEditViewModel, roles map[string]httpauth.Role, ...) UserViewModel
- type UsersEditViewModel
- type UsersViewModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapSiteDBtoVM ¶
func MapSiteDBtoVM(site *database.Site, siteVM *SitesEditViewModel)
MapSiteDBtoVM maps the site database properties to the site view model properties.
func MapSiteVMtoDB ¶
func MapSiteVMtoDB(siteVM *SitesEditViewModel, site *database.Site) error
MapSiteVMtoDB maps the site view model properties to the site database properties.
Types ¶
type AboutViewModel ¶
AboutViewModel holds the view information for the about.gohtml template
func GetAboutViewModel ¶
func GetAboutViewModel(isAuthenticated bool, user httpauth.UserData, messages []string, version string) AboutViewModel
GetAboutViewModel populates the items required by the about.gohtml view
type ContactViewModel ¶
type ContactViewModel struct { Errors map[string]string Title string Contact ContactsEditViewModel AllSites []ContactsAllSitesViewModel CsrfField template.HTML }
ContactViewModel holds the view information for the contact_edit.gohtml template
func EditContactViewModel ¶
func EditContactViewModel(formContact *ContactsEditViewModel, allSites database.Sites, isAuthenticated bool, user httpauth.UserData, errors map[string]string) ContactViewModel
EditContactViewModel populates the items required by the user_contact.gohtml view
func NewContactViewModel ¶
func NewContactViewModel(formContact *ContactsEditViewModel, allSites database.Sites, selectAllSites bool, isAuthenticated bool, user httpauth.UserData, errors map[string]string) ContactViewModel
NewContactViewModel populates the items required by the user_contact.gohtml view
type ContactsAllSitesViewModel ¶ added in v1.1.0
type ContactsAllSitesViewModel struct { SiteID int64 Name string IsActive bool URL string IsAssigned bool }
ContactsAllSitesViewModel has all of the sites available to assign the contact.
func PopulateAllSitesVM ¶ added in v1.1.0
func PopulateAllSitesVM(allSites database.Sites, selectedSiteIDs []int64, selectAllSites bool) []ContactsAllSitesViewModel
PopulateAllSitesVM returns the view model for all of the sites
type ContactsEditViewModel ¶
type ContactsEditViewModel struct { ContactID int64 `valid:"-"` Name string `valid:"ascii,required"` EmailAddress string `valid:"email"` SmsNumber string `valid:"-"` SmsActive bool `valid:"-"` EmailActive bool `valid:"-"` SelectedSites []int64 `valid:"-"` SiteCount int `valid:"-"` }
ContactsEditViewModel holds the required information about the Contacts to choose for editing.
type ContactsViewModel ¶
type ContactsViewModel struct { Error error Title string Contacts []ContactsEditViewModel }
ContactsViewModel holds the view information for the contacts.gohtml template
func GetContactsViewModel ¶
func GetContactsViewModel(contacts database.Contacts, isAuthenticated bool, user httpauth.UserData, err error) ContactsViewModel
GetContactsViewModel populates the items required by the contacts.gohtml view
type HomeViewModel ¶
type HomeViewModel struct { Title string Sites []SiteDashboardViewModel Messages []string HasSiteWithNoStatusChanges bool }
HomeViewModel holds the view information for the home.gohtml template
func GetHomeViewModel ¶
func GetHomeViewModel(sites database.Sites, isAuthenticated bool, user httpauth.UserData, messages []string) HomeViewModel
GetHomeViewModel populates the items required by the home.gohtml view
type LoginViewModel ¶
LoginViewModel holds the view information for the login.gohtml template
func GetLoginViewModel ¶
func GetLoginViewModel(messages []string) LoginViewModel
GetLoginViewModel populates the items required by the login.gohtml view
type MonthlytItems ¶
type MonthlytItems []ReportItemViewModel
MonthlytItems defines the slice of items that represent a month of report data
type NavViewModel ¶
type NavViewModel struct {}
NavViewModel holds the information for the nav bar.
type ProfileEditViewModel ¶
type ProfileEditViewModel struct { Email string `valid:"email,required"` Password string `valid:"-"` Password2 string `valid:"-"` Username string `valid:""` }
ProfileEditViewModel holds the required information about the user to edit their profile.
type ProfileViewModel ¶
type ProfileViewModel struct { Errors map[string]string Title string User ProfileEditViewModel CsrfField template.HTML }
ProfileViewModel holds the view information for the profile.gohtml template
func EditProfileViewModel ¶
func EditProfileViewModel(formProfile *ProfileEditViewModel, isAuthenticated bool, user httpauth.UserData, errors map[string]string) ProfileViewModel
EditProfileViewModel populates the items required by the profile.gohtml view
type ReportItemViewModel ¶
ReportItemViewModel defines the individual items that will be reported.
type ReportViewModel ¶
type ReportViewModel struct { Title string SelectedYear int Years []int MonthlyData map[string]MonthlytItems YtdAvgResponse map[string]string YtdAvgUptime map[string]string Messages []string }
ReportViewModel holds the view information for the report.gohtml template
type SettingsViewModel ¶
type SettingsViewModel struct { Error error Title string Sites []SiteEditViewModel CsrfField template.HTML }
SettingsViewModel holds the view information for the settings.gohtml template
func GetSettingsViewModel ¶
func GetSettingsViewModel(sites database.Sites, isAuthenticated bool, user httpauth.UserData, err error) SettingsViewModel
GetSettingsViewModel populates the items required by the settings.gohtml view
type SiteContactsSelectedViewModel ¶
type SiteContactsSelectedViewModel struct { SiteID int64 SelectedContacts []int64 SiteContacts []int64 }
SiteContactsSelectedViewModel holds the selections when contacts are changed. The existing SiteContacts are also containd in SiteContats
type SiteDashboardViewModel ¶
type SiteDashboardViewModel struct { SiteID int64 Name string Status string HowLong string CSSClass string LastChecked string HasNoStatusChanges bool }
SiteDashboardViewModel holds the required information about the site.
type SiteEditViewModel ¶
type SiteEditViewModel struct { SiteID int64 Name string IsActive bool URL string PingIntervalSeconds int TimeoutSeconds int NumContacts int }
SiteEditViewModel holds the required information about the site to choose for editing.
type SiteViewModel ¶
type SiteViewModel struct { Errors map[string]string Title string Site SitesEditViewModel Contacts []database.Contact AllContacts []SitesAllContactsViewModel CsrfField template.HTML }
SiteViewModel holds the view information for the site_edit.gohtml template
func EditSiteViewModel ¶
func EditSiteViewModel(siteVM *SitesEditViewModel, allContacts database.Contacts, isAuthenticated bool, user httpauth.UserData, errors map[string]string) SiteViewModel
EditSiteViewModel populates the items required by the site_edit.gohtml view
func GetSiteDetailsViewModel ¶
func GetSiteDetailsViewModel(site *database.Site, isAuthenticated bool, user httpauth.UserData) SiteViewModel
GetSiteDetailsViewModel populates the items required by the site_details.gohtml view
func NewSiteViewModel ¶
func NewSiteViewModel(siteVM *SitesEditViewModel, allContacts database.Contacts, isAuthenticated bool, user httpauth.UserData, errors map[string]string) SiteViewModel
NewSiteViewModel populates the items required by the site_new.gohtml view
type SitesAllContactsViewModel ¶
type SitesAllContactsViewModel struct { ContactID int64 IsAssigned bool Name string EmailAddress string SmsNumber string SmsActive bool EmailActive bool }
SitesAllContactsViewModel has all of the sites available and carries whether the contact is part of the Site itself via the IsAssigned property
func PopulateAllContactsVM ¶
func PopulateAllContactsVM(allContacts database.Contacts, siteContactIDs []int64) []SitesAllContactsViewModel
PopulateAllContactsVM returns the view model for the contacts with the ones assigned to the site having IsAssigned set to true.
type SitesEditViewModel ¶
type SitesEditViewModel struct { SiteID int64 `valid:"-"` Name string `valid:"ascii,required"` IsActive bool `valid:"-"` URL string `valid:"url,required"` PingIntervalSeconds string `valid:"int,required"` TimeoutSeconds string `valid:"int,required"` ContentExpected string `valid:"-"` ContentUnexpected string `valid:"-"` SelectedContacts []int64 `valid:"-"` SiteContacts []int64 `valid:"-"` }
SitesEditViewModel holds the required information about the Sites to choose for editing. The PingIntervalSeconds and TimeoutSeconds are strings to allow the form validation.
type UserViewModel ¶
type UserViewModel struct { Errors map[string]string Title string User UsersEditViewModel Roles map[string]httpauth.Role CsrfField template.HTML }
UserViewModel holds the view information for the user_edit.gohtml template
func DeleteUserViewModel ¶ added in v1.1.0
func DeleteUserViewModel(formUser *UsersEditViewModel, isAuthenticated bool, user httpauth.UserData, errors map[string]string) UserViewModel
DeleteUserViewModel populates the items required by the user_delete.gohtml view
func EditUserViewModel ¶
func EditUserViewModel(formUser *UsersEditViewModel, roles map[string]httpauth.Role, isAuthenticated bool, user httpauth.UserData, errors map[string]string) UserViewModel
EditUserViewModel populates the items required by the user_edit.gohtml view
func NewUserViewModel ¶
func NewUserViewModel(formUser *UsersEditViewModel, roles map[string]httpauth.Role, isAuthenticated bool, user httpauth.UserData, errors map[string]string) UserViewModel
NewUserViewModel populates the items required by the user_new.gohtml view
type UsersEditViewModel ¶
type UsersEditViewModel struct { Username string `valid:"alphanum,required"` Email string `valid:"email,required"` Role string `valid:"-"` Password string `valid:"-"` Password2 string `valid:"-"` }
UsersEditViewModel holds the required information about the site to choose for editing.
type UsersViewModel ¶
type UsersViewModel struct { Error error Title string Users []UsersEditViewModel }
UsersViewModel holds the view information for the users.gohtml template
func GetUsersViewModel ¶
func GetUsersViewModel(users []httpauth.UserData, isAuthenticated bool, user httpauth.UserData, err error) UsersViewModel
GetUsersViewModel populates the items required by the settings.gohtml view