fix: disable certain parts if readonly label is turned off

This commit is contained in:
Andras Bacsai
2025-01-27 14:05:18 +01:00
parent 2d3ac5a62a
commit fddaf9134d
2 changed files with 54 additions and 22 deletions

View File

@@ -187,6 +187,9 @@ class General extends Component
}); });
} }
} }
if ($this->application->settings->is_container_label_readonly_enabled) {
$this->resetDefaultLabels(false);
}
} }
public function loadComposeFile($isInit = false) public function loadComposeFile($isInit = false)

View File

@@ -71,27 +71,50 @@
@endif @endif
@if ($application->build_pack !== 'dockercompose') @if ($application->build_pack !== 'dockercompose')
<div class="flex items-end gap-2"> <div class="flex items-end gap-2">
@if ($application->settings->is_container_label_readonly_enabled == false)
<x-forms.input placeholder="https://coolify.io" wire:model.blur="application.fqdn" label="Domains" <x-forms.input placeholder="https://coolify.io" wire:model.blur="application.fqdn"
helper="You can specify one domain with path or more with comma. You can specify a port to bind the domain to.<br><br><span class='text-helper'>Example</span><br>- http://app.coolify.io,https://cloud.coolify.io/dashboard<br>- http://app.coolify.io/api/v3<br>- http://app.coolify.io:3000 -> app.coolify.io will point to port 3000 inside the container. " /> label="Domains" readonly
<x-forms.button wire:click="getWildcardDomain">Generate Domain helper="Readonly labels are disabled. You can set the domains in the labels section." />
</x-forms.button> @else
<x-forms.input placeholder="https://coolify.io" wire:model.blur="application.fqdn"
label="Domains"
helper="You can specify one domain with path or more with comma. You can specify a port to bind the domain to.<br><br><span class='text-helper'>Example</span><br>- http://app.coolify.io,https://cloud.coolify.io/dashboard<br>- http://app.coolify.io/api/v3<br>- http://app.coolify.io:3000 -> app.coolify.io will point to port 3000 inside the container. " />
<x-forms.button wire:click="getWildcardDomain">Generate Domain
</x-forms.button>
@endif
</div> </div>
<div class="flex items-end gap-2"> <div class="flex items-end gap-2">
<x-forms.select label="Direction" id="application.redirect" required @if ($application->settings->is_container_label_readonly_enabled == false)
helper="You must need to add www and non-www as an A DNS record. Make sure the www domain is added under Domains."> @if ($application->redirect === 'both')
<option value="both">Allow www & non-www.</option> <x-forms.input label="Direction" value="Allow www & non-www." readonly
<option value="www">Redirect to www.</option> helper="Readonly labels are disabled. You can set the direction in the labels section." />
<option value="non-www">Redirect to non-www.</option> @elseif ($application->redirect === 'www')
</x-forms.select> <x-forms.input label="Direction" value="Redirect to www." readonly
<x-modal-confirmation title="Confirm Redirection Setting?" buttonTitle="Set Direction" helper="Readonly labels are disabled. You can set the direction in the labels section." />
submitAction="setRedirect" :actions="['All traffic will be redirected to the selected direction.']" confirmationText="{{ $application->fqdn . '/' }}" @elseif ($application->redirect === 'non-www')
confirmationLabel="Please confirm the execution of the action by entering the Application URL below" <x-forms.input label="Direction" value="Redirect to non-www." readonly
shortConfirmationLabel="Application URL" :confirmWithPassword="false" step2ButtonText="Set Direction"> helper="Readonly labels are disabled. You can set the direction in the labels section." />
<x-slot:customButton> @endif
<div class="w-[7.2rem]">Set Direction</div> @else
</x-slot:customButton> <x-forms.select label="Direction" id="application.redirect" required
</x-modal-confirmation> helper="You must need to add www and non-www as an A DNS record. Make sure the www domain is added under Domains.">
<option value="both">Allow www & non-www.</option>
<option value="www">Redirect to www.</option>
<option value="non-www">Redirect to non-www.</option>
</x-forms.select>
@if ($application->settings->is_container_label_readonly_enabled)
<x-modal-confirmation title="Confirm Redirection Setting?" buttonTitle="Set Direction"
submitAction="setRedirect" :actions="['All traffic will be redirected to the selected direction.']"
confirmationText="{{ $application->fqdn . '/' }}"
confirmationLabel="Please confirm the execution of the action by entering the Application URL below"
shortConfirmationLabel="Application URL" :confirmWithPassword="false"
step2ButtonText="Set Direction">
<x-slot:customButton>
<div class="w-[7.2rem]">Set Direction</div>
</x-slot:customButton>
</x-modal-confirmation>
@endif
@endif
</div> </div>
@endif @endif
@@ -299,9 +322,15 @@
@if ($application->settings->is_static || $application->build_pack === 'static') @if ($application->settings->is_static || $application->build_pack === 'static')
<x-forms.input id="application.ports_exposes" label="Ports Exposes" readonly /> <x-forms.input id="application.ports_exposes" label="Ports Exposes" readonly />
@else @else
<x-forms.input placeholder="3000,3001" id="application.ports_exposes" label="Ports Exposes" @if ($application->settings->is_container_label_readonly_enabled === false)
required <x-forms.input placeholder="3000,3001" id="application.ports_exposes"
helper="A comma separated list of ports your application uses. The first port will be used as default healthcheck port if nothing defined in the Healthcheck menu. Be sure to set this correctly." /> label="Ports Exposes" readonly
helper="Readonly labels are disabled. You can set the ports manually in the labels section." />
@else
<x-forms.input placeholder="3000,3001" id="application.ports_exposes"
label="Ports Exposes" required
helper="A comma separated list of ports your application uses. The first port will be used as default healthcheck port if nothing defined in the Healthcheck menu. Be sure to set this correctly." />
@endif
@endif @endif
@if (!$application->destination->server->isSwarm()) @if (!$application->destination->server->isSwarm())
<x-forms.input placeholder="3000:3000" id="application.ports_mappings" label="Ports Mappings" <x-forms.input placeholder="3000:3000" id="application.ports_mappings" label="Ports Mappings"