Skip to content

Commit

Permalink
feat: container hostname support added (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmoysrt authored Sep 14, 2024
1 parent c1038ab commit 4e815e7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/store/applicationUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default function newApplicationUpdater(applicationId) {
deploymentMode
replicas
command
hostname
resourceLimit {
memoryMb
}
Expand Down Expand Up @@ -210,6 +211,7 @@ export default function newApplicationUpdater(applicationId) {
const applicationConfiguration = applicationDetailsRaw.value?.application ?? {}
deploymentConfigurationDetails.deploymentMode = applicationConfiguration.deploymentMode
deploymentConfigurationDetails.replicas = applicationConfiguration.replicas
deploymentConfigurationDetails.hostname = applicationConfiguration.hostname
deploymentConfigurationDetails.resourceLimit.memoryMb = applicationConfiguration.resourceLimit.memoryMb
deploymentConfigurationDetails.reservedResource.memoryMb = applicationConfiguration.reservedResource.memoryMb
deploymentConfigurationDetails.preferredServerHostnames = applicationConfiguration.preferredServerHostnames
Expand Down Expand Up @@ -310,6 +312,7 @@ export default function newApplicationUpdater(applicationId) {
const deploymentConfigurationDetails = reactive({
deploymentMode: '',
replicas: 0,
hostname: '',
resourceLimit: {
memoryMb: 0
},
Expand Down Expand Up @@ -521,6 +524,7 @@ export default function newApplicationUpdater(applicationId) {
name
deploymentMode
command
hostname
replicas
resourceLimit {
memoryMb
Expand Down Expand Up @@ -624,6 +628,10 @@ export default function newApplicationUpdater(applicationId) {
if (applicationExistingDetails.replicas.toString() !== deploymentConfigurationDetails.replicas.toString()) {
return true
}
// check if container hostname is changed
if (applicationExistingDetails.hostname !== deploymentConfigurationDetails.hostname) {
return true
}
// check if deploy proxy config changed
if (
applicationExistingDetails.dockerProxyConfig.enabled !==
Expand Down Expand Up @@ -862,6 +870,7 @@ export default function newApplicationUpdater(applicationId) {
command: sourceConfigurationRef.command,
deploymentMode: deploymentConfigurationDetails.deploymentMode,
replicas: deploymentConfigurationDetails.replicas,
hostname: deploymentConfigurationDetails.hostname,
resourceLimit: {
memoryMb: deploymentConfigurationDetails.resourceLimit.memoryMb
},
Expand Down
14 changes: 14 additions & 0 deletions src/views/pages/ApplicationDetails/DeploymentConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import DockerProxyPermissionChoose from '@/views/partials/DockerProxyPermissionC
import Disclosure from '@/views/components/Disclosure.vue'
import ConfigureDeploymentPreferredServers from '@/views/partials/ConfigureDeploymentPreferredServers.vue'
import { ref } from 'vue'
import { preventSpaceInput } from '@/vendor/utils'
const router = useRouter()
const applicationUpdater = newApplicationUpdater(router.currentRoute.value.params.id)()
Expand Down Expand Up @@ -58,6 +59,19 @@ const openConfigureDeploymentPreferredServers = () => {
readonly />
</div>
</div>
<!-- Container Hostname -->
<div class="mt-3">
<p class="font-medium text-black">Container Hostname</p>
<div class="mt-1">
<input
class="mt-1 block w-full rounded-md border-gray-300 text-sm shadow-sm focus:border-primary-500 focus:ring-primary-500"
placeholder="Provide container hostname"
type="text"
v-model="applicationUpdater.deploymentConfigurationDetails.hostname"
@change="applicationUpdater.triggerUpdateHook"
@keydown="preventSpaceInput" />
</div>
</div>
<!-- Memory Config -->
<Disclosure class="mt-4">
<template v-slot:title>Memory Configuration (Click to expand)</template>
Expand Down
2 changes: 2 additions & 0 deletions src/views/pages/DeployApplication.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const changeTab = (index) => {
const newApplicationState = reactive({
name: '',
upstreamType: '',
hostname: '',
command: '',
deploymentMode: '',
replicas: 0,
Expand Down Expand Up @@ -175,6 +176,7 @@ const finalizeApplicationAdditionalSettings = (additionalSettings) => {
// NOTE: Don't modify as configuration is a reference to the state of `ApplicationAdditionalSettings.vue`
newApplicationState.deploymentMode = additionalSettings.deploymentMode
newApplicationState.replicas = additionalSettings.replicas
newApplicationState.hostname = additionalSettings.hostname
newApplicationState.environmentVariables = additionalSettings.environmentVariables
newApplicationState.persistentVolumeBindings = additionalSettings.persistentVolumeBindings
newApplicationState.configMounts = additionalSettings.configMounts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Disclosure from '@/views/components/Disclosure.vue'
import ConfigMountsEditor from '@/views/partials/DeployApplication/ConfigMountsEditor.vue'
import ConfigureDeploymentPreferredServers from '@/views/partials/ConfigureDeploymentPreferredServers.vue'
import DockerProxyPermissionChoose from '@/views/partials/DockerProxyPermissionChoose.vue'
import { preventSpaceInput } from '@/vendor/utils'
const props = defineProps({
finalizeApplicationAdditionalSettingsAndDeploy: {
Expand All @@ -24,6 +25,7 @@ const props = defineProps({
const stateRef = reactive({
replicas: 1,
deploymentStrategy: 'replicated',
hostname: '',
// replicate -> false, global -> true,
environmentVariablesKeys: [],
environmentVariablesMap: {},
Expand Down Expand Up @@ -167,6 +169,7 @@ const submitDetails = () => {
let details = {
deploymentMode: stateRef.deploymentStrategy,
replicas: stateRef.replicas,
hostname: stateRef.hostname,
environmentVariables: environmentVariables,
persistentVolumeBindings: Object.values(stateRef.persistentVolumeBindingsMap),
configMounts: Object.values(stateRef.configMountsMap),
Expand Down Expand Up @@ -265,6 +268,18 @@ const openConfigureDeploymentPreferredServers = () => {
:delete-config-mount="deleteConfigMount"
:on-config-content-change="onConfigMountContentChange" />
</div>
<!-- Container Hostname -->
<div class="mt-3">
<p class="font-medium text-black">Container Hostname</p>
<div class="mt-1">
<input
class="mt-1 block w-full rounded-md border-gray-300 text-sm shadow-sm focus:border-primary-500 focus:ring-primary-500"
placeholder="Provide container hostname"
type="text"
v-model="stateRef.hostname"
@keydown="preventSpaceInput" />
</div>
</div>
<!-- Healthcheck -->
<div class="mt-3 w-full">
<div class="flex flex-row items-center gap-2">
Expand Down

0 comments on commit 4e815e7

Please sign in to comment.