Skip to content

Commit

Permalink
0.12.2 (#230)
Browse files Browse the repository at this point in the history
* fixed issue with material total values (#219)

* fixed issue with material total values

* updated version number

* decimals removed from materials breakdown chart

* delete report issue (#221)

* fixed delete, made it display speckle error message when the issue is out of our control

* updated vesrion #

* Rw/bug/model saving (#223)

* fixed issue with material total values

* mostly fixed, just something weird going on with uploading the objects

* some more testing

* fixed issue with models not saving properly

* updated version # and message

* clean up

* messed around with how much we send to speckle at one time so that we don't break the arup speckle server

* updated viewer version (#227)

* Rw/feat/material selection (#226)

* made most of the UI

* started to work on small-ish refactor

* very basic material selection working

* transport step working (hopefully)

* report review working (I think)

* fixed issues with carbon calc

* uploading works, updating almost works

* updating a report is now working

* custom material grouping working

* grouping by diff params working

* deleted commented out code and funcs that are no longer needed

* removed useless variables

* removed console.logs and some imports that are no longer used

* buildups work, updated models with buildups works

* cleanup

* removed some stuff that is no longer needed

* fixed bug

* updated version update messages

* chips on expandmaterialtype now filter objects in renderer

* fixed issue with large models running out of memory

* Rw/dev/parameter selection 2 (#229)

* added in 'undefined' option to filters that need it

* updated version # and dialog
  • Loading branch information
Exilliar authored Jul 20, 2023
1 parent de4a3fa commit 982a105
Show file tree
Hide file tree
Showing 22 changed files with 1,127 additions and 720 deletions.
21 changes: 12 additions & 9 deletions src/components/assessment/AssessmentStepper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</v-stepper-step>
<v-stepper-content step="2">
<Menu2
:types="types"
:fullGroups="fullGroups"
:materials="materials"
:selectedObjects="selectedObjects"
:invalidObjects="invalidSelectedObjects"
Expand All @@ -60,6 +60,7 @@
@createNewGroup="createNewGroup"
@selectMaterial="selectMaterial"
@groupSelected="groupSelected"
@selectBuildup="selectBuildup"
/>
<v-card-actions>
<v-btn :style="colStyle" @click="step = 1" color="primary">
Expand All @@ -82,7 +83,7 @@
<Menu3
@transportSelected="transportSelected"
:transportTypes="transportTypes"
:groupedMaterials="groupedMaterials"
:transportGroups="transportGroups"
/>
<v-card-actions>
<v-btn :style="colStyle" @click="step = 2" color="primary">
Expand All @@ -103,7 +104,6 @@
</v-stepper-step>
<v-stepper-content step="4">
<menu-4

Check warning on line 106 in src/components/assessment/AssessmentStepper.vue

View workflow job for this annotation

GitHub Actions / build (dev)

Replace `⏎············:totalVolume="totalVolume"⏎············:speckleVol="speckleVol"⏎·········` with `·:totalVolume="totalVolume"·:speckleVol="speckleVol"`

Check warning on line 106 in src/components/assessment/AssessmentStepper.vue

View workflow job for this annotation

GitHub Actions / build (16.x)

Replace `⏎············:totalVolume="totalVolume"⏎············:speckleVol="speckleVol"⏎·········` with `·:totalVolume="totalVolume"·:speckleVol="speckleVol"`

Check warning on line 106 in src/components/assessment/AssessmentStepper.vue

View workflow job for this annotation

GitHub Actions / build (prod)

Replace `⏎············:totalVolume="totalVolume"⏎············:speckleVol="speckleVol"⏎·········` with `·:totalVolume="totalVolume"·:speckleVol="speckleVol"`
@calcVol="calcVol"
:totalVolume="totalVolume"
:speckleVol="speckleVol"
/>
Expand Down Expand Up @@ -203,22 +203,24 @@ import {
ReportPassdown,
GroupedMaterial,

Check warning on line 204 in src/components/assessment/AssessmentStepper.vue

View workflow job for this annotation

GitHub Actions / build (dev)

'GroupedMaterial' is defined but never used

Check warning on line 204 in src/components/assessment/AssessmentStepper.vue

View workflow job for this annotation

GitHub Actions / build (16.x)

'GroupedMaterial' is defined but never used

Check warning on line 204 in src/components/assessment/AssessmentStepper.vue

View workflow job for this annotation

GitHub Actions / build (prod)

'GroupedMaterial' is defined but never used
SelectedMaterialEmit,
SelectedBuildupEmit,
} from "@/models/newAssessment";
import { MaterialFull } from "@/store/utilities/material-carbon-factors";
import { ReportFullGroup, ReportFullTransportGroup } from "@/models/report";
@Component({
components: { Menu1b, Menu2, Menu3, Menu4, Menu5, Menu6, Menu7 },
})
export default class AssessmentStepper extends Vue {
@Prop() streams!: any;

Check warning on line 215 in src/components/assessment/AssessmentStepper.vue

View workflow job for this annotation

GitHub Actions / build (dev)

Unexpected any. Specify a different type

Check warning on line 215 in src/components/assessment/AssessmentStepper.vue

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 215 in src/components/assessment/AssessmentStepper.vue

View workflow job for this annotation

GitHub Actions / build (prod)

Unexpected any. Specify a different type
@Prop() types!: MaterialGrouping[];
@Prop() fullGroups!: ReportFullGroup[];
@Prop() materials!: MaterialFull[];
@Prop() transportTypes!: TransportType[];
@Prop() totalVolume!: number;
@Prop() emptyProps!: EmptyPropsPassdown;
@Prop() report!: ReportPassdown;
@Prop() becs!: string;
@Prop() groupedMaterials!: GroupedMaterial[];
@Prop() transportGroups!: ReportFullTransportGroup[];
@Prop() speckleVol!: boolean;
@Prop() update!: boolean;
Expand Down Expand Up @@ -296,6 +298,11 @@ export default class AssessmentStepper extends Vue {
return this.report ? true : false;
}
@Emit("selectBuildup")
selectBuildup(selectedBuildup: SelectedBuildupEmit) {
return selectedBuildup;
}
@Emit("createNewGroup")
createNewGroup(groupName: string) {
return groupName;
Expand Down Expand Up @@ -357,10 +364,6 @@ export default class AssessmentStepper extends Vue {
return objectGroup;
}
@Emit("calcVol")
calcVol() {
return;
}
@Watch("form.notes")
notesUpdate() {
this.uploadData({
Expand Down
187 changes: 187 additions & 0 deletions src/components/assessment/ExpandedMaterialType.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<template>
<v-card
flat
color=""
:style="[
this.$store.state.darkMode
? { 'background-color': '#1C1C1C !important' }
: { 'background-color': '#FFFFFF !important' },
]"
>
<v-card-title>
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
<v-chip v-bind="attrs" v-on="on" @click="selectMaterial">
{{ cleanType(type.name) }}
</v-chip>
</template>
<span>Objects: {{ type.objects.length }} </span>
</v-tooltip>
</v-card-title>
<v-card-text>
<v-row v-for="part in partMaterial" :key="part.id" dense align="end">
<v-col cols="7">
<v-combobox
v-model="part.material"
:items="materials"
:item-text="(materials) => materials['name']"
@change="checkMaterialUpdated"
chips
>
<template #selection="{ item }">
<v-chip
:color="item.color"
:textColor="getContrastYIQ(item.color)"
>{{ item.name }}</v-chip
>
</template>
</v-combobox>
</v-col>
<v-col cols="3">
<v-text-field
v-model="part.percentage"
single-line
type="number"
max="100"
@input="percentageChanged(part)"
append-icon="mdi-percent"
/>
</v-col>
<v-col cols="2" v-if="partMaterial.length !== 1">
<v-btn fab small @click="removePart(part.id)">
<v-icon> mdi-minus </v-icon>
</v-btn>
</v-col>
</v-row>
<div style="width: 100%" class="d-flex justify-center">
<v-btn fab small @click="addPart">
<v-icon> mdi-plus </v-icon>
</v-btn>
</div>
<p v-if="invalid" style="color: red">{{ invalidMessage }}</p>
</v-card-text>
<v-card-actions>
<v-btn :disabled="!changed" @click="save">Save</v-btn>
</v-card-actions>
</v-card>
</template>
<script lang="ts">
import { Vue, Component, Prop, Emit } from "vue-property-decorator";
import {
MaterialGrouping,
PartMaterial,
SelectedBuildupEmit,
SelectedMaterialEmit,
} from "@/models/newAssessment";
import { MaterialFull } from "@/store/utilities/material-carbon-factors";
import MaterialType from "./MaterialType.vue";
import { ReportFullGroup } from "@/models/report";
@Component({
components: { MaterialType },
})
export default class ExpandedMaterialType extends Vue {
@Prop() materials!: MaterialFull[];
@Prop() type!: ReportFullGroup;
partMaterial: PartMaterial[] = [];
changed = true;
invalid = false;
invalidMessage = "";
mounted() {
this.partMaterial = Object.entries(this.type.objects[0].materials).map(
([k, v], i) => ({

Check warning on line 97 in src/components/assessment/ExpandedMaterialType.vue

View workflow job for this annotation

GitHub Actions / build (dev)

'k' is defined but never used

Check warning on line 97 in src/components/assessment/ExpandedMaterialType.vue

View workflow job for this annotation

GitHub Actions / build (16.x)

'k' is defined but never used

Check warning on line 97 in src/components/assessment/ExpandedMaterialType.vue

View workflow job for this annotation

GitHub Actions / build (prod)

'k' is defined but never used
id: i,
material: v.material,
percentage: (100 * (v.volume / this.type.objects[0].volume)).toString(),
})
);
if (this.partMaterial.length === 0) this.partMaterial = [{ id: 0 }];
}
@Emit("selectMaterial")
selectMaterial(): SelectedMaterialEmit {
return {
ids: this.type.objects.map((o) => o.id),
type: this.type.name,
};
}
save() {
this.changed = false;
let pass = true;
let totalPercentage = 0;
this.partMaterial.forEach((p) => {
if (p.percentage !== undefined) totalPercentage += +p.percentage;
else pass = false;
if (!p.material) pass = false;
});
if (!pass) {
this.invalidMessage = "All fields must be filled in";
this.invalid = true;
return;
} else if (totalPercentage !== 100) {
this.invalidMessage = "Percentages must equal 100";
this.invalid = true;
return;
}
this.selectBuildup();
}
getType(type: MaterialGrouping) {
return type;
}
addPart() {
this.partMaterial.push({
id: this.partMaterial[this.partMaterial.length - 1].id + 1,
});
}
removePart(id: number) {
this.partMaterial = this.partMaterial.filter((p) => p.id != id);
}
cleanType(type: string) {
const typeArr = type.split(".");
return typeArr[typeArr.length - 1];
}
checkMaterialUpdated() {
this.changed = true;
this.invalid = false;
}
percentageChanged(part: PartMaterial) {
if (part.percentage) {
if (+part.percentage > 100) part.percentage = "100";
else if (+part.percentage < 0) part.percentage = "0";
}
this.changed = true;
this.invalid = false;
}
getContrastYIQ(hexcolor: string) {
if (hexcolor.slice(0, 1) === "#") {
hexcolor = hexcolor.slice(1);
}
var r = parseInt(hexcolor.substr(0, 2), 16);
var g = parseInt(hexcolor.substr(2, 2), 16);
var b = parseInt(hexcolor.substr(4, 2), 16);
var yiq = (r * 299 + g * 587 + b * 114) / 1000;
return yiq >= 128 ? "black" : "white";
}
@Emit("selectBuildup")
selectBuildup(): SelectedBuildupEmit {
return {
ids: this.type.objects.map((o) => o.id),
materials: this.partMaterial,
};
}
}
</script>
Loading

0 comments on commit 982a105

Please sign in to comment.