mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: expand verbose domains
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
import InputFile from '$lib/elements/forms/inputFile.svelte';
|
||||
import { buildVerboseDomain } from '../store';
|
||||
import { project } from '$routes/(console)/project-[project]/store';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
|
||||
export let data;
|
||||
let showExitModal = false;
|
||||
@@ -27,7 +28,9 @@
|
||||
let name = 'My website';
|
||||
let id = ID.unique();
|
||||
let domain = id;
|
||||
let framework: Models.Framework = data.frameworks.frameworks[0];
|
||||
let framework: Models.Framework =
|
||||
data.frameworks.frameworks?.find((f) => f.key === 'other') ??
|
||||
data.frameworks.frameworks?.[0];
|
||||
let adapter = framework?.adapters[0];
|
||||
let installCommand = adapter?.installCommand;
|
||||
let buildCommand = adapter?.buildCommand;
|
||||
@@ -37,7 +40,7 @@
|
||||
|
||||
async function create() {
|
||||
try {
|
||||
domain = await buildVerboseDomain(name, $project.name, id);
|
||||
domain = await buildVerboseDomain(name, $project.name, $organization.name, id);
|
||||
|
||||
const fr = Object.values(Framework).find((f) => f === framework.key);
|
||||
const buildRuntime = Object.values(BuildRuntime).find(
|
||||
|
||||
+2
-2
@@ -22,6 +22,7 @@
|
||||
// import Domain from '../../domain.svelte';
|
||||
import { consoleVariables } from '$routes/(console)/store';
|
||||
import { buildVerboseDomain } from '../../store';
|
||||
import { project } from '$routes/(console)/project-[project]/store';
|
||||
|
||||
export let data;
|
||||
let showExitModal = false;
|
||||
@@ -47,8 +48,6 @@
|
||||
installation.set(data.installation);
|
||||
repository.set(data.repository);
|
||||
name = data.repository.name;
|
||||
|
||||
// domain = await buildVerboseDomain(data.repository.name, data.repository.organization, id);
|
||||
});
|
||||
|
||||
async function loadBranches() {
|
||||
@@ -79,6 +78,7 @@
|
||||
domain = await buildVerboseDomain(
|
||||
data.repository.name,
|
||||
data.repository.organization,
|
||||
$project.name,
|
||||
id
|
||||
);
|
||||
const fr = Object.values(Framework).find((f) => f === framework.key);
|
||||
|
||||
@@ -19,19 +19,33 @@ export async function checkDomain(domain: string) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function buildVerboseDomain(name: string, specifier: string, unique?: string) {
|
||||
export async function buildVerboseDomain(
|
||||
name: string,
|
||||
specifier: string,
|
||||
secondarySpecifier?: string,
|
||||
unique?: string
|
||||
) {
|
||||
const safeName = toURLSafe(name).toLowerCase();
|
||||
const safeSpecifier = toURLSafe(specifier).toLowerCase();
|
||||
const safeSecondarySpecifier = secondarySpecifier
|
||||
? toURLSafe(secondarySpecifier).toLowerCase()
|
||||
: '';
|
||||
const safeUnique = unique ? toURLSafe(unique).toLowerCase() : ID.unique();
|
||||
let domain = `${safeName}`;
|
||||
if (await checkDomain(domain)) {
|
||||
return domain;
|
||||
}
|
||||
domain = `${safeName}-${safeSpecifier}`;
|
||||
domain += '-' + safeSpecifier;
|
||||
if (await checkDomain(domain)) {
|
||||
return domain;
|
||||
}
|
||||
domain = `${safeName}-${safeSpecifier}-${safeUnique}`;
|
||||
if (secondarySpecifier) {
|
||||
domain += '-' + safeSecondarySpecifier;
|
||||
if (await checkDomain(domain)) {
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
domain += '-' + safeUnique;
|
||||
if (await checkDomain(domain)) {
|
||||
return domain;
|
||||
}
|
||||
|
||||
+7
-1
@@ -34,6 +34,7 @@
|
||||
import { consoleVariables } from '$routes/(console)/store';
|
||||
import { project } from '$routes/(console)/project-[project]/store';
|
||||
import { buildVerboseDomain } from '../../store';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
|
||||
export let data;
|
||||
|
||||
@@ -123,7 +124,12 @@
|
||||
// }
|
||||
else {
|
||||
try {
|
||||
domain = await buildVerboseDomain(data.template.name, $project.name, id);
|
||||
domain = await buildVerboseDomain(
|
||||
data.template.name,
|
||||
$project.name,
|
||||
$organization.name,
|
||||
id
|
||||
);
|
||||
|
||||
const fr = Object.values(Framework).find((f) => f === framework.key);
|
||||
const buildRuntime = Object.values(BuildRuntime).find(
|
||||
|
||||
Reference in New Issue
Block a user