This repository was archived by the owner on Sep 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 641
Adds a new project settings section for managing search filters #3398
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ff5f1fa
Adds a new project section for managing search filters
mvilanova 525b92e
Adds column for notification in UI table
mvilanova 0d44e2f
Merge remote-tracking branch 'origin/master' into enhancement/search-…
mvilanova 03df222
Checks for SensitiveProjectActionPermission on filter delete
mvilanova f4e35bc
Adds TODO
mvilanova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/dispatch/database/revisions/tenant/versions/2023-05-17_9ad021045e45.py
This file contains hidden or 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,31 @@ | ||
| """Adds timestamps to the SearchFilter model | ||
|
|
||
| Revision ID: 9ad021045e45 | ||
| Revises: 930eb80028d2 | ||
| Create Date: 2023-05-17 11:30:33.542458 | ||
|
|
||
| """ | ||
| from alembic import op | ||
| import sqlalchemy as sa | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "9ad021045e45" | ||
| down_revision = "930eb80028d2" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade(): | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.add_column("search_filter", sa.Column("enabled", sa.Boolean(), nullable=True)) | ||
| op.add_column("search_filter", sa.Column("updated_at", sa.DateTime(), nullable=True)) | ||
| op.add_column("search_filter", sa.Column("created_at", sa.DateTime(), nullable=True)) | ||
| # ### end Alembic commands ### | ||
|
|
||
|
|
||
| def downgrade(): | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.drop_column("search_filter", "created_at") | ||
| op.drop_column("search_filter", "updated_at") | ||
| op.drop_column("search_filter", "enabled") | ||
| # ### end Alembic commands ### |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,40 @@ | ||
| <template> | ||
| <v-dialog v-model="showRemove" persistent max-width="800px"> | ||
| <v-card> | ||
| <v-card-title> | ||
| <span class="headline">Delete Search Filter?</span> | ||
| </v-card-title> | ||
| <v-card-text> | ||
| <v-container grid-list-md> | ||
| <v-layout wrap> Are you sure you would like to delete this search filter? </v-layout> | ||
| </v-container> | ||
| </v-card-text> | ||
| <v-card-actions> | ||
| <v-spacer /> | ||
| <v-btn color="blue en-1" text @click="closeRemove()"> Cancel </v-btn> | ||
| <v-btn color="red en-1" text @click="remove()"> Delete </v-btn> | ||
| </v-card-actions> | ||
| </v-card> | ||
| </v-dialog> | ||
| </template> | ||
|
|
||
| <script> | ||
| import { mapActions } from "vuex" | ||
| import { mapFields } from "vuex-map-fields" | ||
|
|
||
| export default { | ||
| name: "SearchFilterDeleteDialog", | ||
|
|
||
| data() { | ||
| return {} | ||
| }, | ||
|
|
||
| computed: { | ||
| ...mapFields("search", ["dialogs.showRemove"]), | ||
| }, | ||
|
|
||
| methods: { | ||
| ...mapActions("search", ["remove", "closeRemove"]), | ||
| }, | ||
| } | ||
| </script> |
This file contains hidden or 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,171 @@ | ||
| <template> | ||
| <v-container fluid> | ||
| <!-- <new-edit-dialog /> --> | ||
| <delete-dialog /> | ||
| <v-row no-gutters> | ||
| <v-col> | ||
| <v-alert dismissible icon="mdi-school" prominent text type="info"> | ||
| Search filters enable you to define under which conditions an individual, oncall service, | ||
| or team need to be engage in an incident. | ||
| </v-alert> | ||
| </v-col> | ||
| </v-row> | ||
| <v-row align="center" justify="space-between" no-gutters> | ||
| <v-col cols="8"> | ||
| <settings-breadcrumbs v-model="project" /> | ||
| </v-col> | ||
| <!-- <v-col class="text-right"> --> | ||
| <!-- <v-btn color="info" class="ml-2" @click="createEditShow()"> New </v-btn> --> | ||
| <!-- </v-col> --> | ||
| </v-row> | ||
| <v-row no-gutters> | ||
| <v-col> | ||
| <v-card elevation="0"> | ||
| <v-card-title> | ||
| <v-text-field | ||
| v-model="q" | ||
| append-icon="search" | ||
| label="Search" | ||
| single-line | ||
| hide-details | ||
| clearable | ||
| /> | ||
| </v-card-title> | ||
| <v-data-table | ||
| :headers="headers" | ||
| :items="items" | ||
| :server-items-length="total" | ||
| :page.sync="page" | ||
| :items-per-page.sync="itemsPerPage" | ||
| :sort-by.sync="sortBy" | ||
| :sort-desc.sync="descending" | ||
| :loading="loading" | ||
| loading-text="Loading... Please wait" | ||
| > | ||
| <!-- TODO(mvilanova): Allow to view the list of individuals, teams, services, and notifications upon clicking on the chip --> | ||
| <template #[`item.individuals`]="{ item }"> | ||
| <v-chip small color="info" text-color="white">{{ item.individuals.length }}</v-chip> | ||
| </template> | ||
| <template #[`item.teams`]="{ item }"> | ||
| <v-chip small color="info" text-color="white">{{ item.teams.length }}</v-chip> | ||
| </template> | ||
| <template #[`item.services`]="{ item }"> | ||
| <v-chip small color="info" text-color="white">{{ item.services.length }}</v-chip> | ||
| </template> | ||
| <template #[`item.notifications`]="{ item }"> | ||
| <v-chip small color="info" text-color="white">{{ item.notifications.length }}</v-chip> | ||
| </template> | ||
| <template #[`item.enabled`]="{ item }"> | ||
| <v-simple-checkbox v-model="item.enabled" disabled /> | ||
| </template> | ||
| <template #[`item.created_at`]="{ item }"> | ||
| <v-tooltip bottom> | ||
| <template #activator="{ on, attrs }"> | ||
| <span v-bind="attrs" v-on="on">{{ item.created_at | formatRelativeDate }}</span> | ||
| </template> | ||
| <span>{{ item.created_at | formatDate }}</span> | ||
| </v-tooltip> | ||
| </template> | ||
| <template #[`item.updated_at`]="{ item }"> | ||
| <v-tooltip bottom> | ||
| <template #activator="{ on, attrs }"> | ||
| <span v-bind="attrs" v-on="on">{{ item.updated_at | formatRelativeDate }}</span> | ||
| </template> | ||
| <span>{{ item.updated_at | formatDate }}</span> | ||
| </v-tooltip> | ||
| </template> | ||
| <template #[`item.data-table-actions`]="{ item }"> | ||
| <v-menu bottom left> | ||
| <template #activator="{ on }"> | ||
| <v-btn icon v-on="on"> | ||
| <v-icon>mdi-dots-vertical</v-icon> | ||
| </v-btn> | ||
| </template> | ||
| <v-list> | ||
| <!-- <v-list-item @click="createEditShow(item)"> --> | ||
| <!-- <v-list-item-title>View / Edit</v-list-item-title> --> | ||
| <!-- </v-list-item> --> | ||
| <v-list-item @click="removeShow(item)"> | ||
| <v-list-item-title>Delete</v-list-item-title> | ||
| </v-list-item> | ||
| </v-list> | ||
| </v-menu> | ||
| </template> | ||
| </v-data-table> | ||
| </v-card> | ||
| </v-col> | ||
| </v-row> | ||
| </v-container> | ||
| </template> | ||
|
|
||
| <script> | ||
| import { mapFields } from "vuex-map-fields" | ||
| import { mapActions } from "vuex" | ||
|
|
||
| import DeleteDialog from "@/search/DeleteDialog.vue" | ||
|
|
||
| export default { | ||
| name: "SearchFilterTable", | ||
|
|
||
| components: { DeleteDialog }, | ||
|
|
||
| data() { | ||
| return { | ||
| headers: [ | ||
| { text: "Name", value: "name", align: "left", width: "10%" }, | ||
| { text: "Description", value: "description", sortable: false }, | ||
| { text: "Individuals", value: "individuals" }, | ||
| { text: "Teams", value: "teams" }, | ||
| { text: "Services", value: "services" }, | ||
| { text: "Notifications", value: "notifications" }, | ||
| { text: "Creator", value: "creator.email" }, | ||
| { text: "Created At", value: "created_at" }, | ||
| { text: "Updated At", value: "updated_at" }, | ||
| { text: "Enabled", value: "enabled" }, | ||
| { text: "", value: "data-table-actions", sortable: false, align: "end" }, | ||
| ], | ||
| showEditSheet: false, | ||
| } | ||
| }, | ||
|
|
||
| computed: { | ||
| ...mapFields("search", [ | ||
| "table.loading", | ||
| "table.options.descending", | ||
| "table.options.filters.project", | ||
| "table.options.itemsPerPage", | ||
| "table.options.page", | ||
| "table.options.q", | ||
| "table.options.sortBy", | ||
| "table.rows.items", | ||
| "table.rows.total", | ||
| ]), | ||
| ...mapFields("route", ["query"]), | ||
| }, | ||
|
|
||
| methods: { | ||
| ...mapActions("search", ["getAll", "createEditShow", "removeShow"]), | ||
| }, | ||
|
|
||
| created() { | ||
| this.project = [{ name: this.query.project }] | ||
| this.getAll() | ||
|
|
||
| this.$watch( | ||
| (vm) => [vm.page], | ||
| () => { | ||
| this.getAll() | ||
| } | ||
| ) | ||
|
|
||
| this.$watch( | ||
| (vm) => [vm.q, vm.itemsPerPage, vm.sortBy, vm.descending, vm.project], | ||
| () => { | ||
| this.page = 1 | ||
| this.$router.push({ query: { project: this.project[0].name } }) | ||
| this.getAll() | ||
| } | ||
| ) | ||
| }, | ||
| } | ||
| </script> | ||
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.