-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] Improved ordering process of applications
[REF] Support multiple applications in one subscription [REM] Remove trial period [REF] Refactor custom domains and creating a domain for an application
- Loading branch information
Showing
61 changed files
with
1,481 additions
and
1,302 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class ApplicationDomain(models.Model): | ||
_name = "argocd.application.domain" | ||
_description = "ArgoCD Application Domain" | ||
_order = "sequence" | ||
|
||
application_id = fields.Many2one(comodel_name="argocd.application", required=True) | ||
scope = fields.Char(default="Application") | ||
sequence = fields.Integer(default=10) | ||
name = fields.Char(required=True) | ||
|
||
_sql_constraints = [ | ||
( | ||
"application_domain_name_unique", | ||
"unique(name)", | ||
"Domain is already in use", | ||
) | ||
] | ||
|
||
@api.model | ||
def create_domain(self, application, preferred, *alternatives, scope="Application"): | ||
existing = application.domain_ids.filtered(lambda d: d.scope == scope).sorted( | ||
"sequence" | ||
) | ||
if existing: | ||
return existing.name | ||
domains = (preferred,) + alternatives | ||
i = 0 | ||
best_available = False | ||
while not best_available: | ||
i_as_str = str(i) | ||
for domain in domains: | ||
domain_name = domain | ||
if i: | ||
domain_name += i_as_str | ||
already_exists = self.search([("name", "=", domain_name)], count=True) | ||
if not already_exists: | ||
best_available = domain_name | ||
break | ||
i += 1 | ||
self.create( | ||
{"application_id": application.id, "name": best_available, "scope": scope} | ||
) | ||
return best_available |
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,13 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
<record id="application_domain_tree" model="ir.ui.view"> | ||
<field name="model">argocd.application.domain</field> | ||
<field name="arch" type="xml"> | ||
<tree editable="bottom"> | ||
<field name="sequence" widget="handle" /> | ||
<field name="scope" /> | ||
<field name="name" /> | ||
</tree> | ||
</field> | ||
</record> | ||
</odoo> |
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
Oops, something went wrong.