pipedash_plugin_api/
defaults.rs1use crate::schema::*;
2
3pub fn table_schema(runs: TableDefinition, pipelines: TableDefinition) -> TableSchema {
4 TableSchema::new().add_table(runs).add_table(pipelines)
5}
6
7fn status_column() -> ColumnDefinition {
8 ColumnDefinition::new(
9 "status",
10 "Status",
11 "status",
12 ColumnDataType::Status,
13 CellRenderer::StatusBadge,
14 )
15 .with_width(120)
16 .sortable()
17 .filterable()
18}
19
20pub fn default_pipeline_runs_table() -> TableDefinition {
21 TableDefinition::new(
22 "pipeline_runs",
23 "Pipeline Runs",
24 "Build/run history for pipelines",
25 vec![
26 ColumnDefinition::new(
27 "run_number",
28 "Run",
29 "run_number",
30 ColumnDataType::Number,
31 CellRenderer::Text,
32 )
33 .described("Run/build number")
34 .with_width(100)
35 .history_order(),
36 status_column(),
37 ColumnDefinition::new(
38 "branch",
39 "Branch",
40 "branch",
41 ColumnDataType::String,
42 CellRenderer::TruncatedText,
43 )
44 .when_present()
45 .with_width(150)
46 .sortable()
47 .filterable(),
48 ColumnDefinition::new(
49 "started_at",
50 "Started",
51 "started_at",
52 ColumnDataType::DateTime,
53 CellRenderer::DateTime,
54 )
55 .with_width(180)
56 .sortable(),
57 ColumnDefinition::new(
58 "duration_seconds",
59 "Duration",
60 "duration_seconds",
61 ColumnDataType::Duration,
62 CellRenderer::Duration,
63 )
64 .with_width(120)
65 .sortable(),
66 ColumnDefinition::new(
67 "commit_sha",
68 "Commit",
69 "commit_sha",
70 ColumnDataType::String,
71 CellRenderer::Commit,
72 )
73 .when_present()
74 .hidden()
75 .with_width(140),
76 ColumnDefinition::new(
77 "actor",
78 "Actor",
79 "actor",
80 ColumnDataType::String,
81 CellRenderer::Text,
82 )
83 .described("Who triggered the run")
84 .when_present()
85 .hidden()
86 .with_width(120)
87 .sortable()
88 .filterable(),
89 ],
90 )
91}
92
93pub fn default_pipelines_table() -> TableDefinition {
94 TableDefinition::new(
95 "pipelines",
96 "Pipelines",
97 "All pipelines/workflows",
98 vec![
99 ColumnDefinition::new(
100 "name",
101 "Name",
102 "name",
103 ColumnDataType::String,
104 CellRenderer::Text,
105 )
106 .with_width(200)
107 .sortable()
108 .filterable(),
109 status_column(),
110 ColumnDefinition::new(
111 "repository",
112 "Repository",
113 "repository",
114 ColumnDataType::String,
115 CellRenderer::TruncatedText,
116 )
117 .with_width(180)
118 .sortable()
119 .filterable(),
120 ColumnDefinition::new(
121 "branch",
122 "Branch",
123 "branch",
124 ColumnDataType::String,
125 CellRenderer::Badge,
126 )
127 .when_present()
128 .with_width(120)
129 .sortable()
130 .filterable(),
131 ],
132 )
133}