Skip to content

Commit

Permalink
Allows tags to have external IDs (Netflix#3028) (#13)
Browse files Browse the repository at this point in the history
* Allows tags to have external IDs

* Adds external id UI

Co-authored-by: kevgliss <[email protected]>
  • Loading branch information
rutvijmehta-harness and kevgliss authored Mar 17, 2023
1 parent 2b8affc commit 074f404
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Adds external id for tags
Revision ID: 20d3801ad5b7
Revises: 93b517de08e2
Create Date: 2023-02-27 15:38:07.029395
"""
from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = "20d3801ad5b7"
down_revision = "93b517de08e2"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("tag", sa.Column("external_id", sa.String(), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("tag", "external_id")
14 changes: 14 additions & 0 deletions src/dispatch/static/dispatch/src/tag/NewEditSheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@
/>
</ValidationProvider>
</v-flex>
<v-flex xs12>
<ValidationProvider name="external_id" immediate>
<v-text-field
v-model="external_id"
slot-scope="{ errors, valid }"
:error-messages="errors"
:success="valid"
label="External ID"
hint="A tags external id."
clearable
/>
</ValidationProvider>
</v-flex>
<v-flex>
<v-checkbox
v-model="discoverable"
Expand Down Expand Up @@ -134,6 +147,7 @@ export default {
"selected.source",
"selected.project",
"selected.discoverable",
"selected.external_id",
"selected.loading",
"dialogs.showCreateEdit",
]),
Expand Down
1 change: 1 addition & 0 deletions src/dispatch/static/dispatch/src/tag/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export default {
{ text: "Type", value: "tag_type.name", sortable: true },
{ text: "Source", value: "source", sortable: true },
{ text: "URI", value: "uri", sortable: false },
{ text: "External ID", value: "external_id", sortable: false },
{ text: "Discoverable", value: "discoverable", sortable: true },
{ text: "", value: "data-table-actions", sortable: false, align: "end" },
],
Expand Down
1 change: 1 addition & 0 deletions src/dispatch/static/dispatch/src/tag/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const getDefaultSelectedState = () => {
uri: null,
id: null,
description: "Generic tag",
external_id: null,
project: null,
created_at: null,
discoverable: null,
Expand Down
2 changes: 2 additions & 0 deletions src/dispatch/tag/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Tag(Base, TimeStampMixin, ProjectMixin):
description = Column(String)
uri = Column(String)
source = Column(String)
external_id = Column(String)
discoverable = Column(Boolean, default=True)

# Relationships
Expand All @@ -37,6 +38,7 @@ class TagBase(DispatchBase):
source: Optional[str] = Field(None, nullable=True)
uri: Optional[str] = Field(None, nullable=True)
discoverable: Optional[bool] = True
external_id: Optional[str] = Field(None, nullable=True)
description: Optional[str] = Field(None, nullable=True)


Expand Down

0 comments on commit 074f404

Please sign in to comment.