-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
save for reuse for simulation assets (#4906)
Co-authored-by: Cole Blanchard <[email protected]>
- Loading branch information
Showing
10 changed files
with
318 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/client/hmi-client/src/components/project/tera-save-simulation-modal.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<template> | ||
<tera-modal | ||
v-if="isVisible" | ||
class="w-4" | ||
@modal-mask-clicked="closeModal" | ||
@on-modal-open="newName = props.initialName ?? ''" | ||
@modal-enter-press="save" | ||
> | ||
<template #header> | ||
<h4>Save simulation assets</h4> | ||
</template> | ||
<template #default> | ||
<form @submit.prevent> | ||
<label for="new-name">What would you like to call it?</label> | ||
<tera-input-text id="new-name" v-model="newName" placeholder="Enter a unique name" /> | ||
</form> | ||
</template> | ||
<template #footer> | ||
<Button label="Save" size="large" @click="save" /> | ||
<Button label="Close" class="p-button-secondary" size="large" outlined @click="closeModal" /> | ||
</template> | ||
</tera-modal> | ||
</template> | ||
<script setup lang="ts"> | ||
import TeraModal from '@/components/widgets/tera-modal.vue'; | ||
import Button from 'primevue/button'; | ||
import TeraInputText from '@/components/widgets/tera-input-text.vue'; | ||
import { AssetType } from '@/types/Types'; | ||
import { ref } from 'vue'; | ||
import { useProjects } from '@/composables/project'; | ||
import { createSimulationAssets } from '@/services/models/simulation-service'; | ||
const props = defineProps<{ | ||
initialName?: string; | ||
isVisible: boolean; | ||
simulationId: string; | ||
assets: { id: string; type: AssetType }[]; | ||
}>(); | ||
const newName = ref(''); | ||
const emit = defineEmits(['close-modal', 'on-save']); | ||
function save() { | ||
createSimulationAssets(props.simulationId, newName.value, props.assets).then((data) => { | ||
useProjects().refresh(); | ||
closeModal(); | ||
emit('on-save', data); | ||
}); | ||
} | ||
function closeModal() { | ||
newName.value = ''; | ||
emit('close-modal'); | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.