Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

House cleaning october #5167

Merged
merged 5 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
<div class="truncate text-left">
{{ useProjects().getAssetName(input.value?.[0]) || getPortLabel(input) }}
</div>
<!--TODO: label is a string type not an array consider adding this back in if we support an array of labels-->
<!-- <label v-for="(label, labelIdx) in input.label?.split(',') ?? []" :key="labelIdx">
{{ label }}
</label> -->
<Button
class="unlink"
label="Unlink"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export const formatAxis = (axisSelection: Selection<any, any, any, any>) => {
axisSelection.selectAll('text').attr('stroke', 'none').attr('fill', '#555');
};

// FIXME: add test
export const makeLabels = (
itemList: any[],
itemAltList: any[],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class NestedPetrinetRenderer extends PetrinetRenderer {
species
.append('circle')
.classed('shape selectableNode', true)
.attr('r', (d) => 0.55 * d.width) // FIXME: need to adjust edge from sqaure mapping to circle
.attr('r', (d) => 0.55 * d.width)
.attr('fill', (d) => (d.data.strataType ? getNodeTypeColor(d.data.strataType) : getNestedTypeColor('base')))
.attr('stroke', 'var(--petri-nodeBorder)')
.attr('stroke-width', 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class PetrinetRenderer extends BasicRenderer<NodeData, EdgeData> {
species
.append('circle')
.classed('shape selectableNode', true)
.attr('r', (d) => 0.55 * d.width) // FIXME: need to adjust edge from sqaure mapping to circle
.attr('r', (d) => 0.55 * d.width)
.attr('fill', (d) => (d.data.strataType ? getNodeTypeColor(d.data.strataType) : 'var(--petri-nodeFill)'))
.attr('stroke', 'var(--petri-nodeBorder)')
.attr('stroke-width', 1)
Expand Down
2 changes: 1 addition & 1 deletion packages/client/hmi-client/src/services/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function getProgrammingLanguage(fileName: string): ProgrammingLanguage {
case 'zip':
return ProgrammingLanguage.Zip;
default:
return ProgrammingLanguage.Python; // TODO do we need an "unknown" language?
return ProgrammingLanguage.Python;
}
}

Expand Down
69 changes: 0 additions & 69 deletions packages/client/hmi-client/src/services/notebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,72 +33,3 @@ export const saveCodeToState = (
}
return state;
};

/**
* Create a notebook from a code
* @param code code to be added to the notebook
* @param executeResult output of the code execution if any
* @param language language of the code
* @param llmQuery llm query used to generate the code if any
* @param thought llm thought generated from the query if any
* @returns
*/
export const createNotebookFromCode = (
code: string,
language: string,
executionResult?: any,
llmQuery?: string,
llmThoughts: any[] = []
) => {
// TODO: Consider using jataware/beaker-kernel library to generate notebook (https://github.com/jataware/beaker-kernel/blob/886b2b3913ca1460f0301a5cd97cbcf15de609bc/beaker-ts/src/notebook.ts#L414)
const notebook = {
nbformat: 4,
nbformat_minor: 5,
cells: [] as any[],
metadata: {
kernelspec: {
display_name: 'Beaker Kernel',
name: 'beaker',
language: 'beaker'
},
language_info: {
name: language,
display_name: language
}
}
};
if (llmQuery) {
const beakerQueryCell = {
cell_type: 'query',
events: llmThoughts.map((thought) => ({ type: 'thought', content: thought.content })),
metadata: {},
source: llmQuery,
status: 'idle'
};
notebook.cells.push(beakerQueryCell);
}
const beakerCodeCell = {
cell_type: 'code',
execution_count: 1,
metadata: {},
outputs: [] as any[],
source: code,
status: 'idle'
};
if (executionResult) {
// Make a shallow copy of the execution result
const data = { ...executionResult };
// Make sure the values of the data is stringified as the beaker summary endpoint seem to have issue with object json value
Object.keys(data).forEach((type) => {
if (typeof data[type] !== 'string') {
data[type] = JSON.stringify(data[type]);
}
});
beakerCodeCell.outputs.push({
output_type: 'execute_result',
data
});
}
notebook.cells.push(beakerCodeCell);
return notebook;
};
3 changes: 0 additions & 3 deletions packages/client/hmi-client/src/types/ResponsiveMatrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ export type DataConfig = {
export type RowColConfig = {
borderEnabled: boolean;
borderWidth: number;
// TODO
// labelFormatterFn: (val :any, idx: number) => string
// labelAltFn?: (val: any, idx: number) => string,
};

export type VisConfig = {
Expand Down
25 changes: 0 additions & 25 deletions packages/client/hmi-client/src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,6 @@ export interface ModelConfigTableData {
tableFormattedMatrix?: ModelConfigTableData[];
}

// TODO: Wherever these are used - investigate using an actual map instead, this has been avoided due to v-model not playing well with maps
// But a solution might be found here: https://stackoverflow.com/questions/37130105/does-vue-support-reactivity-on-map-and-set-data-types/64512468#64512468
export interface StringValueMap {
[key: string]: string;
}

export interface NumericValueMap {
[key: string]: number;
}

export interface AnyValueMap {
[key: string]: any;
}

export enum ViewType {
LIST = 'list',
MATRIX = 'matrix',
GRAPH = 'graph'
}

// Side panel
export type SidePanelTab = {
name: string;
Expand All @@ -83,11 +63,6 @@ export interface AssetItem extends AssetRoute {
assetCreatedOn?: string;
}

export type CodeRequest = {
asset: AssetItem;
code?: string;
};

// TODO this should come from the back end, and we should also have maps for the "categories" of types (artifacts, models, datasets, etc)
export enum AcceptedTypes {
PDF = 'application/pdf',
Expand Down