-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
7,963 additions
and
34 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/dispatch/database/revisions/tenant/versions/2023-12-18_6c1a250b1e4b.py
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,39 @@ | ||
"""Adds new columns to the tag_type table to support new UI | ||
Revision ID: 6c1a250b1e4b | ||
Revises: 99d317cbc848 | ||
Create Date: 2023-12-18 10:22:13.668372 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "6c1a250b1e4b" | ||
down_revision = "99d317cbc848" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column("tag_type", sa.Column("discoverable_case", sa.Boolean(), nullable=True, server_default="t", default=True)) | ||
op.add_column("tag_type", sa.Column("discoverable_incident", sa.Boolean(), nullable=True, server_default="t", default=True)) | ||
op.add_column("tag_type", sa.Column("discoverable_query", sa.Boolean(), nullable=True, server_default="t", default=True)) | ||
op.add_column("tag_type", sa.Column("discoverable_signal", sa.Boolean(), nullable=True, server_default="t", default=True)) | ||
op.add_column("tag_type", sa.Column("discoverable_source", sa.Boolean(), nullable=True, server_default="t", default=True)) | ||
op.add_column("tag_type", sa.Column("color", sa.String(), nullable=True)) | ||
op.add_column("tag_type", sa.Column("icon", sa.String(), nullable=True)) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column("tag_type", "icon") | ||
op.drop_column("tag_type", "color") | ||
op.drop_column("tag_type", "discoverable_case") | ||
op.drop_column("tag_type", "discoverable_incident") | ||
op.drop_column("tag_type", "discoverable_query") | ||
op.drop_column("tag_type", "discoverable_signal") | ||
op.drop_column("tag_type", "discoverable_source") | ||
# ### end Alembic commands ### |
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
7,148 changes: 7,148 additions & 0 deletions
7,148
src/dispatch/static/dispatch/src/assets/icons/index.js
Large diffs are not rendered by default.
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 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
145 changes: 145 additions & 0 deletions
145
src/dispatch/static/dispatch/src/components/IconPickerInput.vue
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,145 @@ | ||
<template> | ||
<v-text-field :label="label" v-model="icon"> | ||
<template #append> | ||
<v-menu v-model="menu" location="top" :close-on-content-click="false"> | ||
<template #activator="{ props }"> | ||
<div :style="swatchStyle" v-bind="props"> | ||
<v-icon | ||
:icon="prepended(icon)" | ||
style="margin-top: 3px; margin-left: 3px" | ||
color="white" | ||
/> | ||
</div> | ||
</template> | ||
<v-card> | ||
<v-card-text class="pa-0"> | ||
<div> | ||
<div> | ||
<div> | ||
<label for="iconSearch" style="display: none">Search for Icon</label> | ||
<input | ||
id="iconSearch" | ||
placeholder="Search for Icon" | ||
v-model="searchText" | ||
@input="searchTextChanged" | ||
/> | ||
</div> | ||
</div> | ||
<div> | ||
<h4 class="icon-title">Regular Icons</h4> | ||
|
||
<ul v-if="allIcons.length > 0"> | ||
<li v-for="iconName in allIcons" :key="iconName"> | ||
<v-btn @click="selectIcon(iconName)"> | ||
<div class="text-center"> | ||
<v-icon :icon="prepended(iconName)" /> | ||
{{ iconName }} | ||
</div> | ||
</v-btn> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</v-card-text> | ||
</v-card> | ||
</v-menu> | ||
</template> | ||
</v-text-field> | ||
</template> | ||
|
||
<script> | ||
import materialIcons from "../assets/icons" | ||
export default { | ||
name: "IconPickerInput", | ||
props: { | ||
modelValue: { | ||
type: String, | ||
default: null, | ||
}, | ||
label: { | ||
type: String, | ||
default: function () { | ||
return "Icon" | ||
}, | ||
}, | ||
color: { | ||
type: String, | ||
default: function () { | ||
return "#1976D2FF" | ||
}, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
menu: false, | ||
allIcons: [], | ||
searchText: "", | ||
loading: true, | ||
searchIconNotFound: false, | ||
} | ||
}, | ||
methods: { | ||
selectIcon(icon) { | ||
this.menu = false | ||
this.$emit("update:modelValue", icon) | ||
}, | ||
searchTextChanged() { | ||
this.searchIcon(this.searchText) | ||
}, | ||
setDefaultIcons() { | ||
// get the names attribute from the list of allIcons | ||
this.allIcons = materialIcons.map((icon) => icon.name).slice(0, 10) | ||
}, | ||
searchIcon(txt) { | ||
this.loading = true | ||
if (txt && txt.length > 0) { | ||
setTimeout(() => { | ||
this.loading = false | ||
}, 950) | ||
txt = txt.toLowerCase() | ||
this.allIcons = materialIcons | ||
.map((icon) => icon.name) | ||
.filter((icon) => icon.toLowerCase().includes(txt)) | ||
} else { | ||
setTimeout(() => { | ||
this.setDefaultIcons() | ||
this.loading = false | ||
}, 950) | ||
} | ||
}, | ||
prepended(icon) { | ||
return icon ? `mdi-${icon}` : "" | ||
}, | ||
}, | ||
created() { | ||
this.setDefaultIcons() | ||
}, | ||
computed: { | ||
icon: { | ||
get() { | ||
return this.modelValue || null | ||
}, | ||
set(value) { | ||
this.$emit("update:modelValue", value) | ||
}, | ||
}, | ||
swatchStyle() { | ||
return { | ||
// set the color to the color prop | ||
backgroundColor: this.color || "#000000", | ||
cursor: "pointer", | ||
height: "30px", | ||
width: "30px", | ||
borderRadius: "4px", | ||
transition: "border-radius 200ms ease-in-out", | ||
} | ||
}, | ||
}, | ||
} | ||
</script> |
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
Oops, something went wrong.