pub struct Column {
pub id: String,
pub head: Option<Text>,
pub align: Option<TextAlign>,
pub truncate: Option<Truncate>,
pub priority: Option<f64>,
pub grow: Option<f64>,
pub mono: Option<bool>,
pub sortable: Option<bool>,
}Expand description
A table column.
Fields§
§id: StringThe key of this column’s cell in each row.
head: Option<Text>Header text.
align: Option<TextAlign>Alignment of the header and cells.
truncate: Option<Truncate>Where a cell that doesn’t fit is cut.
priority: Option<f64>Lower hides first when the table is narrow.
grow: Option<f64>Share of the spare width.
mono: Option<bool>Cells in the mono face (ids, hashes, numbers).
sortable: Option<bool>Its header takes clicks and sends action sort.
Implementations§
Source§impl Column
impl Column
Sourcepub fn new(id: impl Into<String>, head: impl Into<Text>) -> Self
pub fn new(id: impl Into<String>, head: impl Into<Text>) -> Self
A column with header head.
Examples found in repository?
examples/table.rs (line 56)
43fn view(entries: &[Entry]) -> View {
44 let rows = entries.iter().map(|e| {
45 let (name, icon) = if e.dir {
46 (format!("{}/", e.name), "folder")
47 } else {
48 (e.name.clone(), "file")
49 };
50 let size = if e.dir { "-".to_owned() } else { human(e.size) };
51 TableRow::new(e.name.clone())
52 .cell("name", TextCell::new(name).icon(icon))
53 .cell("size", size)
54 });
55 View::new().main([ui::table()
56 .col(Column::new("name", "Name").grow(1.0))
57 .col(Column::new("size", "Size").align(TextAlign::End).mono(true))
58 .rows(rows.collect::<Vec<_>>())])
59}More examples
examples/dashboard.rs (line 853)
850 fn services_table(&self) -> ui::Table<Msg> {
851 let mut table = self
852 .table(Page::Services, "No services yet")
853 .col(Column::new("name", "Service").grow(1.0).priority(6.0))
854 .col(Column::new("region", "Region").priority(3.0))
855 .col(Column::new("version", "Version").mono(true).priority(2.0))
856 .col(Column::new("traffic", "Traffic").priority(1.0))
857 .col(
858 Column::new("rps", "req/s")
859 .align(TextAlign::End)
860 .mono(true)
861 .priority(4.0),
862 )
863 .col(
864 Column::new("p95", "p95")
865 .align(TextAlign::End)
866 .mono(true)
867 .priority(4.0),
868 )
869 .col(
870 Column::new("errors", "Errors")
871 .align(TextAlign::End)
872 .mono(true)
873 .priority(4.0),
874 )
875 .col(Column::new("health", "Health").priority(5.0));
876 for s in &self.services {
877 let (label, tone) = s.health.look();
878 let mut errors = TextCell::new(format!("{:.1}%", s.errors));
879 if s.errors >= 1.0 {
880 errors = errors.tone(Tone::Error);
881 }
882 table = table.row(
883 TableRow::new(s.id)
884 .cell("name", TextCell::new(s.id).dot(tone.clone()))
885 .cell("region", s.region)
886 .cell("version", s.version)
887 .cell("traffic", SparkCell::new(s.rps.clone()))
888 .cell("rps", format!("{:.0}", s.rps.last().copied().unwrap_or_default()))
889 .cell("p95", format!("{:.0} ms", s.p95))
890 .cell("errors", errors)
891 .cell("health", BadgeSpec::new(label).tone(tone)),
892 );
893 }
894 table
895 }
896
897 /// The deploys toolbar: a muted description and the filter.
898 fn deploys_bar(&self) -> ui::Row<Msg> {
899 let attention = self
900 .deploys
901 .iter()
902 .filter(|d| matches!(d.state, State::Waiting | State::Failed))
903 .count();
904 ui::row()
905 .key("bar")
906 .justify("between")
907 .align("center")
908 .child(
909 ui::text(ui::span("Rollouts to production, newest first").style("muted")).key("about"),
910 )
911 .child(
912 ui::tabs()
913 .key("filter")
914 .variant("segmented")
915 .active(self.filter.clone())
916 .tab("all", "All")
917 .tab("attention", spans![
918 "Needs you ",
919 ui::span(attention.to_string()).style("muted")
920 ])
921 .on_select(|id| Msg::Filter(id.to_owned())),
922 )
923 }
924
925 /// The deploys table.
926 fn deploys_table(&self) -> ui::Table<Msg> {
927 let mut table = self
928 .table(Page::Deploys, "Nothing needs you right now")
929 .col(Column::new("service", "Service").grow(1.0).priority(6.0))
930 .col(Column::new("commit", "Commit").mono(true).priority(3.0))
931 .col(Column::new("region", "Region").priority(2.0))
932 .col(Column::new("traffic", "Traffic").priority(1.0))
933 .col(Column::new("rollout", "Rollout").priority(1.0))
934 .col(Column::new("state", "State").priority(5.0));
935 for d in self.shown_deploys() {
936 let (label, tone) = d.state.look();
937 table = table.row(
938 TableRow::new(d.id)
939 .cell("service", TextCell::new(d.service).dot(tone.clone()))
940 .cell("commit", d.commit)
941 .cell("region", d.region)
942 .cell("traffic", SparkCell::new(d.rps.clone()))
943 .cell("rollout", MeterCell {
944 value: Some(d.done),
945 title: Some(format!("{:.0}%", d.done * 100.0)),
946 ..MeterCell::default()
947 })
948 .cell("state", BadgeSpec::new(label).tone(tone)),
949 );
950 }
951 table
952 }
953
954 /// The incidents table.
955 fn incidents_table(&self) -> ui::Table<Msg> {
956 let mut table = self
957 .table(Page::Incidents, "No incidents. All quiet.")
958 .col(Column::new("title", "Incident").grow(1.0).priority(6.0))
959 .col(Column::new("id", "Id").mono(true).priority(2.0))
960 .col(Column::new("service", "Service").priority(3.0))
961 .col(Column::new("severity", "Severity").priority(4.0))
962 .col(
963 Column::new("age", "Open for")
964 .align(TextAlign::End)
965 .mono(true)
966 .priority(4.0),
967 )
968 .col(Column::new("phase", "State").priority(5.0));
969 for i in &self.incidents {
970 let (sev, sev_tone) = i.severity.look();
971 let (phase, phase_tone) = i.phase.look();
972 table = table.row(
973 TableRow::new(i.id)
974 .cell("title", TextCell::new(i.title).dot(sev_tone.clone()))
975 .cell("id", i.id)
976 .cell("service", i.service)
977 .cell("severity", BadgeSpec::new(sev).tone(sev_tone))
978 .cell("age", ago(i.age))
979 .cell("phase", BadgeSpec::new(phase).tone(phase_tone)),
980 );
981 }
982 table
983 }Sourcepub fn align(self, align: impl Into<TextAlign>) -> Self
pub fn align(self, align: impl Into<TextAlign>) -> Self
Sets the alignment.
Examples found in repository?
examples/table.rs (line 57)
43fn view(entries: &[Entry]) -> View {
44 let rows = entries.iter().map(|e| {
45 let (name, icon) = if e.dir {
46 (format!("{}/", e.name), "folder")
47 } else {
48 (e.name.clone(), "file")
49 };
50 let size = if e.dir { "-".to_owned() } else { human(e.size) };
51 TableRow::new(e.name.clone())
52 .cell("name", TextCell::new(name).icon(icon))
53 .cell("size", size)
54 });
55 View::new().main([ui::table()
56 .col(Column::new("name", "Name").grow(1.0))
57 .col(Column::new("size", "Size").align(TextAlign::End).mono(true))
58 .rows(rows.collect::<Vec<_>>())])
59}More examples
examples/dashboard.rs (line 859)
850 fn services_table(&self) -> ui::Table<Msg> {
851 let mut table = self
852 .table(Page::Services, "No services yet")
853 .col(Column::new("name", "Service").grow(1.0).priority(6.0))
854 .col(Column::new("region", "Region").priority(3.0))
855 .col(Column::new("version", "Version").mono(true).priority(2.0))
856 .col(Column::new("traffic", "Traffic").priority(1.0))
857 .col(
858 Column::new("rps", "req/s")
859 .align(TextAlign::End)
860 .mono(true)
861 .priority(4.0),
862 )
863 .col(
864 Column::new("p95", "p95")
865 .align(TextAlign::End)
866 .mono(true)
867 .priority(4.0),
868 )
869 .col(
870 Column::new("errors", "Errors")
871 .align(TextAlign::End)
872 .mono(true)
873 .priority(4.0),
874 )
875 .col(Column::new("health", "Health").priority(5.0));
876 for s in &self.services {
877 let (label, tone) = s.health.look();
878 let mut errors = TextCell::new(format!("{:.1}%", s.errors));
879 if s.errors >= 1.0 {
880 errors = errors.tone(Tone::Error);
881 }
882 table = table.row(
883 TableRow::new(s.id)
884 .cell("name", TextCell::new(s.id).dot(tone.clone()))
885 .cell("region", s.region)
886 .cell("version", s.version)
887 .cell("traffic", SparkCell::new(s.rps.clone()))
888 .cell("rps", format!("{:.0}", s.rps.last().copied().unwrap_or_default()))
889 .cell("p95", format!("{:.0} ms", s.p95))
890 .cell("errors", errors)
891 .cell("health", BadgeSpec::new(label).tone(tone)),
892 );
893 }
894 table
895 }
896
897 /// The deploys toolbar: a muted description and the filter.
898 fn deploys_bar(&self) -> ui::Row<Msg> {
899 let attention = self
900 .deploys
901 .iter()
902 .filter(|d| matches!(d.state, State::Waiting | State::Failed))
903 .count();
904 ui::row()
905 .key("bar")
906 .justify("between")
907 .align("center")
908 .child(
909 ui::text(ui::span("Rollouts to production, newest first").style("muted")).key("about"),
910 )
911 .child(
912 ui::tabs()
913 .key("filter")
914 .variant("segmented")
915 .active(self.filter.clone())
916 .tab("all", "All")
917 .tab("attention", spans![
918 "Needs you ",
919 ui::span(attention.to_string()).style("muted")
920 ])
921 .on_select(|id| Msg::Filter(id.to_owned())),
922 )
923 }
924
925 /// The deploys table.
926 fn deploys_table(&self) -> ui::Table<Msg> {
927 let mut table = self
928 .table(Page::Deploys, "Nothing needs you right now")
929 .col(Column::new("service", "Service").grow(1.0).priority(6.0))
930 .col(Column::new("commit", "Commit").mono(true).priority(3.0))
931 .col(Column::new("region", "Region").priority(2.0))
932 .col(Column::new("traffic", "Traffic").priority(1.0))
933 .col(Column::new("rollout", "Rollout").priority(1.0))
934 .col(Column::new("state", "State").priority(5.0));
935 for d in self.shown_deploys() {
936 let (label, tone) = d.state.look();
937 table = table.row(
938 TableRow::new(d.id)
939 .cell("service", TextCell::new(d.service).dot(tone.clone()))
940 .cell("commit", d.commit)
941 .cell("region", d.region)
942 .cell("traffic", SparkCell::new(d.rps.clone()))
943 .cell("rollout", MeterCell {
944 value: Some(d.done),
945 title: Some(format!("{:.0}%", d.done * 100.0)),
946 ..MeterCell::default()
947 })
948 .cell("state", BadgeSpec::new(label).tone(tone)),
949 );
950 }
951 table
952 }
953
954 /// The incidents table.
955 fn incidents_table(&self) -> ui::Table<Msg> {
956 let mut table = self
957 .table(Page::Incidents, "No incidents. All quiet.")
958 .col(Column::new("title", "Incident").grow(1.0).priority(6.0))
959 .col(Column::new("id", "Id").mono(true).priority(2.0))
960 .col(Column::new("service", "Service").priority(3.0))
961 .col(Column::new("severity", "Severity").priority(4.0))
962 .col(
963 Column::new("age", "Open for")
964 .align(TextAlign::End)
965 .mono(true)
966 .priority(4.0),
967 )
968 .col(Column::new("phase", "State").priority(5.0));
969 for i in &self.incidents {
970 let (sev, sev_tone) = i.severity.look();
971 let (phase, phase_tone) = i.phase.look();
972 table = table.row(
973 TableRow::new(i.id)
974 .cell("title", TextCell::new(i.title).dot(sev_tone.clone()))
975 .cell("id", i.id)
976 .cell("service", i.service)
977 .cell("severity", BadgeSpec::new(sev).tone(sev_tone))
978 .cell("age", ago(i.age))
979 .cell("phase", BadgeSpec::new(phase).tone(phase_tone)),
980 );
981 }
982 table
983 }Sourcepub const fn grow(self, grow: f64) -> Self
pub const fn grow(self, grow: f64) -> Self
Sets the grow share.
Examples found in repository?
examples/table.rs (line 56)
43fn view(entries: &[Entry]) -> View {
44 let rows = entries.iter().map(|e| {
45 let (name, icon) = if e.dir {
46 (format!("{}/", e.name), "folder")
47 } else {
48 (e.name.clone(), "file")
49 };
50 let size = if e.dir { "-".to_owned() } else { human(e.size) };
51 TableRow::new(e.name.clone())
52 .cell("name", TextCell::new(name).icon(icon))
53 .cell("size", size)
54 });
55 View::new().main([ui::table()
56 .col(Column::new("name", "Name").grow(1.0))
57 .col(Column::new("size", "Size").align(TextAlign::End).mono(true))
58 .rows(rows.collect::<Vec<_>>())])
59}More examples
examples/dashboard.rs (line 853)
850 fn services_table(&self) -> ui::Table<Msg> {
851 let mut table = self
852 .table(Page::Services, "No services yet")
853 .col(Column::new("name", "Service").grow(1.0).priority(6.0))
854 .col(Column::new("region", "Region").priority(3.0))
855 .col(Column::new("version", "Version").mono(true).priority(2.0))
856 .col(Column::new("traffic", "Traffic").priority(1.0))
857 .col(
858 Column::new("rps", "req/s")
859 .align(TextAlign::End)
860 .mono(true)
861 .priority(4.0),
862 )
863 .col(
864 Column::new("p95", "p95")
865 .align(TextAlign::End)
866 .mono(true)
867 .priority(4.0),
868 )
869 .col(
870 Column::new("errors", "Errors")
871 .align(TextAlign::End)
872 .mono(true)
873 .priority(4.0),
874 )
875 .col(Column::new("health", "Health").priority(5.0));
876 for s in &self.services {
877 let (label, tone) = s.health.look();
878 let mut errors = TextCell::new(format!("{:.1}%", s.errors));
879 if s.errors >= 1.0 {
880 errors = errors.tone(Tone::Error);
881 }
882 table = table.row(
883 TableRow::new(s.id)
884 .cell("name", TextCell::new(s.id).dot(tone.clone()))
885 .cell("region", s.region)
886 .cell("version", s.version)
887 .cell("traffic", SparkCell::new(s.rps.clone()))
888 .cell("rps", format!("{:.0}", s.rps.last().copied().unwrap_or_default()))
889 .cell("p95", format!("{:.0} ms", s.p95))
890 .cell("errors", errors)
891 .cell("health", BadgeSpec::new(label).tone(tone)),
892 );
893 }
894 table
895 }
896
897 /// The deploys toolbar: a muted description and the filter.
898 fn deploys_bar(&self) -> ui::Row<Msg> {
899 let attention = self
900 .deploys
901 .iter()
902 .filter(|d| matches!(d.state, State::Waiting | State::Failed))
903 .count();
904 ui::row()
905 .key("bar")
906 .justify("between")
907 .align("center")
908 .child(
909 ui::text(ui::span("Rollouts to production, newest first").style("muted")).key("about"),
910 )
911 .child(
912 ui::tabs()
913 .key("filter")
914 .variant("segmented")
915 .active(self.filter.clone())
916 .tab("all", "All")
917 .tab("attention", spans![
918 "Needs you ",
919 ui::span(attention.to_string()).style("muted")
920 ])
921 .on_select(|id| Msg::Filter(id.to_owned())),
922 )
923 }
924
925 /// The deploys table.
926 fn deploys_table(&self) -> ui::Table<Msg> {
927 let mut table = self
928 .table(Page::Deploys, "Nothing needs you right now")
929 .col(Column::new("service", "Service").grow(1.0).priority(6.0))
930 .col(Column::new("commit", "Commit").mono(true).priority(3.0))
931 .col(Column::new("region", "Region").priority(2.0))
932 .col(Column::new("traffic", "Traffic").priority(1.0))
933 .col(Column::new("rollout", "Rollout").priority(1.0))
934 .col(Column::new("state", "State").priority(5.0));
935 for d in self.shown_deploys() {
936 let (label, tone) = d.state.look();
937 table = table.row(
938 TableRow::new(d.id)
939 .cell("service", TextCell::new(d.service).dot(tone.clone()))
940 .cell("commit", d.commit)
941 .cell("region", d.region)
942 .cell("traffic", SparkCell::new(d.rps.clone()))
943 .cell("rollout", MeterCell {
944 value: Some(d.done),
945 title: Some(format!("{:.0}%", d.done * 100.0)),
946 ..MeterCell::default()
947 })
948 .cell("state", BadgeSpec::new(label).tone(tone)),
949 );
950 }
951 table
952 }
953
954 /// The incidents table.
955 fn incidents_table(&self) -> ui::Table<Msg> {
956 let mut table = self
957 .table(Page::Incidents, "No incidents. All quiet.")
958 .col(Column::new("title", "Incident").grow(1.0).priority(6.0))
959 .col(Column::new("id", "Id").mono(true).priority(2.0))
960 .col(Column::new("service", "Service").priority(3.0))
961 .col(Column::new("severity", "Severity").priority(4.0))
962 .col(
963 Column::new("age", "Open for")
964 .align(TextAlign::End)
965 .mono(true)
966 .priority(4.0),
967 )
968 .col(Column::new("phase", "State").priority(5.0));
969 for i in &self.incidents {
970 let (sev, sev_tone) = i.severity.look();
971 let (phase, phase_tone) = i.phase.look();
972 table = table.row(
973 TableRow::new(i.id)
974 .cell("title", TextCell::new(i.title).dot(sev_tone.clone()))
975 .cell("id", i.id)
976 .cell("service", i.service)
977 .cell("severity", BadgeSpec::new(sev).tone(sev_tone))
978 .cell("age", ago(i.age))
979 .cell("phase", BadgeSpec::new(phase).tone(phase_tone)),
980 );
981 }
982 table
983 }Sourcepub const fn priority(self, priority: f64) -> Self
pub const fn priority(self, priority: f64) -> Self
Sets the hide priority.
Examples found in repository?
examples/dashboard.rs (line 853)
850 fn services_table(&self) -> ui::Table<Msg> {
851 let mut table = self
852 .table(Page::Services, "No services yet")
853 .col(Column::new("name", "Service").grow(1.0).priority(6.0))
854 .col(Column::new("region", "Region").priority(3.0))
855 .col(Column::new("version", "Version").mono(true).priority(2.0))
856 .col(Column::new("traffic", "Traffic").priority(1.0))
857 .col(
858 Column::new("rps", "req/s")
859 .align(TextAlign::End)
860 .mono(true)
861 .priority(4.0),
862 )
863 .col(
864 Column::new("p95", "p95")
865 .align(TextAlign::End)
866 .mono(true)
867 .priority(4.0),
868 )
869 .col(
870 Column::new("errors", "Errors")
871 .align(TextAlign::End)
872 .mono(true)
873 .priority(4.0),
874 )
875 .col(Column::new("health", "Health").priority(5.0));
876 for s in &self.services {
877 let (label, tone) = s.health.look();
878 let mut errors = TextCell::new(format!("{:.1}%", s.errors));
879 if s.errors >= 1.0 {
880 errors = errors.tone(Tone::Error);
881 }
882 table = table.row(
883 TableRow::new(s.id)
884 .cell("name", TextCell::new(s.id).dot(tone.clone()))
885 .cell("region", s.region)
886 .cell("version", s.version)
887 .cell("traffic", SparkCell::new(s.rps.clone()))
888 .cell("rps", format!("{:.0}", s.rps.last().copied().unwrap_or_default()))
889 .cell("p95", format!("{:.0} ms", s.p95))
890 .cell("errors", errors)
891 .cell("health", BadgeSpec::new(label).tone(tone)),
892 );
893 }
894 table
895 }
896
897 /// The deploys toolbar: a muted description and the filter.
898 fn deploys_bar(&self) -> ui::Row<Msg> {
899 let attention = self
900 .deploys
901 .iter()
902 .filter(|d| matches!(d.state, State::Waiting | State::Failed))
903 .count();
904 ui::row()
905 .key("bar")
906 .justify("between")
907 .align("center")
908 .child(
909 ui::text(ui::span("Rollouts to production, newest first").style("muted")).key("about"),
910 )
911 .child(
912 ui::tabs()
913 .key("filter")
914 .variant("segmented")
915 .active(self.filter.clone())
916 .tab("all", "All")
917 .tab("attention", spans![
918 "Needs you ",
919 ui::span(attention.to_string()).style("muted")
920 ])
921 .on_select(|id| Msg::Filter(id.to_owned())),
922 )
923 }
924
925 /// The deploys table.
926 fn deploys_table(&self) -> ui::Table<Msg> {
927 let mut table = self
928 .table(Page::Deploys, "Nothing needs you right now")
929 .col(Column::new("service", "Service").grow(1.0).priority(6.0))
930 .col(Column::new("commit", "Commit").mono(true).priority(3.0))
931 .col(Column::new("region", "Region").priority(2.0))
932 .col(Column::new("traffic", "Traffic").priority(1.0))
933 .col(Column::new("rollout", "Rollout").priority(1.0))
934 .col(Column::new("state", "State").priority(5.0));
935 for d in self.shown_deploys() {
936 let (label, tone) = d.state.look();
937 table = table.row(
938 TableRow::new(d.id)
939 .cell("service", TextCell::new(d.service).dot(tone.clone()))
940 .cell("commit", d.commit)
941 .cell("region", d.region)
942 .cell("traffic", SparkCell::new(d.rps.clone()))
943 .cell("rollout", MeterCell {
944 value: Some(d.done),
945 title: Some(format!("{:.0}%", d.done * 100.0)),
946 ..MeterCell::default()
947 })
948 .cell("state", BadgeSpec::new(label).tone(tone)),
949 );
950 }
951 table
952 }
953
954 /// The incidents table.
955 fn incidents_table(&self) -> ui::Table<Msg> {
956 let mut table = self
957 .table(Page::Incidents, "No incidents. All quiet.")
958 .col(Column::new("title", "Incident").grow(1.0).priority(6.0))
959 .col(Column::new("id", "Id").mono(true).priority(2.0))
960 .col(Column::new("service", "Service").priority(3.0))
961 .col(Column::new("severity", "Severity").priority(4.0))
962 .col(
963 Column::new("age", "Open for")
964 .align(TextAlign::End)
965 .mono(true)
966 .priority(4.0),
967 )
968 .col(Column::new("phase", "State").priority(5.0));
969 for i in &self.incidents {
970 let (sev, sev_tone) = i.severity.look();
971 let (phase, phase_tone) = i.phase.look();
972 table = table.row(
973 TableRow::new(i.id)
974 .cell("title", TextCell::new(i.title).dot(sev_tone.clone()))
975 .cell("id", i.id)
976 .cell("service", i.service)
977 .cell("severity", BadgeSpec::new(sev).tone(sev_tone))
978 .cell("age", ago(i.age))
979 .cell("phase", BadgeSpec::new(phase).tone(phase_tone)),
980 );
981 }
982 table
983 }Sourcepub const fn mono(self, mono: bool) -> Self
pub const fn mono(self, mono: bool) -> Self
Draws the cells in the mono face.
Examples found in repository?
examples/table.rs (line 57)
43fn view(entries: &[Entry]) -> View {
44 let rows = entries.iter().map(|e| {
45 let (name, icon) = if e.dir {
46 (format!("{}/", e.name), "folder")
47 } else {
48 (e.name.clone(), "file")
49 };
50 let size = if e.dir { "-".to_owned() } else { human(e.size) };
51 TableRow::new(e.name.clone())
52 .cell("name", TextCell::new(name).icon(icon))
53 .cell("size", size)
54 });
55 View::new().main([ui::table()
56 .col(Column::new("name", "Name").grow(1.0))
57 .col(Column::new("size", "Size").align(TextAlign::End).mono(true))
58 .rows(rows.collect::<Vec<_>>())])
59}More examples
examples/dashboard.rs (line 855)
850 fn services_table(&self) -> ui::Table<Msg> {
851 let mut table = self
852 .table(Page::Services, "No services yet")
853 .col(Column::new("name", "Service").grow(1.0).priority(6.0))
854 .col(Column::new("region", "Region").priority(3.0))
855 .col(Column::new("version", "Version").mono(true).priority(2.0))
856 .col(Column::new("traffic", "Traffic").priority(1.0))
857 .col(
858 Column::new("rps", "req/s")
859 .align(TextAlign::End)
860 .mono(true)
861 .priority(4.0),
862 )
863 .col(
864 Column::new("p95", "p95")
865 .align(TextAlign::End)
866 .mono(true)
867 .priority(4.0),
868 )
869 .col(
870 Column::new("errors", "Errors")
871 .align(TextAlign::End)
872 .mono(true)
873 .priority(4.0),
874 )
875 .col(Column::new("health", "Health").priority(5.0));
876 for s in &self.services {
877 let (label, tone) = s.health.look();
878 let mut errors = TextCell::new(format!("{:.1}%", s.errors));
879 if s.errors >= 1.0 {
880 errors = errors.tone(Tone::Error);
881 }
882 table = table.row(
883 TableRow::new(s.id)
884 .cell("name", TextCell::new(s.id).dot(tone.clone()))
885 .cell("region", s.region)
886 .cell("version", s.version)
887 .cell("traffic", SparkCell::new(s.rps.clone()))
888 .cell("rps", format!("{:.0}", s.rps.last().copied().unwrap_or_default()))
889 .cell("p95", format!("{:.0} ms", s.p95))
890 .cell("errors", errors)
891 .cell("health", BadgeSpec::new(label).tone(tone)),
892 );
893 }
894 table
895 }
896
897 /// The deploys toolbar: a muted description and the filter.
898 fn deploys_bar(&self) -> ui::Row<Msg> {
899 let attention = self
900 .deploys
901 .iter()
902 .filter(|d| matches!(d.state, State::Waiting | State::Failed))
903 .count();
904 ui::row()
905 .key("bar")
906 .justify("between")
907 .align("center")
908 .child(
909 ui::text(ui::span("Rollouts to production, newest first").style("muted")).key("about"),
910 )
911 .child(
912 ui::tabs()
913 .key("filter")
914 .variant("segmented")
915 .active(self.filter.clone())
916 .tab("all", "All")
917 .tab("attention", spans![
918 "Needs you ",
919 ui::span(attention.to_string()).style("muted")
920 ])
921 .on_select(|id| Msg::Filter(id.to_owned())),
922 )
923 }
924
925 /// The deploys table.
926 fn deploys_table(&self) -> ui::Table<Msg> {
927 let mut table = self
928 .table(Page::Deploys, "Nothing needs you right now")
929 .col(Column::new("service", "Service").grow(1.0).priority(6.0))
930 .col(Column::new("commit", "Commit").mono(true).priority(3.0))
931 .col(Column::new("region", "Region").priority(2.0))
932 .col(Column::new("traffic", "Traffic").priority(1.0))
933 .col(Column::new("rollout", "Rollout").priority(1.0))
934 .col(Column::new("state", "State").priority(5.0));
935 for d in self.shown_deploys() {
936 let (label, tone) = d.state.look();
937 table = table.row(
938 TableRow::new(d.id)
939 .cell("service", TextCell::new(d.service).dot(tone.clone()))
940 .cell("commit", d.commit)
941 .cell("region", d.region)
942 .cell("traffic", SparkCell::new(d.rps.clone()))
943 .cell("rollout", MeterCell {
944 value: Some(d.done),
945 title: Some(format!("{:.0}%", d.done * 100.0)),
946 ..MeterCell::default()
947 })
948 .cell("state", BadgeSpec::new(label).tone(tone)),
949 );
950 }
951 table
952 }
953
954 /// The incidents table.
955 fn incidents_table(&self) -> ui::Table<Msg> {
956 let mut table = self
957 .table(Page::Incidents, "No incidents. All quiet.")
958 .col(Column::new("title", "Incident").grow(1.0).priority(6.0))
959 .col(Column::new("id", "Id").mono(true).priority(2.0))
960 .col(Column::new("service", "Service").priority(3.0))
961 .col(Column::new("severity", "Severity").priority(4.0))
962 .col(
963 Column::new("age", "Open for")
964 .align(TextAlign::End)
965 .mono(true)
966 .priority(4.0),
967 )
968 .col(Column::new("phase", "State").priority(5.0));
969 for i in &self.incidents {
970 let (sev, sev_tone) = i.severity.look();
971 let (phase, phase_tone) = i.phase.look();
972 table = table.row(
973 TableRow::new(i.id)
974 .cell("title", TextCell::new(i.title).dot(sev_tone.clone()))
975 .cell("id", i.id)
976 .cell("service", i.service)
977 .cell("severity", BadgeSpec::new(sev).tone(sev_tone))
978 .cell("age", ago(i.age))
979 .cell("phase", BadgeSpec::new(phase).tone(phase_tone)),
980 );
981 }
982 table
983 }Trait Implementations§
impl StructuralPartialEq for Column
Auto Trait Implementations§
impl Freeze for Column
impl RefUnwindSafe for Column
impl Send for Column
impl Sync for Column
impl Unpin for Column
impl UnsafeUnpin for Column
impl UnwindSafe for Column
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more