Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/porter-dev/porter into be…
Browse files Browse the repository at this point in the history
…ta.3.postrenderer-fix

moirgin
  • Loading branch information
abelanger5 committed Jan 20, 2021
2 parents 70849e1 + fe3ab8c commit 08e6fa8
Showing 9 changed files with 43 additions and 12 deletions.
13 changes: 13 additions & 0 deletions dashboard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dashboard/package.json
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
"js-yaml": "^3.14.0",
"lodash": "^4.17.20",
"markdown-to-jsx": "^7.0.1",
"posthog-node": "^1.0.6",
"posthog-js": "^1.8.5",
"qs": "^6.9.4",
"random-words": "^1.1.1",
"react": "^16.13.1",
5 changes: 0 additions & 5 deletions dashboard/src/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<script>
!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
posthog.init('XHhXMIA5YlgR4l9QV3Ydm5ZasEyyjvPvGCb33_QVLNc',{api_host:'https://posthog-porter.herokuapp.com'})
</script>

<head>
<title>Porter | Dashboard</title>

11 changes: 11 additions & 0 deletions dashboard/src/main/home/Home.tsx
Original file line number Diff line number Diff line change
@@ -20,6 +20,8 @@ import IntegrationsInstructionsModal from './modals/IntegrationsInstructionsModa
import NewProject from './new-project/NewProject';
import Navbar from './navbar/Navbar';
import Provisioner from './new-project/Provisioner';
import posthog from 'posthog-js';
import * as FullStory from '@fullstory/browser';

type PropsType = {
logOut: () => void
@@ -91,6 +93,15 @@ export default class Home extends Component<PropsType, StateType> {
}

componentDidMount() {
console.log('newest release')
let { user } = this.context;
window.location.href.indexOf('127.0.0.1') === -1 && posthog.init(process.env.POSTHOG_API_KEY, {
api_host: process.env.POSTHOG_HOST,
loaded: function(posthog) { posthog.identify(user.email) }
})

FullStory.identify(user.email)

this.getProjects();
}

Original file line number Diff line number Diff line change
@@ -49,7 +49,6 @@ export default class Logs extends Component<PropsType, StateType> {
let { currentCluster, currentProject } = this.context;
let { selectedPod } = this.props;
if (!selectedPod.metadata?.name) return

let protocol = process.env.NODE_ENV == 'production' ? 'wss' : 'ws'
this.ws = new WebSocket(`${protocol}://${process.env.API_SERVER}/api/projects/${currentProject.id}/k8s/${selectedPod?.metadata?.namespace}/pod/${selectedPod?.metadata?.name}/logs?cluster_id=${currentCluster.id}&service_account_id=${currentCluster.service_account_id}`)

@@ -103,7 +102,13 @@ export default class Logs extends Component<PropsType, StateType> {
<div ref={this.scrollRef} />
</Wrapper>
<Options>
<Scroll onClick={()=> {this.setState({scroll: !this.state.scroll}); this.scrollToBottom(true)}}>
<Scroll onClick={()=> {
this.setState({scroll: !this.state.scroll}, () => {
if (this.state.scroll) {
this.scrollToBottom(true)
}
});
}}>
<input type="checkbox" checked={this.state.scroll} onChange={() => {}}/>
Scroll to Bottom
</Scroll>
5 changes: 3 additions & 2 deletions dashboard/src/main/home/sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -117,9 +117,10 @@ export default class Sidebar extends Component<PropsType, StateType> {
Templates
</NavButton>
<NavButton
// onClick={() => this.props.setCurrentView('integrations')}
selected={this.props.currentView === 'integrations'}
onClick={() => this.context.setCurrentModal('IntegrationsInstructionsModal', {})}
onClick={() => {
this.context.setCurrentModal('IntegrationsInstructionsModal', {})
}}
>
<img src={integrations} />
Integrations
6 changes: 5 additions & 1 deletion internal/helm/postrenderer.go
Original file line number Diff line number Diff line change
@@ -312,8 +312,12 @@ func (d *DockerSecretsPostRenderer) updatePodSpecs(secrets map[string]string) {
"name": secrets[regName],
})
}
if len(imagePullSecrets) > 0 {
podSpec["imagePullSecrets"] = imagePullSecrets
} else {
podSpec["imagePullSecrets"] = nil
}

podSpec["imagePullSecrets"] = imagePullSecrets
}
}

3 changes: 2 additions & 1 deletion internal/kubernetes/agent.go
Original file line number Diff line number Diff line change
@@ -123,7 +123,7 @@ func (a *Agent) GetPodsByLabel(selector string) (*v1.PodList, error) {

// GetPodLogs streams real-time logs from a given pod.
func (a *Agent) GetPodLogs(namespace string, name string, conn *websocket.Conn) error {
tails := int64(300)
tails := int64(400)

// follow logs
podLogOpts := v1.PodLogOptions{
@@ -160,6 +160,7 @@ func (a *Agent) GetPodLogs(namespace string, name string, conn *websocket.Conn)
return
default:
}

bytes, err := r.ReadBytes('\n')
if writeErr := conn.WriteMessage(websocket.TextMessage, bytes); writeErr != nil {
errorchan <- writeErr
1 change: 1 addition & 0 deletions server/api/release_handler.go
Original file line number Diff line number Diff line change
@@ -437,6 +437,7 @@ func (app *App) HandleGetReleaseToken(w http.ResponseWriter, r *http.Request) {

// HandleUpgradeRelease upgrades a release with new values.yaml
func (app *App) HandleUpgradeRelease(w http.ResponseWriter, r *http.Request) {
fmt.Println("=========================================UPGRADE RELEASE============================================")
projID, err := strconv.ParseUint(chi.URLParam(r, "project_id"), 0, 64)

if err != nil || projID == 0 {

0 comments on commit 08e6fa8

Please sign in to comment.