Skip to content

Commit

Permalink
Merge pull request #287 from rstudio/sagerb-populate-initial-value-fo…
Browse files Browse the repository at this point in the history
…r-title

Update Title input field to reference Pinia deployment store
  • Loading branch information
sagerb authored Oct 16, 2023
2 parents efc7d7c + fbf88d5 commit 56e4355
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion web/src/api/types/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ export type ConnectEnvironmentVariable = {
}

export type ConnectDeployment = {
connect: ConnectContent;
content: ConnectContent;
environment: ConnectEnvironmentVariable[];
}
24 changes: 22 additions & 2 deletions web/src/components/configurePublish/PublishingHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,33 @@

<script setup lang="ts">

import { ref } from 'vue';
import { useApi } from 'src/api';
import { useDeploymentStore } from 'src/stores/deployment';
import { computed } from 'vue';

const emit = defineEmits(['publish']);

const api = useApi();
const title = ref('');
const deploymentStore = useDeploymentStore();

// Unable to use storeToRefs from pinia because deployment is not
// always defined. We might want to revisit this and instead define it
// initially with an empty definition.
const title = computed({
get() {
if (deploymentStore.deployment) {
return deploymentStore.deployment.connect.content.title;
}
return '';
},
set(val) {
if (deploymentStore.deployment) {
deploymentStore.deployment.connect.content.title = val;
} else {
console.log('Error setting title into empty deployment object!');
}
}
});

const onPublish = async() => {
emit('publish');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ describe('description', () => {
}
},
connect: {
connect: {
content: {
name: '',
},
environment: [
Expand Down

0 comments on commit 56e4355

Please sign in to comment.