Skip to content

Commit

Permalink
views: Add info view for ConsoleQuickStart
Browse files Browse the repository at this point in the history
Add an info-view for ConsoleQuickStart. It's not quite
the most useful API to add a view for, since it's basically
a tutorial for OpenShift-specific stuff, but there was data
available, so why not?

Signed-off-by: David Weinehall <[email protected]>
  • Loading branch information
taotriad committed Jul 4, 2023
1 parent 1ab2c0d commit 3cf8cea
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cmu
Original file line number Diff line number Diff line change
Expand Up @@ -7378,7 +7378,10 @@ def genericinfoloop(stdscr: curses.window, obj, view: str, **kwargs):
title_path = deep_get(kwargs, DictPath("title_path"))
if title_path is not None:
title = deep_get(obj, DictPath(title_path))
obj = deep_get(obj, DictPath(obj_path))
if obj_path != "":
obj = deep_get(obj, DictPath(obj_path))
else:
obj = [obj]

uip = UIProps(stdscr)

Expand Down
122 changes: 122 additions & 0 deletions views/ConsoleQuickStart.console.openshift.io.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,125 @@ listview:
field_indexes:
Normal:
fields: ["name", "age"]
infoview:
name: "Console Quick Start Info"
infopad:
row_indexes:
Normal:
fields: ["cluster_version", "display_name", "description", "duration", "tags"]
rows:
cluster_version:
header: [["Cluster ", ["main", "infoheader"]], ["V", ["main", "infoheader_shortcut"]], ["ersion:", ["main", "infoheader"]]]
paths:
- path: "metadata#ownerReferences"
pathtype: "items"
subpaths:
- "name"
when:
- key: "kind"
eq: "ClusterVersion"
default: "<none>"
description:
header: [["Description:", ["main", "infoheader"]]]
path: "spec#description"
type: "str"
display_name:
header: [["Display Name:", ["main", "infoheader"]]]
path: "spec#displayName"
type: "str"
duration:
header: [["Duration (min):", ["main", "infoheader"]]]
path: "spec#durationMinutes"
type: "str"
tags:
header: [["Tags:", ["main", "infoheader"]]]
path: "spec#tags"
type: "raw"
default: "<none>"
formatter: "list"
listpad:
on_activation:
call: "resourceinfodispatch"
kind: "__ResourceView"
formatter: "format_yaml"
obj_path: ""
title_path: "title"
listgetter: "listgetter_path"
listgetter_args:
path: "spec#tasks"
infogetter: "generic_infogetter"
field_indexes:
Normal:
fields: ["title"]
sortcolumn: "data"
fields:
title:
header: "Title:"
path: "title"
type: "str"
shortcuts:
"Cluster Version":
key: "v"
modifier: "shift"
read_only: true
helptext: "Open info page for Cluster Version"
action: "call"
action_call: "resourceinfodispatch_with_lookup"
action_args:
_pass_obj: true
owner_reference_path: "metadata#ownerReferences"
kind: "ClusterVersion"
api_family: "config.openshift.io"
"Conclusion":
key: "c"
modifier: "shift"
read_only: true
helptext: "Show conclusion"
action: "call"
action_call: "view_yaml"
action_args:
title: "Conclusion"
_pass_obj: true
path: "spec#conclusion"
"Introduction":
key: "i"
modifier: "shift"
read_only: true
helptext: "Show introduction"
action: "call"
action_call: "view_yaml"
action_args:
title: "Introduction"
_pass_obj: true
path: "spec#introduction"
"Show prerequisites":
key: "p"
modifier: "shift"
read_only: true
helptext: "List prerequisites (if any)"
widget: "windowwidget"
title: "Prerequisites:"
itemgetter: "get_list_as_list"
itemgetter_args:
path: "spec#prerequisites"
# Not supported for now
sortcolumn: "name"
"Show Next Quickstart":
key: "q"
modifier: "shift"
read_only: true
helptext: "List next QuickStart (if any)"
widget: "windowwidget"
title: "Name:"
selectable: true
itemgetter: "get_list_as_list"
itemgetter_args:
path: "spec#nextQuickStart"
# Not supported for now
sortcolumn: "name"
action: "call"
action_call: "resourceinfodispatch_with_lookup"
action_args:
kind: "ConsoleQuickStart"
api_family: "console.openshift.io"
name_path: 0
2 changes: 1 addition & 1 deletion views/__ResourceView.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ default_command: "__"
infoview:
name: "Resource Viewer"
logpad:
timestamps: false
infogetter: "get_themearrays"
timestamps: false
shortcuts:
# __ResourceView has no last applied configuration or events, and is a YAML-viewer so cannot view itself...
"Show Events": null
Expand Down

0 comments on commit 3cf8cea

Please sign in to comment.