pages

package
v0.0.0-...-1518e3e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package pages is used to display the gui. This package is kind of a middleman for other funcs and the templates package.

This file specifically deals with showing the activity log.

Package pages is used to display the gui. This package is kind of a middleman for other funcs and the templates package.

This file specifically deals with showing the diagnostics page which shows all sorts of lower level info on the app.

Package pages is used to display the gui. This package is kind of a middleman for other funcs and the templates package.

This file specifically deals with help/documentation pages. As long as the filename matches what is used in the <a> tag on the table of contents, the Help func will serve the file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivityChartDurationLatestRequests

func ActivityChartDurationLatestRequests(w http.ResponseWriter, r *http.Request)

ActivityChartDurationLatestRequests shows duration of the latest requests to the app. This defaults to the latest 500 requests but this can be changed as needed, but note that the time to serve the data may get longer.

func ActivityChartMaxAvgDuration

func ActivityChartMaxAvgDuration(w http.ResponseWriter, r *http.Request)

ActivityChartMaxAvgDuration shows the average and max duration of requests made to the app on a monthly basis. This can be used to check if "things are getting slower".

func ActivityChartOverTimeOfDay

func ActivityChartOverTimeOfDay(w http.ResponseWriter, r *http.Request)

ActivityChartOverTimeOfDay shows the usage of the app over the time of day broken into 10 minute increments. This is useful for showing when users are most active in the app. This query/page load will look up a lot of data and take a lot of time to complete.

func ActivityLog

func ActivityLog(w http.ResponseWriter, r *http.Request)

ActivityLog shows the page of user activity within the app. This is useful for auditing user activity or for diagnnostics (seeing what data a user provided versus what they say when an error occurs). You can filter the results by a specific user and/or by a search string. Using a search string performs a sql LIKE query with starting & ending wildcards on the request data (post form values).

func App

func App(w http.ResponseWriter, r *http.Request)

App serves a template based upon the last piece of the path exactly matching an HTML template's filename. This is used for serving basic pages where no computations or functionality needs to be performed prior to showing the page.

You would not use this when you need to provide more data to an HTML template, need to perform some kind of computation or validation prior to showing a template, or if you are serving the filename on a different URL path.

func AppMapped

func AppMapped(w http.ResponseWriter, r *http.Request)

AppMapped serves a template based upon matching up the full request URL path to an HTML template's filename. This is used for serving basic pages where no computations or functionality needs to be performed prior to showing the page, but where the last element in the path does not match the template's filename exactly.

Mapping a URL path to a filename is necessary to handle the different organization structures for HTML templates in the filesystem and the URL paths for HTTP routing.

For example: request is sent to "/raw-materials/reports/underused-containers/" but the HTML template is named "raw-material-underused-containers". The path last element and name does not match because each fits and organization method based upon its use (HTTP router vs filesystem).

func Diagnostics

func Diagnostics(w http.ResponseWriter, r *http.Request)

Diagnostics shows the diagnostic page. We use an actual page for this instead of just using w.Write() so that we can display diagnostic info from js and css.

func Help

func Help(w http.ResponseWriter, r *http.Request)

Help shows a help documentation page. This serves any help page by using the end of the url as the document name. This is useful since we don't need to create a func or route for each help page we create.

func HelpTableOfContents

func HelpTableOfContents(w http.ResponseWriter, r *http.Request)

HelpTableOfContents shows the page listing help documents

func License

func License(w http.ResponseWriter, r *http.Request)

License shows the data for a specific license.

func Login

func Login(w http.ResponseWriter, r *http.Request)

Login shows the login page to the app. This also checks if the user is already logged in and redirects the user to the main logged in page if so.

func Main

func Main(w http.ResponseWriter, r *http.Request)

Main shows the main GUI of the license server app. The main page shows navigation links to create & manage your apps, create & manage licenses, manage users, manage this app, and view activity logging.

func ShowError

func ShowError(w http.ResponseWriter, r *http.Request, ep ErrorPage)

ShowError shows the error page with injected data. This this func cleans up the code whereever an error page is called/shown since it is common throughout the app. The first part of this func is similar to getPageConfigData but allows for skipping the user data since we do not use it on the error page.

func UserLogins

func UserLogins(w http.ResponseWriter, r *http.Request)

UserLogins shows the page of user logins to the app. You can also filter by user ID.

func Users

func Users(w http.ResponseWriter, r *http.Request)

Users shows the page to manage users.

Types

type ErrorPage

type ErrorPage struct {
	PageTitle string //card header

	//These may simply be concatted in the gui but makes code cleaner and more easily reused.
	Topic    string //general topic of the error
	Message  string //what error occured
	Solution string //how to fix or work around the error

	ShowLinkBtn bool   //whether or not a footer button with link is shown
	Link        string //url to use for link, if blank will default to /app/ (main page).
	LinkText    string //text to show on button, if blank will default to Main Menu.
}

ErrorPage is the data used to show messages when an error or unexpected event occurs this stuff is injected into a template to describe to user what occured and how to fix it.

type PageData

type PageData struct {
	UserData    interface{} //username, permissions, etc.
	AppSettings interface{} //whether certain features are used or enabled.
	Data        interface{} //misc. actual data we want to show in the gui.
}

PageData is the format of our data we inject into a template to render it or show data. This struct is used so we always have a consistent format of data being injected into templates for easy parsing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL