Skip to content

Commit

Permalink
MINOR: feat: photosphere building maker (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRichel authored Nov 21, 2024
1 parent 430a3a2 commit 1b02b84
Show file tree
Hide file tree
Showing 32 changed files with 842 additions and 131 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export { default as BIMDataMetaBuildingStructure } from "./src/BIMDataMetaBuildi
export { default as BIMDataModelPreview } from "./src/BIMDataModelPreview/BIMDataModelPreview.vue";
export { default as BIMDataPDFViewer } from "./src/BIMDataPDFViewer/BIMDataPDFViewer.vue";
export { default as BIMDataPhotosphereBuilding } from "./src/BIMDataPhotosphereBuilding/BIMDataPhotosphereBuilding.vue";
export { default as BIMDataPhotosphereBuildingMaker } from "./src/BIMDataPhotosphereBuildingMaker/BIMDataPhotosphereBuildingMaker.vue";
export { default as BIMDataSafeZoneModal } from "./src/BIMDataSafeZoneModal/BIMDataSafeZoneModal.vue";
16 changes: 5 additions & 11 deletions src/BIMDataBuildingMaker/BIMDataBuildingMaker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createService } from "./service.js";
// Components
import BuildingForm from "./BuildingForm/BuildingForm.vue";
import BuildingsList from "./BuildingsList/BuildingsList.vue";
import BuildingStoreys from "./BuildingStoreys/BuildingStoreys.vue";
import BuildingView from "./BuildingView/BuildingView.vue";
const props = defineProps({
apiClient: {
Expand Down Expand Up @@ -102,21 +102,15 @@ onMounted(() => loadMetaBuildings());
:disabled="loading.value"
@click="back"
>
<BIMDataIconArrow
size="xxs"
margin="0 6px 0 0"
/>
<span>{{ $t("BuildingMaker.back") }}</span>
<BIMDataIconArrow size="xxs" margin="0 6px 0 0" />
<span>{{ $t("BIMDataComponents.t.back") }}</span>
</BIMDataButton>
<img :src="icon" />
<span>{{ $t("BuildingMaker.title") }}</span>
</div>
<div class="bimdata-building-maker__body">
<transition
name="fade"
mode="out-in"
>
<transition name="fade" mode="out-in">
<template v-if="currentView === VIEWS.FORM">
<BuildingForm
:metaBuilding="currentMetaBuilding"
Expand All @@ -126,7 +120,7 @@ onMounted(() => loadMetaBuildings());
</template>
<template v-else-if="currentView === VIEWS.VIEW && currentMetaBuilding">
<BuildingStoreys
<BuildingView
:apiClient="apiClient"
:space="space"
:project="project"
Expand Down
17 changes: 13 additions & 4 deletions src/BIMDataBuildingMaker/BuildingForm/BuildingForm.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<script setup>
import { inject, onMounted, ref, watch } from "vue";
import { BUILDING_TYPES } from "../config.js";
import icon from "../icon.svg";
const props = defineProps({
metaBuilding: {
type: {
type: String,
default: BUILDING_TYPES.METABUILDING
},
metaBuilding: {
type: Object,
},
});
Expand Down Expand Up @@ -42,7 +47,11 @@ const submit = async () => {
newBuilding = await service.updateMetaBuilding(newBuilding);
emit("metaBuilding-updated", newBuilding);
} else {
newBuilding = await service.createMetaBuilding(newBuilding);
if (props.type === BUILDING_TYPES.PHOTOSPHERE_BUILDING) {
newBuilding = await service.createPhotosphereBuilding(newBuilding);
} else {
newBuilding = await service.createMetaBuilding(newBuilding);
}
emit("metaBuilding-created", newBuilding);
}
};
Expand All @@ -55,7 +64,7 @@ const submit = async () => {
{{ $t("BuildingMaker.title") }}
</h2>
<div class="building-form__text">
{{ $t("BuildingMaker.form.text") }}
{{ $t("BuildingMaker.list.text") }}
</div>
<div class="building-form__controls">
<BIMDataInput
Expand All @@ -67,7 +76,7 @@ const submit = async () => {
@keyup.enter.stop="submit"
/>
<BIMDataButton width="120px" color="primary" fill radius @click="submit">
{{ $t(`BuildingMaker.form.${metaBuilding ? 'updateButton' : 'createButton'}`) }}
{{ $t(`BIMDataComponents.t.${metaBuilding ? 'validate' : 'create'}`) }}
</BIMDataButton>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const openFileManager = storey => {
};
const closeFileManager = async () => {
let docs = [], pdfs = [];
const docs = [], pdfs = [];
for (const { document, pdfPage } of selectedFiles.value) {
if (pdfPage) {
pdfs.push(pdfPage);
Expand Down Expand Up @@ -115,11 +115,11 @@ onMounted(() => {
</script>

<template>
<div class="building-storeys">
<div class="building-view">
<transition name="fade" mode="out-in">
<div class="content" v-if="isOpenDMS && apiUrl && accessToken && currentStorey">
<BIMDataFileManager
class="building-storeys__dms"
class="building-view__dms"
:spaceId="space.id"
:projectId="project.id"
:apiUrl="apiUrl"
Expand All @@ -140,12 +140,12 @@ onMounted(() => {
radius
@click="closeFileManager"
>
{{ $t("BuildingMaker.view.submitFilesButton") }}
{{ $t("BIMDataComponents.t.validate") }}
</BIMDataButton>
</div>

<div class="content" v-else>
<div class="building-storeys__tree">
<div class="building-view__tree">
<StoreysTree
:metaBuilding="metaBuilding"
:storeys="storeys"
Expand All @@ -163,13 +163,13 @@ onMounted(() => {
radius
@click="$emit('close')"
>
{{ $t("BuildingMaker.view.closeButton") }}
{{ $t("BIMDataComponents.t.finish") }}
</BIMDataButton>

<transition name="fade">
<StoreyForm
v-if="isOpenForm"
class="building-storeys__form"
class="building-view__form"
:storey="currentStorey"
@create-storey="createStorey"
@update-storey="updateStorey"
Expand All @@ -182,7 +182,7 @@ onMounted(() => {
</template>

<style scoped>
.building-storeys {
.building-view {
height: 100%;
.content {
Expand All @@ -192,13 +192,13 @@ onMounted(() => {
flex-direction: column;
}
.building-storeys__tree,
.building-storeys__dms {
.building-view__tree,
.building-view__dms {
flex-grow: 1;
overflow-y: auto;
}
.building-storeys__form {
.building-view__form {
position: absolute;
top: calc(var(--spacing-unit) * 2);
left: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ const cancel = () => {
</div>
<div class="storey-form__actions">
<BIMDataButton width="100px" color="primary" fill radius @click="submit">
{{ $t("BuildingMaker.storeyForm.submitButton") }}
{{ $t("BIMDataComponents.t.validate") }}
</BIMDataButton>
<BIMDataButton width="100px" fill radius @click="cancel">
{{ $t("BuildingMaker.storeyForm.cancelButton") }}
{{ $t("BIMDataComponents.t.cancel") }}
</BIMDataButton>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const isOpenAction = ref(false);
radius
@click="$emit('add-plans', storey)"
>
{{ $t("BuildingMaker.view.addFileButton") }}
{{ $t("BuildingMaker.view.addPlan") }}
</BIMDataButton>
</div>
</Transition>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const isOpenAction = ref(false);
</BIMDataButton>

<BIMDataButton width="100px" fill radius @click="$emit('create')">
+ {{ $t("BuildingMaker.view.addStoreyButton") }}
{{ $t("BuildingMaker.view.addStorey") }}
</BIMDataButton>
</div>
</Transition>
Expand Down
4 changes: 2 additions & 2 deletions src/BIMDataBuildingMaker/BuildingsList/BuildingItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ const isOpenAction = ref(false);
square
@click="$emit('update-metaBuilding', metaBuilding)"
>
{{ $t("BuildingMaker.list.updateButton") }}
{{ $t("BIMDataComponents.t.rename") }}
</BIMDataButton>
<BIMDataButton
color="high"
ghost
square
@click="$emit('delete-metaBuilding', metaBuilding)"
>
{{ $t("BuildingMaker.list.deleteButton") }}
{{ $t("BIMDataComponents.t.delete") }}
</BIMDataButton>
</div>
</transition>
Expand Down
2 changes: 1 addition & 1 deletion src/BIMDataBuildingMaker/BuildingsList/BuildingsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ defineEmits([
radius
@click="$emit('create-metaBuilding')"
>
{{ $t("BuildingMaker.list.createButton") }}
{{ $t("BuildingMaker.list.new") }}
</BIMDataButton>

<div class="buildings-list__list">
Expand Down
6 changes: 6 additions & 0 deletions src/BIMDataBuildingMaker/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
const BUILDING_TYPES = {
METABUILDING: "METABUILDING",
PHOTOSPHERE_BUILDING: "PHOTOSPHERE_BUILDING",
};

const PLAN_FILE_EXTENSIONS = Object.freeze(["jpeg", "jpg", "pdf", "png"]);

export {
BUILDING_TYPES,
PLAN_FILE_EXTENSIONS,
};
27 changes: 26 additions & 1 deletion src/BIMDataBuildingMaker/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ function createService(apiClient, space, project) {
const projectId = project.id;
const modelApi = apiClient.modelApi;

// ---

function fetchMetaBuildings() {
return modelApi.getModels(
spaceId,
Expand All @@ -27,10 +29,30 @@ function createService(apiClient, space, project) {

// ---

async function fetchStoreys(model) {
function fetchPhotosphereBuildings() {
return modelApi.getModels(
spaceId,
projectId,
undefined, // source
undefined, // status
"PHOTOSPHERE_BUILDING" // type
);
}

function createPhotosphereBuilding(model) {
return modelApi.createPhotosphereBuilding(spaceId, projectId, model);
}

// ---

function fetchStoreys(model) {
return modelApi.getStoreys(spaceId, model.id, projectId);
}

function fetchZones(model) {
return modelApi.getZones(spaceId, model.id, projectId);
}

function createStorey(model, storey) {
return modelApi.createStorey(
spaceId,
Expand Down Expand Up @@ -108,7 +130,10 @@ function createService(apiClient, space, project) {
createMetaBuilding,
updateMetaBuilding,
deleteMetaBuilding,
fetchPhotosphereBuildings,
createPhotosphereBuilding,
fetchStoreys,
fetchZones,
createStorey,
updateStorey,
deleteStorey,
Expand Down
8 changes: 4 additions & 4 deletions src/BIMDataFileManager/components/FileCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
width="100%"
@click.stop="onViewClick"
>
{{ $t("FileManager.view") }}
{{ $t("BIMDataComponents.t.view") }}
</BIMDataButton>
<BIMDataButton
color="default"
Expand All @@ -87,7 +87,7 @@
width="100%"
@click.stop="onRenameClick"
>
{{ $t("FileManager.rename") }}
{{ $t("BIMDataComponents.t.rename") }}
</BIMDataButton>
<BIMDataButton
color="default"
Expand All @@ -96,7 +96,7 @@
width="100%"
@click.stop="onDownloadClick"
>
{{ $t("FileManager.download") }}
{{ $t("BIMDataComponents.t.download") }}
</BIMDataButton>
<BIMDataButton
v-if="writeAccess"
Expand All @@ -106,7 +106,7 @@
width="100%"
@click.stop="onDeleteClick"
>
{{ $t("FileManager.delete") }}
{{ $t("BIMDataComponents.t.delete") }}
</BIMDataButton>
</div>
<div class="file-card__content__footer">
Expand Down
4 changes: 2 additions & 2 deletions src/BIMDataFileManager/components/PdfPageSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<BIMDataButton ghost radius @click="$emit('close')">
<BIMDataIconArrow size="xxs" />
<span style="margin-left: 6px">
{{ $t("FileManager.back") }}
{{ $t("BIMDataComponents.t.back") }}
</span>
</BIMDataButton>
<span class="title">
Expand Down Expand Up @@ -54,7 +54,7 @@
radius
@click="$emit('select', selectedPage)"
>
{{ $t("FileManager.validate") }}
{{ $t("BIMDataComponents.t.validate") }}
</BIMDataButton>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/BIMDataFileManager/components/modals/DeleteModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@click.stop="close"
:disabled="loading"
>
{{ $t("FileManager.cancel") }}
{{ $t("BIMDataComponents.t.cancel") }}
</BIMDataButton>
<BIMDataButton
class="delete-modal__content__btn-submit"
Expand All @@ -46,7 +46,7 @@
:disabled="loading"
>
<BIMDataSpinner v-if="loading" />
<span v-else>{{ $t("FileManager.delete") }}</span>
<span v-else>{{ $t("BIMDataComponents.t.delete") }}</span>
</BIMDataButton>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/BIMDataFileManager/components/modals/RenameModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</BIMDataButton>
<div class="rename-modal__content">
<div class="rename-modal__content__title">
{{ $t("FileManager.rename") }}
{{ $t("BIMDataComponents.t.rename") }}
</div>
<BIMDataInput
ref="nameInput"
Expand All @@ -36,7 +36,7 @@
radius
@click.stop="close"
>
{{ $t("FileManager.cancel") }}
{{ $t("BIMDataComponents.t.cancel") }}
</BIMDataButton>
<BIMDataButton
class="rename-modal__content__btn-submit"
Expand All @@ -46,7 +46,7 @@
radius
@click.stop="submit"
>
{{ $t("FileManager.submit") }}
{{ $t("BIMDataComponents.t.validate") }}
</BIMDataButton>
</div>
</div>
Expand Down
Loading

0 comments on commit 1b02b84

Please sign in to comment.