Fix leftover fields and attributes

This commit is contained in:
Matej Bačo
2024-10-27 15:48:39 +01:00
parent a171e17666
commit 385fe303cc
8 changed files with 10 additions and 88 deletions
-11
View File
@@ -3402,17 +3402,6 @@ $projectCollections = array_merge([
'default' => APP_FUNCTION_SPECIFICATION_DEFAULT,
'filters' => [],
],
[
'$id' => ID::custom('fallbackRedirect'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 2048,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('serveRuntime'),
'type' => Database::VAR_STRING,
+8 -32
View File
@@ -2,60 +2,36 @@
const TEMPLATE_FRAMEWORKS = [
'SVELTEKIT' => [
'name' => 'sveltekit'
'name' => 'Svelte Kit'
],
'NEXTJS' => [
'name' => 'nextjs'
'name' => 'Next.js'
],
];
function getFramework($framework, $installCommand, $buildCommand, $outputDirectory, $fallbackRedirect, $providerRootDirectory)
function getFramework($framework, $installCommand, $buildCommand, $outputDirectory, $providerRootDirectory)
{
return [
'name' => $framework['name'],
'installCommand' => $installCommand,
'buildCommand' => $buildCommand,
'outputDirectory' => $outputDirectory,
'fallbackRedirect' => $fallbackRedirect,
'providerRootDirectory' => $providerRootDirectory
];
}
return [
[
'icon' => 'icon-lightning-bolt',
'id' => 'starter',
'name' => 'Starter site',
'tagline' =>
'A simple site to get started. Edit this site to explore endless possibilities with Appwrite Sites.',
'name' => 'Personal portfolio',
'useCases' => ['starter'],
'frameworks' => [
...getFramework(TEMPLATE_FRAMEWORKS['SVELTEKIT'], 'npm install', 'npm run build', 'build', 'index.html', 'node/starter')
...getFramework(TEMPLATE_FRAMEWORKS['SVELTEKIT'], 'npm install --force', 'npm run build', './build', './')
],
'instructions' => 'For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/starter">file</a>.',
'vcsProvider' => 'github',
'providerRepositoryId' => 'templates',
'providerOwner' => 'appwrite',
'providerVersion' => '0.2.*',
'providerRepositoryId' => 'portfolio-walter-o-brien',
'providerOwner' => 'adityaoberai',
'providerVersion' => '0.1.*',
'variables' => [],
'scopes' => ['users.read']
],
[
'icon' => 'icon-lightning-bolt',
'id' => 'starter1',
'name' => 'Starter1 site',
'tagline' =>
'A simple site to get started. Edit this site to explore endless possibilities with Appwrite Sites.',
'useCases' => ['messaging'],
'frameworks' => [
...getFramework(TEMPLATE_FRAMEWORKS['SVELTEKIT'], 'npm install', 'npm run build', 'build', 'index.html', 'node/starter1')
],
'instructions' => 'For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/starter">file</a>.',
'vcsProvider' => 'github',
'providerRepositoryId' => 'templates',
'providerOwner' => 'appwrite',
'providerVersion' => '0.2.*',
'variables' => [],
'scopes' => ['users.read']
]
];
-1
View File
@@ -204,7 +204,6 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId
'installCommand' => $resource->getAttribute('installCommand', ''),
'buildCommand' => $resource->getAttribute('buildCommand', ''),
'outputDirectory' => $resource->getAttribute('outputDirectory', ''),
'fallbackRedirect' => $resource->getAttribute('fallbackRedirect', ''),
'type' => 'vcs',
'installationId' => $installationId,
'installationInternalId' => $installationInternalId,
@@ -62,7 +62,6 @@ class CreateSite extends Base
->param('installCommand', '', new Text(8192, 0), 'Install Command.', true)
->param('buildCommand', '', new Text(8192, 0), 'Build Command.', true)
->param('outputDirectory', '', new Text(8192, 0), 'Output Directory for site.', true)
->param('fallbackRedirect', '', new Text(8192, 0), 'Fallback Redirect URL for site in case a route is not found.', true)
->param('installationId', '', new Text(128, 0), 'Appwrite Installation ID for VCS (Version Control System) deployment.', true)
->param('providerRepositoryId', '', new Text(128, 0), 'Repository ID of the repo linked to the site.', true)
->param('providerBranch', '', new Text(128, 0), 'Production branch for the repo linked to the site.', true)
@@ -90,7 +89,7 @@ class CreateSite extends Base
->callback([$this, 'action']);
}
public function action(string $siteId, string $name, string $framework, bool $enabled, string $installCommand, string $buildCommand, string $outputDirectory, string $fallbackRedirect, string $installationId, string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $templateRepository, string $templateOwner, string $templateRootDirectory, string $templateVersion, string $specification, Request $request, Response $response, Database $dbForProject, Document $project, Document $user, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github)
public function action(string $siteId, string $name, string $framework, bool $enabled, string $installCommand, string $buildCommand, string $outputDirectory, string $installationId, string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $templateRepository, string $templateOwner, string $templateRootDirectory, string $templateVersion, string $specification, Request $request, Response $response, Database $dbForProject, Document $project, Document $user, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github)
{
$siteId = ($siteId == 'unique()') ? ID::unique() : $siteId;
@@ -135,7 +134,6 @@ class CreateSite extends Base
'installCommand' => $installCommand,
'buildCommand' => $buildCommand,
'outputDirectory' => $outputDirectory,
'fallbackRedirect' => $fallbackRedirect,
'search' => implode(' ', [$siteId, $name, $framework]),
'installationId' => $installation->getId(),
'installationInternalId' => $installation->getInternalId(),
@@ -60,7 +60,6 @@ class UpdateSite extends Base
->param('installCommand', '', new Text(8192, 0), 'Install Command.', true)
->param('buildCommand', '', new Text(8192, 0), 'Build Command.', true)
->param('outputDirectory', '', new Text(8192, 0), 'Output Directory for site.', true)
->param('fallbackRedirect', '', new Text(8192, 0), 'Fallback Redirect URL for site in case a route is not found.', true)
->param('scopes', [], new ArrayList(new WhiteList(array_keys(Config::getParam('scopes')), true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of scopes allowed for API key auto-generated for every execution. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' scopes are allowed.', true) //TODO: Update description of scopes
->param('installationId', '', new Text(128, 0), 'Appwrite Installation ID for VCS (Version Control System) deployment.', true)
->param('providerRepositoryId', '', new Text(128, 0), 'Repository ID of the repo linked to the site.', true)
@@ -84,7 +83,7 @@ class UpdateSite extends Base
->callback([$this, 'action']);
}
public function action(string $siteId, string $name, string $framework, bool $enabled, string $installCommand, string $buildCommand, string $outputDirectory, string $fallbackRedirect, array $scopes, string $installationId, ?string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $specification, Request $request, Response $response, Database $dbForProject, Document $project, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github)
public function action(string $siteId, string $name, string $framework, bool $enabled, string $installCommand, string $buildCommand, string $outputDirectory, array $scopes, string $installationId, ?string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $specification, Request $request, Response $response, Database $dbForProject, Document $project, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github)
{
// TODO: If only branch changes, re-deploy
$site = $dbForProject->getDocument('sites', $siteId);
@@ -175,7 +174,6 @@ class UpdateSite extends Base
$site->getAttribute('buildCommand') !== $buildCommand ||
$site->getAttribute('installCommand') !== $installCommand ||
$site->getAttribute('outputDirectory') !== $outputDirectory ||
$site->getAttribute('fallbackRedirect') !== $fallbackRedirect ||
$site->getAttribute('providerRootDirectory') !== $providerRootDirectory ||
$site->getAttribute('framework') !== $framework
) {
@@ -205,7 +203,6 @@ class UpdateSite extends Base
'buildCommand' => $buildCommand,
'installCommand' => $installCommand,
'outputDirectory' => $outputDirectory,
'fallbackRedirect' => $fallbackRedirect,
'scopes' => $scopes,
'installationId' => $installation->getId(),
'installationInternalId' => $installation->getInternalId(),
@@ -83,12 +83,6 @@ class Site extends Model
'default' => '',
'example' => 'build',
])
->addRule('fallbackRedirect', [
'type' => self::TYPE_STRING,
'description' => 'The URL to redirect to if the route is not found.', //TODO: Update the description
'default' => '',
'example' => 'https://appwrite.io',
])
->addRule('installationId', [
'type' => self::TYPE_STRING,
'description' => 'Site VCS (Version Control System) installation id.',
@@ -34,12 +34,6 @@ class TemplateFramework extends Model
'default' => '',
'example' => 'build',
])
->addRule('fallbackRedirect', [
'type' => self::TYPE_STRING,
'description' => 'The fallback redirect for the site when a route is not found.',
'default' => '',
'example' => 'index.html',
])
->addRule('providerRootDirectory', [
'type' => self::TYPE_STRING,
'description' => 'Path to site in VCS (Version Control System) repository',
@@ -10,12 +10,6 @@ class TemplateSite extends Model
public function __construct()
{
$this
->addRule('icon', [
'type' => self::TYPE_STRING,
'description' => 'Site Template Icon.',
'default' => '',
'example' => 'icon-lightning-bolt',
])
->addRule('id', [
'type' => self::TYPE_STRING,
'description' => 'Site Template ID.',
@@ -28,12 +22,6 @@ class TemplateSite extends Model
'default' => '',
'example' => 'Starter site',
])
->addRule('tagline', [
'type' => self::TYPE_STRING,
'description' => 'Site Template Tagline.',
'default' => '',
'example' => 'A simple site to get started.',
])
->addRule('useCases', [
'type' => self::TYPE_STRING,
'description' => 'Site use cases.',
@@ -48,12 +36,6 @@ class TemplateSite extends Model
'example' => [],
'array' => true
])
->addRule('instructions', [
'type' => self::TYPE_STRING,
'description' => 'Site Template Instructions.',
'default' => '',
'example' => 'For documentation and instructions check out <link>.',
])
->addRule('vcsProvider', [
'type' => self::TYPE_STRING,
'description' => 'VCS (Version Control System) Provider.',
@@ -84,13 +66,6 @@ class TemplateSite extends Model
'default' => [],
'example' => [],
'array' => true
])
->addRule('scopes', [
'type' => self::TYPE_STRING,
'description' => 'Site scopes.',
'default' => [],
'example' => 'users.read',
'array' => true,
]);
}