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

task[hmi-server] - server cleanup #3464

Merged
merged 6 commits into from
Apr 29, 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 @@ -508,7 +508,7 @@ watch(
const code = await getCodeAsset(props.assetId);
if (code && code.files && Object.keys(code.files)[0]) {
codeAsset.value = code;
codeName.value = code.name;
codeName.value = code.name ?? '';

const filename = Object.keys(code.files)[0];
codeSelectedFile.value = filename;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ onMounted(async () => {
csvAsset.value = csv;
datasetColumnNames.value = csv?.headers;

listModelLabels.value = allModelConfigurations.value.map((ele) => ele.name);
listModelLabels.value = allModelConfigurations.value.map((ele) => ele.name ?? '');

// initalize ensembleConfigs when its length is less than the amount of models provided to node (- 1 due to dataset, -1 due to last empty )
if (knobs.value.ensembleConfigs.length < props.node.inputs.length - 2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ const createConfiguration = async (force: boolean = false) => {

const data = await createModelConfiguration(
model.value.id,
knobs.value?.transientModelConfig?.name,
knobs.value?.transientModelConfig?.name ?? '',
knobs.value?.transientModelConfig?.description ?? '',
knobs.value?.transientModelConfig?.configuration
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ onMounted(async () => {
amr.semantics?.ode.observables?.forEach((element) => tempList.push(element.id));
allModelOptions.value[allModelConfigurations[i].id as string] = tempList;
}
listModelLabels.value = allModelConfigurations.map((ele) => ele.name);
listModelLabels.value = allModelConfigurations.map((ele) => ele.name ?? '');

const state = _.cloneDeep(props.node.state);

Expand Down
4 changes: 3 additions & 1 deletion packages/client/hmi-client/src/page/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ function sortProjectByDates(projects: Project[], dateType: DateType, sorting: 'A
function filterAndSortProjects(projects: Project[]) {
if (projects) {
if (selectedSort.value === 'Alphabetical') {
return projects.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
return projects.sort((a, b) =>
(a.name ?? '').toLowerCase().localeCompare((b.name ?? '').toLowerCase())
);
}
if (selectedSort.value === 'Last updated (descending)') {
return sortProjectByDates(projects, 'updatedOn', 'DESC');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ const title = computed(() => {
} else if (props.resourceType === ResourceType.MODEL) {
value = (props.asset as Model).header.name;
} else if (props.resourceType === ResourceType.DATASET) {
value = (props.asset as Dataset).name;
value = (props.asset as Dataset).name ?? '';
}
return highlightSearchTerms(value);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const projectOptions = computed(() => [
// then, link and store in the project assets
if (datasetId) {
response = await useProjects().addAsset(AssetType.Dataset, datasetId, project.id);
assetName = selectedAsset.value.name;
assetName = selectedAsset.value.name ?? '';
dvince2 marked this conversation as resolved.
Show resolved Hide resolved
}
} else if (isDocument(selectedAsset.value) && props.source === DocumentSource.XDD) {
const document = selectedAsset.value as Document;
Expand Down
16 changes: 1 addition & 15 deletions packages/client/hmi-client/src/types/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface ClientLog {
export interface TerariumAsset {
id?: string;
name?: string;
description?: string;
createdOn?: Date;
updatedOn?: Date;
deletedOn?: Date;
Expand Down Expand Up @@ -69,9 +70,7 @@ export interface GithubRepo {
}

export interface Artifact extends TerariumAsset {
name: string;
userId: string;
description?: string;
fileNames: string[];
metadata?: any;
concepts?: OntologyConcept[];
Expand Down Expand Up @@ -122,8 +121,6 @@ export interface ResponseSuccess {
}

export interface Code extends TerariumAsset {
name: string;
description: string;
files?: { [index: string]: CodeFile };
repoUrl?: string;
metadata?: { [index: string]: string };
Expand All @@ -141,7 +138,6 @@ export interface Dynamics {
}

export interface ActiveConcept extends TerariumAsset {
name: string;
curie: string;
}

Expand All @@ -158,10 +154,8 @@ export interface OntologyConcept {
}

export interface Dataset extends TerariumAsset {
name: string;
userId?: string;
esgfId?: string;
description?: string;
dataSourceDate?: Date;
fileNames?: string[];
datasetUrl?: string;
Expand Down Expand Up @@ -195,7 +189,6 @@ export interface AddDocumentAssetFromXDDResponse {
}

export interface DocumentAsset extends TerariumAsset {
description?: string;
userId?: string;
fileNames?: string[];
documentUrl?: string;
Expand Down Expand Up @@ -236,8 +229,6 @@ export interface Model extends TerariumAssetThatSupportsAdditionalProperties {
}

export interface ModelConfiguration extends TerariumAssetThatSupportsAdditionalProperties {
name: string;
description?: string;
configuration: Model;
model_id: string;
}
Expand Down Expand Up @@ -407,8 +398,6 @@ export interface DecapodesTerm {
}

export interface NotebookSession extends TerariumAsset {
name: string;
description?: string;
data: any;
}

Expand All @@ -418,11 +407,9 @@ export interface PetriNetModel {
}

export interface Project extends TerariumAsset {
name: string;
userId: string;
userName?: string;
authors?: string[];
description?: string;
overviewContent?: any;
projectAssets: ProjectAsset[];
metadata?: { [index: string]: string };
Expand Down Expand Up @@ -504,7 +491,6 @@ export interface RegNetVertex {

export interface Simulation extends TerariumAsset {
executionPayload: any;
description?: string;
resultFiles?: string[];
type: SimulationType;
status: ProgressState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,15 @@ public abstract class TerariumAsset implements Serializable {
private UUID id = UUID.randomUUID();

@TSOptional
@Column(length = 512)
@Schema(defaultValue = "Default Name")
private String name;

@TSOptional
@Schema(defaultValue = "Default Description")
@Column(columnDefinition = "text")
private String description;

@TSOptional
@Schema(accessMode = Schema.AccessMode.READ_ONLY)
@Column(columnDefinition = "TIMESTAMP WITH TIME ZONE")
Expand Down Expand Up @@ -78,6 +85,7 @@ public TerariumAsset clone() {
protected TerariumAsset cloneSuperFields(final TerariumAsset asset) {
asset.id = UUID.randomUUID(); // ensure we create a new id
asset.name = name;
asset.description = description;
asset.createdOn = this.createdOn != null ? new Timestamp(this.createdOn.getTime()) : null;
asset.updatedOn = this.updatedOn != null ? new Timestamp(this.updatedOn.getTime()) : null;
asset.deletedOn = this.deletedOn != null ? new Timestamp(this.deletedOn.getTime()) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ public class Artifact extends TerariumAsset {
/* UserId of who created this asset */
private String userId;

/* The name of the artifact. */
private String name;

/* A description of the artifact. */
@TSOptional
private String description;

/* The name of the file(s) in this artifact */
@JsonAlias("file_names")
private List<String> fileNames;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ public class Code extends TerariumAsset {
@Serial
private static final long serialVersionUID = 3041175096070970227L;
/* The name of the code. */
@Schema(defaultValue = "Default Name")
private String name;

/* The description of the code. */
@Schema(defaultValue = "Default Description")
private String description;

/* Files that contain dynamics */
@TSOptional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,4 @@ public class ActiveConcept extends TerariumAsset {

@Column(unique = true)
private String curie;

private String name;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ public class Dataset extends TerariumAsset {
@TSOptional
private String esgfId;

/** Name of the dataset */
private String name;

/** (Optional) textual description of the dataset */
@TSOptional
private String description;

/** (Optional) data source date */
@TSOptional
@JsonAlias("data_source_date")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ public class DocumentAsset extends TerariumAsset {
@Serial
private static final long serialVersionUID = -8425680186002783351L;

@TSOptional
private String name;

@TSOptional
private String description;

@TSOptional
private String userId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ public class Equation extends TerariumAsset {
@TSOptional
private String userId;

/** (Optional) Display/human name for the equation * */
@TSOptional
private String name;

/** The type of equation (mathml or latex) * */
@JsonAlias("equation_type")
private EquationType equationType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ public class ModelConfiguration extends TerariumAssetThatSupportsAdditionalPrope
@Serial
private static final long serialVersionUID = -4109896135386019667L;

private String name;

@TSOptional
private String description;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import software.uncharted.terarium.hmiserver.annotations.TSModel;
import software.uncharted.terarium.hmiserver.annotations.TSOptional;
import software.uncharted.terarium.hmiserver.models.TerariumAsset;

@EqualsAndHashCode(callSuper = true)
Expand All @@ -18,10 +17,5 @@ public class NotebookSession extends TerariumAsset {
@Serial
private static final long serialVersionUID = 9176019416379347233L;

private String name;

@TSOptional
private String description;

private JsonNode data;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ public class Project extends TerariumAsset {
@Serial
private static final long serialVersionUID = -241733670076432802L;

@Schema(defaultValue = "My New Project")
private String name;

private String userId;

@TSOptional
Expand All @@ -46,10 +43,6 @@ public class Project extends TerariumAsset {
@Schema(accessMode = Schema.AccessMode.READ_ONLY)
private List<String> authors;

@TSOptional
@Schema(defaultValue = "My Project Description")
private String description;

@TSOptional
@Schema(defaultValue = "My Project Overview")
@Lob
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,9 @@ public class Simulation extends TerariumAsset {
@Column(columnDefinition = "text")
private JsonNode executionPayload;

@TSOptional
@Column(length = 1000)
private String description;

@JsonAlias("result_files")
@TSOptional
@Column(length = 1000)
@Column(length = 1024)
@Schema(accessMode = Schema.AccessMode.READ_ONLY)
@ElementCollection
private List<String> resultFiles;
Expand Down Expand Up @@ -73,6 +69,7 @@ public class Simulation extends TerariumAsset {

@JsonAlias("user_id")
@TSOptional
@Column(length = 255)
private String userId;
dvince2 marked this conversation as resolved.
Show resolved Hide resolved

@JsonAlias("project_id")
Expand All @@ -85,8 +82,6 @@ public Simulation clone() {

cloneSuperFields(clone);

clone.setDescription(this.description);

clone.setResultFiles(new ArrayList<>(this.resultFiles));
clone.setType(SimulationType.valueOf(this.type.name()));
clone.setStatus(ProgressState.valueOf(this.status.name()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public class Workflow extends TerariumAsset {
@Serial
private static final long serialVersionUID = -1565930053830366145L;

private String description;

private Transform transform;

@Convert(converter = ObjectConverter.class)
Expand All @@ -43,7 +41,6 @@ public Workflow clone() {

cloneSuperFields(clone);

clone.description = this.description;
if (this.transform != null) {
clone.transform = new Transform()
.setX(this.transform.getX())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
BEGIN;

ALTER TABLE simulation ALTER COLUMN result_files TYPE VARCHAR(1024)[];

ALTER TABLE simulation ALTER COLUMN name TYPE VARCHAR(512);
ALTER TABLE workflow ALTER COLUMN name TYPE VARCHAR(512);
ALTER TABLE project ALTER COLUMN name TYPE VARCHAR(512);

ALTER TABLE simulation ALTER COLUMN description TYPE text;
ALTER TABLE workflow ALTER COLUMN description TYPE text;
ALTER TABLE project ALTER COLUMN description TYPE text;

COMMIT;
Loading
Loading