Fix custom domain setting + fix maxFileSize preview
This commit is contained in:
parent
ff701fe433
commit
c0f01f4b84
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use App\Http\Requests\Workspace\CustomDomainRequest;
|
use App\Http\Requests\Workspace\CustomDomainRequest;
|
||||||
|
use App\Http\Resources\WorkspaceResource;
|
||||||
use App\Models\Workspace;
|
use App\Models\Workspace;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Service\WorkspaceHelper;
|
use App\Service\WorkspaceHelper;
|
||||||
|
@ -19,7 +19,7 @@ class WorkspaceController extends Controller
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->authorize('viewAny', Workspace::class);
|
$this->authorize('viewAny', Workspace::class);
|
||||||
return Auth::user()->workspaces;
|
return WorkspaceResource::collection(Auth::user()->workspaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function listUsers(Request $request, $workspaceId)
|
public function listUsers(Request $request, $workspaceId)
|
||||||
|
@ -34,7 +34,7 @@ class WorkspaceController extends Controller
|
||||||
{
|
{
|
||||||
$request->workspace->custom_domains = $request->customDomains;
|
$request->workspace->custom_domains = $request->customDomains;
|
||||||
$request->workspace->save();
|
$request->workspace->save();
|
||||||
return $request->workspace;
|
return new WorkspaceResource($request->workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($id)
|
public function delete($id)
|
||||||
|
|
|
@ -7,18 +7,18 @@ use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
class WorkspaceResource extends JsonResource
|
class WorkspaceResource extends JsonResource
|
||||||
{
|
{
|
||||||
|
public static $wrap = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
{
|
{
|
||||||
return [
|
return array_merge(parent::toArray($request), [
|
||||||
'id' => $this->id,
|
'max_file_size' => $this->max_file_size / 1000000,
|
||||||
'is_enterprise' => $this->is_enterprise,
|
]);
|
||||||
'is_pro' => $this->is_pro,
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,7 @@ export default {
|
||||||
const workingFormStore = useWorkingFormStore()
|
const workingFormStore = useWorkingFormStore()
|
||||||
return {
|
return {
|
||||||
workingFormStore,
|
workingFormStore,
|
||||||
|
currentWorkspace: computed(() => useWorkspacesStore().getCurrent),
|
||||||
selectedFieldIndex: computed(() => workingFormStore.selectedFieldIndex),
|
selectedFieldIndex: computed(() => workingFormStore.selectedFieldIndex),
|
||||||
showEditFieldSidebar: computed(() => workingFormStore.showEditFieldSidebar)
|
showEditFieldSidebar: computed(() => workingFormStore.showEditFieldSidebar)
|
||||||
}
|
}
|
||||||
|
@ -299,7 +300,7 @@ export default {
|
||||||
}
|
}
|
||||||
} else if (field.type === 'files' || (field.type === 'url' && field.file_upload)) {
|
} else if (field.type === 'files' || (field.type === 'url' && field.file_upload)) {
|
||||||
inputProperties.multiple = (field.multiple !== undefined && field.multiple)
|
inputProperties.multiple = (field.multiple !== undefined && field.multiple)
|
||||||
inputProperties.mbLimit = this.form.max_file_size
|
inputProperties.mbLimit = this.currentWorkspace.max_file_size ?? this.form.max_file_size
|
||||||
inputProperties.accept = (this.form.is_pro && field.allowed_file_types) ? field.allowed_file_types : ''
|
inputProperties.accept = (this.form.is_pro && field.allowed_file_types) ? field.allowed_file_types : ''
|
||||||
} else if (field.type === 'number' && field.is_rating) {
|
} else if (field.type === 'number' && field.is_rating) {
|
||||||
inputProperties.numberOfStars = parseInt(field.rating_max_value)
|
inputProperties.numberOfStars = parseInt(field.rating_max_value)
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template v-if="customDomainsEnabled">
|
<template v-if="customDomainsEnabled">
|
||||||
<text-area-input v-model="customDomains" name="custom_domain" class="mt-4" :required="false"
|
<text-area-input :form="customDomainsForm" name="custom_domains" class="mt-4" :required="false"
|
||||||
:disabled="!workspace.is_pro"
|
:disabled="!workspace.is_pro"
|
||||||
label="Workspace Custom Domains" wrapper-class="" placeholder="yourdomain.com - 1 per line"
|
label="Workspace Custom Domains" wrapper-class="" placeholder="yourdomain.com - 1 per line"
|
||||||
/>
|
/>
|
||||||
|
@ -135,7 +135,9 @@ let form = useForm({
|
||||||
emoji: ''
|
emoji: ''
|
||||||
})
|
})
|
||||||
let workspaceModal = ref(false)
|
let workspaceModal = ref(false)
|
||||||
let customDomains = ''
|
let customDomainsForm = useForm({
|
||||||
|
custom_domain: ''
|
||||||
|
})
|
||||||
let customDomainsLoading = ref(false)
|
let customDomainsLoading = ref(false)
|
||||||
|
|
||||||
let workspace = computed(() => workspacesStore.getCurrent)
|
let workspace = computed(() => workspacesStore.getCurrent)
|
||||||
|
@ -153,12 +155,14 @@ onMounted(() => {
|
||||||
const saveChanges = () => {
|
const saveChanges = () => {
|
||||||
if (customDomainsLoading.value) return
|
if (customDomainsLoading.value) return
|
||||||
customDomainsLoading.value = true
|
customDomainsLoading.value = true
|
||||||
|
|
||||||
// Update the workspace custom domain
|
// Update the workspace custom domain
|
||||||
opnFetch('/open/workspaces/' + workspace.value.id + '/custom-domains', {
|
customDomainsForm.put('/open/workspaces/' + workspace.value.id + '/custom-domains', {
|
||||||
method: 'PUT',
|
data: {
|
||||||
custom_domains: customDomains.split('\n')
|
custom_domains: customDomainsForm.custom_domains.split('\n')
|
||||||
.map(domain => domain ? domain.trim() : null)
|
.map(domain => domain ? domain.trim() : null)
|
||||||
.filter(domain => domain && domain.length > 0)
|
.filter(domain => domain && domain.length > 0)
|
||||||
|
}
|
||||||
}).then((data) => {
|
}).then((data) => {
|
||||||
workspacesStore.save(data)
|
workspacesStore.save(data)
|
||||||
useAlert().success('Custom domains saved.')
|
useAlert().success('Custom domains saved.')
|
||||||
|
@ -171,7 +175,7 @@ const saveChanges = () => {
|
||||||
|
|
||||||
const initCustomDomains = () => {
|
const initCustomDomains = () => {
|
||||||
if (!workspace || !workspace.value.custom_domains) return
|
if (!workspace || !workspace.value.custom_domains) return
|
||||||
customDomains = workspace.value.custom_domains.join('\n')
|
customDomainsForm.custom_domains = workspace.value.custom_domains.join('\n')
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteWorkspace = (workspaceId) => {
|
const deleteWorkspace = (workspaceId) => {
|
||||||
|
|
Loading…
Reference in New Issue