Merge pull request #2792 from appwrite/feat-rename-autodeploy
Renamed 'deploy' to 'activate'
This commit is contained in:
commit
e40821393c
5 changed files with 11 additions and 11 deletions
|
@ -1993,7 +1993,7 @@ $collections = [
|
|||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'$id' => 'deploy',
|
||||
'$id' => 'activate',
|
||||
'type' => Database::VAR_BOOLEAN,
|
||||
'format' => '',
|
||||
'size' => 0,
|
||||
|
|
|
@ -464,14 +464,14 @@ App::post('/v1/functions/:functionId/deployments')
|
|||
->param('functionId', '', new UID(), 'Function ID.')
|
||||
->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('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('response')
|
||||
->inject('dbForProject')
|
||||
->inject('usage')
|
||||
->inject('user')
|
||||
->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 Appwrite\Utopia\Response $response */
|
||||
/** @var Utopia\Database\Database $dbForProject */
|
||||
|
@ -520,16 +520,16 @@ App::post('/v1/functions/:functionId/deployments')
|
|||
throw new Exception('Failed moving file', 500);
|
||||
}
|
||||
|
||||
if ((bool) $deploy) {
|
||||
if ((bool) $activate) {
|
||||
// Remove deploy for all other 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('resourceType', Query::TYPE_EQUAL, ['functions'])
|
||||
]);
|
||||
|
||||
foreach ($deployments as $deployment) {
|
||||
$deployment->setAttribute('deploy', false);
|
||||
$deployment->setAttribute('activate', false);
|
||||
$dbForProject->updateDocument('deployments', $deployment->getId(), $deployment);
|
||||
}
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ App::post('/v1/functions/:functionId/deployments')
|
|||
'path' => $path,
|
||||
'size' => $size,
|
||||
'search' => implode(' ', [$deploymentId, $entrypoint]),
|
||||
'deploy' => ($deploy === 'true'),
|
||||
'activate' => ((bool) $activate === true),
|
||||
]));
|
||||
|
||||
// Enqueue a message to start the build
|
||||
|
|
|
@ -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">
|
||||
<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>
|
||||
<button type="submit">Create</button> <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
|
||||
|
|
|
@ -148,7 +148,7 @@ class BuildsV1 extends Worker
|
|||
$build = $dbForProject->updateDocument('builds', $buildId, $build);
|
||||
|
||||
/** Set auto deploy */
|
||||
if ($deployment->getAttribute('deploy') === true) {
|
||||
if ($deployment->getAttribute('activate') === true) {
|
||||
$function->setAttribute('deployment', $deployment->getId());
|
||||
$function = $dbForProject->updateDocument('functions', $functionId, $function);
|
||||
}
|
||||
|
|
|
@ -52,9 +52,9 @@ class Deployment extends Model
|
|||
'default' => '',
|
||||
'example' => '5e5ea5c16897e',
|
||||
])
|
||||
->addRule('deploy', [
|
||||
->addRule('activate', [
|
||||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Whether the deployment should be automatically deployed.',
|
||||
'description' => 'Whether the deployment should be automatically activated.',
|
||||
'default' => false,
|
||||
'example' => true,
|
||||
])
|
||||
|
|
Loading…
Reference in a new issue