Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows tags to have external IDs #3028

Merged
merged 3 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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