Skip to content
Snippets Groups Projects
Commit b55746a5 authored by David Bühler's avatar David Bühler
Browse files

[ivette] Adds new columns to the property table. Hide some columns by default.

parent 783b5892
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ import { Component } from 'frama-c/LabViews'; ...@@ -15,7 +15,7 @@ import { Component } from 'frama-c/LabViews';
// --- Property Columns // --- Property Columns
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
export const renderCode: Renderer<string> = const renderCode: Renderer<string> =
(text?: string) => (text ? <Code>{text}</Code> : null); (text?: string) => (text ? <Code>{text}</Code> : null);
function ColumnCode<Row>(props: ColumnProps<Row, string>) { function ColumnCode<Row>(props: ColumnProps<Row, string>) {
...@@ -24,18 +24,30 @@ function ColumnCode<Row>(props: ColumnProps<Row, string>) { ...@@ -24,18 +24,30 @@ function ColumnCode<Row>(props: ColumnProps<Row, string>) {
interface Tag { name: string; label: string; descr: string } interface Tag { name: string; label: string; descr: string }
export const renderTag: Renderer<Tag> = const renderTag: Renderer<Tag> =
(d?: Tag) => (d ? <Label label={d.label} title={d.descr} /> : null); (d?: Tag) => (d ? <Label label={d.label} title={d.descr} /> : null);
function ColumnTag<Row>(props: ColumnProps<Row, Tag>) { function ColumnTag<Row>(props: ColumnProps<Row, Tag>) {
return <Column render={renderTag} {...props} />; return <Column render={renderTag} {...props} />;
} }
const renderNames: Renderer<string[]> =
(names?: string[]) => {
const label = names?.join(': ');
return (label ? <Label label={label} /> : null);
}
const renderFile: Renderer<SourceLoc> =
(loc?: SourceLoc) =>
(loc ? <Label label={loc.base} title={loc.file} /> : null);
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// --- Properties Table // --- Properties Table
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
interface SourceLoc { interface SourceLoc {
dir: string;
base: string;
file: string; file: string;
line: number; line: number;
} }
...@@ -44,6 +56,10 @@ interface Property { ...@@ -44,6 +56,10 @@ interface Property {
key: string; key: string;
descr: string; descr: string;
kind: string; kind: string;
alarm?: string;
alarm_descr?: string;
names: string[];
predicate: string;
status: string; status: string;
function?: string; function?: string;
kinstr: string; kinstr: string;
...@@ -73,6 +89,9 @@ const byProperty: Compare.ByFields<Property> = { ...@@ -73,6 +89,9 @@ const byProperty: Compare.ByFields<Property> = {
function: Compare.defined(Compare.alpha), function: Compare.defined(Compare.alpha),
source: bySource, source: bySource,
kind: Compare.primitive, kind: Compare.primitive,
alarm: Compare.defined(Compare.alpha),
names: Compare.array(Compare.alpha),
predicate: Compare.alpha,
key: Compare.primitive, key: Compare.primitive,
kinstr: Compare.primitive, kinstr: Compare.primitive,
}; };
...@@ -122,13 +141,25 @@ const RenderTable = () => { ...@@ -122,13 +141,25 @@ const RenderTable = () => {
onSelection={onSelection} onSelection={onSelection}
settings="ivette.properties.table" settings="ivette.properties.table"
> >
<Column
id="path"
label="Directory"
width={240}
visible={false}
getter={(prop: Property) => prop.source.dir}
/>
<Column id="source" label="File" width={120} render={renderFile} />
<ColumnCode id="function" label="Function" width={120} /> <ColumnCode id="function" label="Function" width={120} />
<ColumnCode id="descr" label="Description" fill /> <ColumnCode id="kind" label="Property kind" width={120} />
<ColumnCode id="alarm" label="Alarms" width={160} />
<Column id="names" label="Names" width={240} visible={false}
render={renderNames} />
<ColumnCode id="predicate" label="Predicate" fill />
<ColumnCode id="descr" label="Property" fill visible={false} />
<ColumnTag <ColumnTag
id="status" id="status"
label="Status" label="Status"
fixed width={100}
width={80}
align="center" align="center"
getter={getStatus} getter={getStatus}
/> />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment