-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: #200 reset deployments quota each day
- Loading branch information
1 parent
9e815d7
commit a6490df
Showing
9 changed files
with
86 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
database/migrations/2024_09_23_190601_alter_teams_change_quotas_override_to_jsonb.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
public function up(): void | ||
{ | ||
Schema::table('teams', function (Blueprint $table) { | ||
// Change the column type to jsonb | ||
$table->jsonb('quotas_override')->default(json_encode([ | ||
'nodes' => 0, | ||
'swarms' => 0, | ||
'services' => 0, | ||
'deployments' => 0, | ||
]))->change(); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::table('teams', function (Blueprint $table) { | ||
// Revert the column type back to json | ||
$table->json('quotas_override')->default(json_encode([ | ||
'nodes' => 0, | ||
'swarms' => 0, | ||
'services' => 0, | ||
'deployments' => 0, | ||
]))->change(); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,8 +46,12 @@ const quotaDescriptions = { | |
swarms: "The maximum number of swarms you can create for your team.", | ||
services: | ||
"The maximum number of services you can deploy across all swarms.", | ||
deployments: "The maximum number of deployments you can perform.", | ||
deployments: "The maximum number of deployments you can perform per day.", | ||
}; | ||
function getResetPeriodText(quota: ItemQuota): string | null { | ||
return quota.resetPeriod === "daily" ? "Resets daily" : null; | ||
} | ||
</script> | ||
|
||
<template> | ||
|
@@ -116,7 +120,7 @@ const quotaDescriptions = { | |
</span> | ||
</div> | ||
<div | ||
class="mt-1 text-xs text-gray-500 dark:text-gray-400" | ||
class="mt-1 text-xs text-gray-500 dark:text-gray-400 flex items-center" | ||
> | ||
{{ | ||
quotaDescriptions[ | ||
|
@@ -130,14 +134,20 @@ const quotaDescriptions = { | |
contact | ||
<a | ||
href="mailto:[email protected]" | ||
class="text-blue-600 hover:text-blue-800" | ||
class="text-blue-600 hover:text-blue-800 ml-1" | ||
>[email protected]</a | ||
>. | ||
</span> | ||
<span v-if="quota.isIntrinsic"> | ||
This limit is set by the system architecture and | ||
cannot be increased. | ||
</span> | ||
<span | ||
v-if="getResetPeriodText(quota)" | ||
class="ml-2 px-2 py-0.5 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full font-medium" | ||
> | ||
{{ getResetPeriodText(quota) }} | ||
</span> | ||
</div> | ||
<div class="mt-2"> | ||
<div | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters