1
0
Fork 0
mirror of synced 2024-06-29 19:50:26 +12:00

Merge pull request #2792 from appwrite/feat-rename-autodeploy

Renamed 'deploy' to 'activate'
This commit is contained in:
Christy Jacob 2022-02-16 13:33:54 +04:00 committed by GitHub
commit e40821393c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 11 deletions

View file

@ -1993,7 +1993,7 @@ $collections = [
'filters' => [], 'filters' => [],
], ],
[ [
'$id' => 'deploy', '$id' => 'activate',
'type' => Database::VAR_BOOLEAN, 'type' => Database::VAR_BOOLEAN,
'format' => '', 'format' => '',
'size' => 0, 'size' => 0,

View file

@ -464,14 +464,14 @@ App::post('/v1/functions/:functionId/deployments')
->param('functionId', '', new UID(), 'Function ID.') ->param('functionId', '', new UID(), 'Function ID.')
->param('entrypoint', '', new Text('1028'), 'Entrypoint File.') ->param('entrypoint', '', new Text('1028'), 'Entrypoint File.')
->param('code', [], new File(), 'Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.', false) ->param('code', [], new File(), 'Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.', false)
->param('deploy', false, new Boolean(true), 'Automatically deploy the function when it is finished building.', false) ->param('activate', false, new Boolean(true), 'Automatically activate the deployment when it is finished building.', false)
->inject('request') ->inject('request')
->inject('response') ->inject('response')
->inject('dbForProject') ->inject('dbForProject')
->inject('usage') ->inject('usage')
->inject('user') ->inject('user')
->inject('project') ->inject('project')
->action(function ($functionId, $entrypoint, $file, $deploy, $request, $response, $dbForProject, $usage, $user, $project) { ->action(function ($functionId, $entrypoint, $file, $activate, $request, $response, $dbForProject, $usage, $user, $project) {
/** @var Utopia\Swoole\Request $request */ /** @var Utopia\Swoole\Request $request */
/** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Database $dbForProject */ /** @var Utopia\Database\Database $dbForProject */
@ -520,16 +520,16 @@ App::post('/v1/functions/:functionId/deployments')
throw new Exception('Failed moving file', 500); throw new Exception('Failed moving file', 500);
} }
if ((bool) $deploy) { if ((bool) $activate) {
// Remove deploy for all other deployments. // Remove deploy for all other deployments.
$deployments = $dbForProject->find('deployments', [ $deployments = $dbForProject->find('deployments', [
new Query('deploy', Query::TYPE_EQUAL, [true]), new Query('activate', Query::TYPE_EQUAL, [true]),
new Query('resourceId', Query::TYPE_EQUAL, [$functionId]), new Query('resourceId', Query::TYPE_EQUAL, [$functionId]),
new Query('resourceType', Query::TYPE_EQUAL, ['functions']) new Query('resourceType', Query::TYPE_EQUAL, ['functions'])
]); ]);
foreach ($deployments as $deployment) { foreach ($deployments as $deployment) {
$deployment->setAttribute('deploy', false); $deployment->setAttribute('activate', false);
$dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment);
} }
} }
@ -546,7 +546,7 @@ App::post('/v1/functions/:functionId/deployments')
'path' => $path, 'path' => $path,
'size' => $size, 'size' => $size,
'search' => implode(' ', [$deploymentId, $entrypoint]), 'search' => implode(' ', [$deploymentId, $entrypoint]),
'deploy' => ($deploy === 'true'), 'activate' => ((bool) $activate === true),
])); ]));
// Enqueue a message to start the build // Enqueue a message to start the build

View file

@ -685,7 +685,7 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled', true);
<input type="file" name="code" id="deployment-code" size="1" required accept="application/x-gzip,.gz"> <input type="file" name="code" id="deployment-code" size="1" required accept="application/x-gzip,.gz">
<div class="text-fade text-size-xs margin-top-negative-small margin-bottom">(Max file size allowed: <?php echo $fileLimitHuman; ?>)</div> <div class="text-fade text-size-xs margin-top-negative-small margin-bottom">(Max file size allowed: <?php echo $fileLimitHuman; ?>)</div>
<label for="deployment-deploy" class="margin-bottom-large">Auto Deploy Deployment after build <input type="checkbox" class="margin-start-small" id="deployment-deploy" name="deploy" /></label> <label for="deployment-activate" class="margin-bottom-large">Auto Activate Deployment after build <input type="checkbox" class="margin-start-small" id="deployment-activate" name="activate" /></label>
<footer> <footer>
<button type="submit">Create</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button> <button type="submit">Create</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>

View file

@ -148,7 +148,7 @@ class BuildsV1 extends Worker
$build = $dbForProject->updateDocument('builds', $buildId, $build); $build = $dbForProject->updateDocument('builds', $buildId, $build);
/** Set auto deploy */ /** Set auto deploy */
if ($deployment->getAttribute('deploy') === true) { if ($deployment->getAttribute('activate') === true) {
$function->setAttribute('deployment', $deployment->getId()); $function->setAttribute('deployment', $deployment->getId());
$function = $dbForProject->updateDocument('functions', $functionId, $function); $function = $dbForProject->updateDocument('functions', $functionId, $function);
} }

View file

@ -52,9 +52,9 @@ class Deployment extends Model
'default' => '', 'default' => '',
'example' => '5e5ea5c16897e', 'example' => '5e5ea5c16897e',
]) ])
->addRule('deploy', [ ->addRule('activate', [
'type' => self::TYPE_BOOLEAN, 'type' => self::TYPE_BOOLEAN,
'description' => 'Whether the deployment should be automatically deployed.', 'description' => 'Whether the deployment should be automatically activated.',
'default' => false, 'default' => false,
'example' => true, 'example' => true,
]) ])