// Copyright 2017 HootSuite Media Inc. // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an AS IS BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Modified hereafter by contributors to runatlantis/atlantis. package templates import ( "html/template" "io" "time" ) //go:generate pegomock generate -m --use-experimental-model-gen --package mocks -o mocks/mock_template_writer.go TemplateWriter // TemplateWriter is an interface over html/template that's used to enable // mocking. type TemplateWriter interface { // Execute applies a parsed template to the specified data object, // writing the output to wr. Execute(wr io.Writer, data interface{}) error } // LockIndexData holds the fields needed to display the index view for locks. type LockIndexData struct { LockPath string RepoFullName string PullNum int Path string Workspace string Time time.Time TimeFormatted string } // ApplyLockData holds the fields to display in the index view type ApplyLockData struct { Locked bool Time time.Time TimeFormatted string } // IndexData holds the data for rendering the index page type IndexData struct { Locks []LockIndexData ApplyLock ApplyLockData AtlantisVersion string // CleanedBasePath is the path Atlantis is accessible at externally. If // not using a path-based proxy, this will be an empty string. Never ends // in a '/' (hence "cleaned"). CleanedBasePath string } var IndexTemplate = template.Must(template.New("index.html.tmpl").Parse(`
atlantis
Plan discarded and unlocked!
Lock Status: ActiveActive Since: {{ .ApplyLock.TimeFormatted }}Locks
{{ if .Locks }} {{ $basePath := .CleanedBasePath }} {{ range .Locks }} {{ end }} {{ else }}No locks found.
{{ end }}atlantis
{{.LockKey}} Locked
Repo Owner: {{.RepoOwner}}Repo Name: {{.RepoName}}Pull Request Link: {{.PullRequestLink}}Locked By: {{.LockedBy}}Workspace: {{.Workspace}}atlantis
atlantis
{{ if .Target }} Create a github app {{ else }} Github app created successfully! {{ end }}
Visit {{ .URL }}/installations/new to install the app for your user or organization, then update the following values in your config and restart Atlantis:
{{ .ID }}{{ .Key }}{{ .WebhookSecret }}