|
19 | 19 | bucketInfoValStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("#CDD6F4")) |
20 | 20 | bucketInfoErrorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#F28FAD")) |
21 | 21 | bucketInfoLabelsStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("#F5C2E7")) |
| 22 | + bucketInfoLinkStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#89B4FA")).Underline(true) |
22 | 23 | ) |
23 | 24 |
|
24 | 25 | func (m *Model) renderSpinner() string { |
@@ -207,6 +208,9 @@ func (m *Model) previewView(width int) string { |
207 | 208 |
|
208 | 209 | displayName := getDisplayName(prefix.Name, m.currentPrefix) |
209 | 210 | fmt.Fprintf(&s, "%s %s\n", keyStyle.Render("Name:"), valStyle.Render(truncate(displayName, width-10))) |
| 211 | + folderURL := fmt.Sprintf("https://console.cloud.google.com/storage/browser/%s/%s;tab=objects?project=%s", m.currentBucket, strings.TrimSuffix(prefix.Name, "/"), m.currentProjectID) |
| 212 | + fmt.Fprintf(&s, "%s %s\n", keyStyle.Render("Console Link:"), valStyle.Render(terminalHyperlink(folderURL, bucketInfoLinkStyle.Render("Link")))) |
| 213 | + |
210 | 214 | if !prefix.Fetched { |
211 | 215 | fmt.Fprintf(&s, "%s %s\n", keyStyle.Render("Type:"), valStyle.Render("Folder")) |
212 | 216 | fmt.Fprintf(&s, "\n%s Loading metadata...\n", m.renderSpinner()) |
@@ -239,6 +243,9 @@ func (m *Model) previewView(width int) string { |
239 | 243 | if m.showMetadata { |
240 | 244 | // Detailed Metadata View |
241 | 245 | fmt.Fprintf(&s, "%s %s\n", keyStyle.Render("Name:"), valStyle.Render(truncate(obj.Name, width-10))) |
| 246 | + objectURL := fmt.Sprintf("https://console.cloud.google.com/storage/browser/_details/%s/%s?project=%s", m.currentBucket, obj.Name, m.currentProjectID) |
| 247 | + fmt.Fprintf(&s, "%s %s\n", keyStyle.Render("Console Link:"), valStyle.Render(terminalHyperlink(objectURL, bucketInfoLinkStyle.Render("Link")))) |
| 248 | + |
242 | 249 | fmt.Fprintf(&s, "%s %s\n", keyStyle.Render("Bucket:"), valStyle.Render(truncate(obj.Bucket, width-12))) |
243 | 250 | s.WriteString("\n") |
244 | 251 |
|
@@ -295,6 +302,9 @@ func (m *Model) previewView(width int) string { |
295 | 302 | // Standard Preview |
296 | 303 | displayName := getDisplayName(obj.Name, m.currentPrefix) |
297 | 304 | fmt.Fprintf(&s, "%s %s\n", keyStyle.Render("Name:"), valStyle.Render(truncate(displayName, width-10))) |
| 305 | + objectURL := fmt.Sprintf("https://console.cloud.google.com/storage/browser/_details/%s/%s?project=%s", m.currentBucket, obj.Name, m.currentProjectID) |
| 306 | + fmt.Fprintf(&s, "%s %s\n", keyStyle.Render("Console Link:"), valStyle.Render(terminalHyperlink(objectURL, bucketInfoLinkStyle.Render("Link")))) |
| 307 | + |
298 | 308 | fmt.Fprintf(&s, "%s %s\n", keyStyle.Render("Size:"), valStyle.Render(humanizeSize(obj.Size))) |
299 | 309 |
|
300 | 310 | contentType := obj.ContentType |
@@ -404,7 +414,9 @@ func (m *Model) previewView(width int) string { |
404 | 414 | if m.cursor < len(filtered) { |
405 | 415 | item := filtered[m.cursor] |
406 | 416 | if item.IsProject { |
407 | | - s.WriteString(bucketInfoProjectStyle.Render("Project: ") + item.ProjectID + "\n\n") |
| 417 | + s.WriteString(bucketInfoProjectStyle.Render("Project: ") + item.ProjectID + "\n") |
| 418 | + projectURL := fmt.Sprintf("https://console.cloud.google.com/welcome?project=%s", item.ProjectID) |
| 419 | + fmt.Fprintf(&s, "%s %s\n\n", bucketInfoKeyStyle.Render("Console Link:"), bucketInfoValStyle.Render(terminalHyperlink(projectURL, bucketInfoLinkStyle.Render("Link")))) |
408 | 420 |
|
409 | 421 | if m.previewContent == "Loading project info..." || m.previewContent == clearImagesEsc+"Loading project info..." { |
410 | 422 | fmt.Fprintf(&s, "\n%s Loading project info...\n", m.renderSpinner()) |
@@ -449,6 +461,8 @@ func (m *Model) previewView(width int) string { |
449 | 461 | } |
450 | 462 | } else { |
451 | 463 | fmt.Fprintf(&s, "%s %s\n", bucketInfoKeyStyle.Render("Bucket:"), bucketInfoValStyle.Render(truncate(item.BucketName, width-10))) |
| 464 | + bucketURL := fmt.Sprintf("https://console.cloud.google.com/storage/browser/%s?project=%s", item.BucketName, item.ProjectID) |
| 465 | + fmt.Fprintf(&s, "%s %s\n\n", bucketInfoKeyStyle.Render("Console Link:"), bucketInfoValStyle.Render(terminalHyperlink(bucketURL, bucketInfoLinkStyle.Render("Link")))) |
452 | 466 |
|
453 | 467 | if m.previewContent == "Loading..." || m.previewContent == clearImagesEsc+"Loading..." { |
454 | 468 | fmt.Fprintf(&s, "\n%s Loading metadata...\n", m.renderSpinner()) |
|
0 commit comments