Skip to content

TFT: Tilt has a button that allows user to create a snapshot and share the link#2054

Merged
hyu merged 8 commits into
masterfrom
tilt_snapshot_button
Aug 13, 2019
Merged

TFT: Tilt has a button that allows user to create a snapshot and share the link#2054
hyu merged 8 commits into
masterfrom
tilt_snapshot_button

Conversation

@mariavivanco

Copy link
Copy Markdown
Contributor

Screen Shot 2019-08-13 at 5 40 52 PM

Screen Shot 2019-08-13 at 5 41 01 PM

finally works end to end ! 😎

dummy handlefunc for handle new snapshot

HUD server passes along payload

With tests

dummy "get link" button on topbar

create state object in ts

button console prints entire state

sendSnapshot function that sends ...snapshot/adding TODO comments

run make wire

made snapshot type different than hud state (deleted alertlinks)/ran prettier

handlesnapshot() returns snapshot URL in json

button opens up a new tab with URL

button does fancy URL thing

fix snapshot test to use fake client

merge w master

add test for snapshot + add snap json file

dummy handlefunc for handle new snapshot

HUD server passes along payload

With tests

dummy "get link" button on topbar

button console prints entire state

run make wire

made snapshot type different than hud state (deleted alertlinks)/ran prettier

handlesnapshot() returns snapshot URL in json

button opens up a new tab with URL

fix snapshot test to use fake client
Comment thread internal/hud/server/server.go Outdated
return
}

request, err := http.NewRequest(http.MethodPost, "https://alerts.tilt.dev/api/snapshot/new", req.Body) // New request

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
request, err := http.NewRequest(http.MethodPost, "https://alerts.tilt.dev/api/snapshot/new", req.Body) // New request
request, err := http.NewRequest(http.MethodPost, "https://alerts.tilt.dev/api/snapshot/new", req.Body)

Comment thread internal/hud/server/server_test.go Outdated
Comment thread internal/tft/client/client.go Outdated
Comment thread web/src/HUD.tsx
method: "post",
body: JSON.stringify(snapshot),
})
.then(res => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this promise could be re-written more idiomatically as:

fetch()
  .then(res => res.json)
  .then((value: NewSnapshotResponse) => {
            this.setState({
              SnapshotLink: value.url,
            })
  })
  .catch(err => console.error(err)

then the same catch will handle everything.

Comment thread web/src/TopBar.tsx Outdated
@hyu
hyu merged commit 725d14f into master Aug 13, 2019
@nicks
nicks deleted the tilt_snapshot_button branch February 3, 2022 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants