1"use strict";(globalThis.webpackChunkmission_control=globalThis.webpackChunkmission_control||[]).push([[1994],{56113(e,n,t){t(96540);var s=t(21733),i=t(92224),r=t(34164),a=t(74848);t.d(n,["C",0,({columns:e=3,gap:n="gap-x-4 gap-y-4",children:t})=>(0,a.jsx)("div",{className:(0,r.A)("text-slate-900 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",n),children:t}),"Z",0,({title:e,icon:n,size:t="md",height:o="min-h-20 md:min-h-32",link:c,href:l,variant:d="primary",bordered:m=!0,padded:p=!0,sidebar:u,children:h})=>{c=c||l,u&&(c=u.href,u.customProps?.icon&&(n=(0,a.jsx)(i.A,{name:u.customProps?.icon})),e=u.label),n&&"string"==typeof n&&(n=(0,a.jsx)(i.A,{name:n}));const g=(0,a.jsx)("div",{className:(0,r.A)(o,"flex rounded-lg",m&&"border border-slate-200 border-solid hover:border-slate-300 hover:shadow-lg",p&&"md"==t&&"p-2 sm:p-5",p&&"sm"==t&&"p-1 sm:p-2",t),children:(0,a.jsxs)("div",{className:"items-start flex-col flex-grow justify-around flex",children:[(0,a.jsxs)("span",{className:"flex flex-row items-center space-x-1 ",children:[n&&n,(0,a.jsx)("span",{className:(0,r.A)("md"==t&&"text-2xl","sm"==t&&"text-xl"),children:e})]}),h]})});return c?(0,a.jsx)(s.A,{to:c,className:"unstyled ",children:g}):g}])},92224(e,n,t){t.d(n,{A:()=>c});t(96540);var s=t(97486),i=t(37399),r=t(91406),a=t(34164),o=t(74848);function c({name:e,height:n=22,className:t,url:c,children:l,...d}){if("config-db"==(e=e.replaceAll("--","-").replaceAll("::","-").toLowerCase().replaceAll("k8-","k8s-").replaceAll("kubernetes-","k8s-")))return(0,o.jsx)(r.ntS,{...d});if("canary-checker"==e&&(e="heart"),"getting-started"==e&&(e="lsicon:path-outline"),"concepts"==e&&(e="fluent:brain-circuit-24-regular"),"events"==e&&(e="carbon:lightning"),"tutorial"==e&&(e="learning"),"dedupe"==e)return(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"20",height:"20",viewBox:"0 0 50 50",children:(0,o.jsx)("path",{d:"M 17 4 L 17 6 L 44 6 L 44 40 L 36 40 L 36 42 L 46 42 L 46 4 L 17 4 z M 4 8 L 4 46 L 34 46 L 34 45 L 34 8 L 4 8 z M 6 10 L 32 10 L 32 44 L 6 44 L 6 10 z M 18 20 L 18 26 L 12 26 L 12 28 L 18 28 L 18 34 L 20 34 L 20 28 L 26 28 L 26 26 L 20 26 L 20 20 L 18 20 z"})});if("rate-limit"==e)return(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",...d,width:"20",height:"20",viewBox:"0 0 50 50",children:(0,o.jsx)("path",{d:"M 25 2 C 12.316406 2 2 12.316406 2 25 C 2 37.683594 12.316406 48 25 48 C 37.683594 48 48 37.683594 48 25 C 48 12.316406 37.683594 2 25 2 Z M 32.5 16.1875 C 37.601563 16.1875 38.09375 21.007813 38.09375 22.90625 C 38.09375 23.605469 38.09375 24.210938 38.09375 24.8125 C 38.09375 30.3125 36.90625 33.40625 32.40625 33.40625 C 28.90625 33.40625 26.6875 31.511719 26.6875 24.8125 C 26.789063 18.914063 28.398438 16.1875 32.5 16.1875 Z M 14.3125 16.5 L 22.6875 16.5 L 22.6875 18.3125 L 15.90625 18.3125 L 15 23.1875 C 15.699219 22.488281 16.789063 22 18.1875 22 C 22.585938 22 23.6875 25.511719 23.6875 27.8125 C 23.6875 31.511719 20.886719 33.40625 17.6875 33.40625 C 13.789063 33.40625 12.3125 30.59375 12.3125 28.59375 L 14.3125 28.59375 C 14.3125 29.695313 15.207031 31.6875 17.90625 31.6875 C 20.605469 31.6875 21.5 29.289063 21.5 27.6875 C 21.5 25.1875 19.6875 23.8125 17.6875 23.8125 C 15.988281 23.8125 14.898438 24.90625 14.5 25.40625 L 12.6875 25.3125 Z M 32.5 17.90625 C 29.898438 17.90625 29 20.507813 29 23.40625 L 29 24.8125 C 29 29.8125 30 31.6875 32.5 31.6875 C 34.699219 31.6875 36 30.210938 36 24.8125 L 36 23.40625 C 36 21.707031 35.601563 17.90625 32.5 17.90625 Z"})});if("scraper"==e)return(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",...d,viewBox:"0 0 50 50",children:(0,o.jsx)("path",{d:"M 28.992188 7 C 23.983187 7 19.408891 9.4429063 17.212891 13.878906 C 16.077891 13.127906 14.747469 12.722656 13.355469 12.722656 C 9.6514687 12.722656 6.6102812 15.610953 6.3632812 19.251953 C 2.5812812 20.629953 1.1842379e-15 24.258078 0 28.330078 C 0 33.662078 4.3379219 38 9.6699219 38 L 24.179688 38 C 24.069688 37.348 24 36.683 24 36 C 24 29.373 29.373 24 36 24 C 42.218 24 47.330453 28.728156 47.939453 34.785156 C 49.224453 33.242156 50 31.260609 50 29.099609 C 50 24.538609 46.554906 20.767859 42.128906 20.255859 C 42.138906 20.064859 42.142578 19.878312 42.142578 19.695312 C 42.142578 12.444312 36.243188 7 28.992188 7 z M 36 26 C 30.488997 26 26 30.488997 26 36 C 26 41.511003 30.488997 46 36 46 C 38.396508 46 40.597385 45.148986 42.322266 43.736328 L 48.292969 49.707031 L 49.707031 48.292969 L 43.736328 42.322266 C 45.148986 40.597385 46 38.396508 46 36 C 46 30.488997 41.511003 26 36 26 z M 36 28 C 40.430123 28 44 31.569877 44 36 C 44 40.430123 40.430123 44 36 44 C 31.569877 44 28 40.430123 28 36 C 28 31.569877 31.569877 28 36 28 z"})});let m=s.GtP[e];
1if(!m)return(0,o.jsx)(i.In,{icon:e,...d,height:20,width:20});let p=(0,o.jsxs)("div",{className:"inline-block spacing-x-2",children:[(0,o.jsx)(m,{className:(0,a.A)("align-middle",t),name:e,size:n,...d}),(0,o.jsx)("span",{children:l})]});return null!=c?(0,o.jsx)("a",{href:c,children:p}):p}},39925(e,n,t){t.d(n,{A:()=>o});t(96540);var s=t(56113),i=(t(73985),t(56971)),r=t(74848);function a({className:e}){const n=(0,i.$S)();return(0,r.jsx)(o,{items:n.items,className:e})}function o(e){const{items:n,className:t}=e;if(!n)return(0,r.jsx)(a,{});(0,i.d1)(n).filter(e=>!(e.customProps&&e.customProps.category));return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(s.C,{children:e.items.map((e,n)=>e.customProps&&e.customProps.category?null:(0,r.jsx)(s.Z,{sidebar:e},n))})})}},21733(e,n,t){t.d(n,{A:()=>r});t(96540);var s=t(68957),i=t(74848);function r(e){return(0,i.jsx)(s.A,{...e})}},73103(e,n,t){t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>c,default:()=>p,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guide/views/table/columns/index","title":"Columns","description":"Tables define the structure and display of view data. Each column has a type that controls how values are rendered and filtered.","source":"@site/docs/guide/views/table/columns/index.mdx","sourceDirName":"guide/views/table/columns","slug":"/guide/views/table/columns/","permalink":"/docs/guide/views/table/columns/","draft":false,"unlisted":false,"editUrl":"https://github.com/flanksource/docs/tree/main/docs/guide/views/table/columns/index.mdx","tags":[],"version":"current","frontMatter":{"title":"Columns","sidebar_custom_props":{"icon":"mdi:table-column"}},"sidebar":"guide","previous":{"title":"Table","permalink":"/docs/guide/table"},"next":{"title":"Badge","permalink":"/docs/guide/views/table/columns/badge"}}');var i=t(74848),r=t(28453),a=t(39925);const o={title:"Columns",sidebar_custom_props:{icon:"mdi:table-column"}},c=void 0,l={},d=[{value:"Column Definition",id:"column-definition",level:2},{value:"Example",id:"example",level:2},{value:"Common Properties",id:"common-properties",level:2},{value:"Card Positioning",id:"card-positioning",level:2},{value:"Column Types",id:"column-types",level:2}];function m(e){const n={code:"code",h2:"h2",li:"li",p:"p",pre:"pre",ul:"ul",...(0,r.R)(),...e.components},{ColumnDef:t}=n;return t||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("ColumnDef",!0),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.p,{children:"Tables define the structure and display of view data. Each column has a type that controls how values are rendered and filtered."}),"\n",(0,i.jsx)(n.h2,{id:"column-definition",children:"Column Definition"}),"\n",(0,i.jsxs)(n.p,{children:["Columns are defined in ",(0,i.jsx)(n.code,{children:"spec.columns"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-yaml",children:'columns:\n - name: pod_name # Column identifier (used in mapping)\n type: string # Column type\n primaryKey: true # At least one column must be a primary key\n description: "Pod name"\n'})}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.p,{children:"This example demonstrates multiple column types including gauge, status, health, datetime, and card positioning:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-yaml",metastring:'title="namespace.yaml" file=<rootDir>/modules/mission-control/fixtures/views/namespace.yaml {7-65}',children:'apiVersion: mission-control.flanksource.com/v1\nkind: View\nmetadata:\n name: namespace\n namespace: mc\nspec:\n columns:\n - cardPosition: title\n name: name\n primaryKey: true\n type: config_item\n url:\n config: row.id\n - cardPosition: deck\n filter:\n type: multiselect\n icon: row.health\n name: status\n type: status\n - filter:\n type: multiselect\n hidden: true\n name: health\n type: health\n - cardPosition: deck\n description: Memory usage\n gauge:\n max: row.memory_limit\n thresholds:\n - color: green\n percent: 0\n - color: orange\n percent: 75\n - color: red\n percent: 90\n name: memory\n type: gauge\n unit: bytes\n - cardPosition: deck\n gauge:\n max: row.cpu_limit\n thresholds:\n - color: "#8BC34A"\n percent: 0\n - color: "#F4B23C"\n percent: 70\n - color: "#F25C54"\n percent: 85\n name: cpu\n type: gauge\n unit: millicore\n - cardPosition: footer\n name: updated\n type: datetime\n - cardPosition: footer\n name: created\n type: datetime\n - cardPosition: body\n hidden: true\n name: image\n type: string\n - cardPosition: body\n hidden: true\n name: node\n type: string\n description: View for inspecting a Kubernetes Namespace\n display:\n icon: namespace\n plugins:\n - configTab:\n types:\n - Kubernetes::Namespace\n variables:\n cluster: $(.config.tags.cluster)\n namespace: $(.config.name)\n sidebar: true\n title: Namespace\n mapping:\n created: row.created_at\n image: |\n has(row.config) ? row.config.JSON().spec.containers[0].image : "N/A"\n node: |\n has(row.config) ? (has(row.config.JSON().spec.nodeName) ? row.config.JSON().spec.nodeName : "N/A"): "N/A"\n updated: row.updated_at\n merge: |\n "SELECT\n pod.id,\n pod.name,\n json_extract(pod.tags, \'$.namespace\')\n AS namespace,\n pod.status,\n pod.health,\n pod.config,\n pod.created_at,\n pod.updated_at,\n memory.value as memory,\n to_bytes(COALESCE(\n json_extract(pod.config,\n \'$.spec.containers[0].resources.limits.memory\'), \n \'\'\n )) AS memory_limit,\n cpu.value as cpu,\n to_millicores(COALESCE(\n json_extract(pod.config, \'$.spec.containers[0].resources.limits.cpu\'),\n \n \'\'\n )) AS cpu_limit\\nFROM pod\\nLEFT JOIN memory\n ON pod.name = memory.pod\n \n AND json_extract(pod.tags, \'$.namespace\') = memory.namespace\\nLEFT JOIN cpu\n ON pod.name = cpu.pod \n AND json_extract(pod.tags, \'$.namespace\') = cpu.namespace\\nORDER\n BY namespace, name\n "\n panels:\n - description: Total Pods in the namespace\n name: Total Pods\n query: SELECT COUNT(*) AS value FROM pod\n type: number\n queries:\n cpu:\n columns:\n namespace: string\n pod: string\n value: decimal\n prometheus:\n bearer: {}\n connection: connection://mc/prometheus\n oauth:\n clientID: {}\n clientSecret: {}\n password: {}\n query: |\n sum by (namespace, pod) (\n irate(container_
1cpu_usage_seconds_total{\n container!="POD", # Skip The pause/infra container\n image!="" # Skip dead containers\n }[30s])\n ) * 1000\n tls:\n ca: {}\n cert: {}\n key: {}\n username: {}\n memory:\n columns:\n namespace: string\n pod: string\n value: decimal\n prometheus:\n bearer: {}\n connection: connection://mc/prometheus\n oauth:\n clientID: {}\n clientSecret: {}\n password: {}\n query: |\n sum by (namespace, pod) (\n container_memory_working_set_bytes{\n container!="POD", # Skip The pause/infra container\n image!="" # Skip dead containers\n }\n )\n tls:\n ca: {}\n cert: {}\n key: {}\n username: {}\n memory_usage:\n columns:\n namespace: string\n pod: string\n value: decimal\n prometheus:\n bearer: {}\n connection: connection://mc/prometheus\n oauth:\n clientID: {}\n clientSecret: {}\n password: {}\n query: |\n sum(rate(container_memory_working_set_bytes{namespace=~"$(.var.namespace)", image!=""}[5m])) / sum(machine_memory_bytes{})\n tls:\n ca: {}\n cert: {}\n key: {}\n username: {}\n pod:\n configs:\n agent: all\n tagSelector: cluster=$(.var.cluster),namespace=$(.var.namespace)\n types:\n - Kubernetes::Pod\n templating:\n - key: cluster\n label: Cluster\n valueFrom:\n config:\n types:\n - Kubernetes::Cluster\n - dependsOn:\n - cluster\n key: namespace\n label: Namespace\n valueFrom:\n config:\n tagSelector: cluster=$(.var.cluster)\n types:\n - Kubernetes::Namespace\nstatus: {}\n'})}),"\n",(0,i.jsx)(n.h2,{id:"common-properties",children:"Common Properties"}),"\n",(0,i.jsx)(n.p,{children:"All column types share these properties. Each type page lists any additional type-specific fields."}),"\n",(0,i.jsx)(t,{}),"\n",(0,i.jsx)(n.h2,{id:"card-positioning",children:"Card Positioning"}),"\n",(0,i.jsxs)(n.p,{children:["Columns can be positioned in card layouts using ",(0,i.jsx)(n.code,{children:"card.position"}),":"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"title"})," - Card title area"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"subtitle"})," - Subtitle area"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"deck"})," - Header area after subtitle"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"body"})," - Main content area"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"footer"})," - Footer area"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"headerRight"})," - Right side of header"]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Set ",(0,i.jsx)(n.code,{children:"card.useForAccent: true"})," on a column (typically ",(0,i.jsx)(n.code,{children:"health"})," or ",(0,i.jsx)(n.code,{children:"status"}),") to use its value as the card accent color."]}),"\n",(0,i.jsx)(n.h2,{id:"column-types",children:"Column Types"}),"\n","\n",(0,i.jsx)(a.A,{})]})}function p(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(m,{...e})}):m(e)}},28453(e,n,t){t.d(n,{R:()=>a,x:()=>o});var s=t(96540);const i={},r=s.createContext(i);function a(e){const n=s.useContext(r);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:a(e.components),s.createElement(r.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.