Skip to content

FOUR-14053 All Templates section (UI change) #6920

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

Merged
merged 8 commits into from
Jun 10, 2024
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
10 changes: 9 additions & 1 deletion resources/js/components/templates/SelectTemplateModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
@ok.prevent="onSubmit"
@close="close"
>
<template-search :type="type" :component="currentComponent" @show-details="updateModal($event)"
<template-search ref="template-search"
:type="type"
:component="currentComponent"
@show-details="updateModal($event)"
@blank-process-button-clicked="createBlankProcess()"
@ai-process-button-clicked="createAiProcess()"
:showTemplateOptionsActionBar="true"
Expand Down Expand Up @@ -121,6 +124,11 @@
},
show() {
this.$bvModal.show('selectTemplate');
},
hideBackButton() {
this.headerButtons[0].hidden = false;
this.titleButtons[0].hidden = false;
this.hasHeaderButtons = false;
}
},
mounted() {
Expand Down
19 changes: 18 additions & 1 deletion resources/js/processes-catalogue/components/CardProcess.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
:key="index"
:process="process"
@openProcessInfo="openProcessInfo"
:hideBookmark="categoryId === 'all_templates'"
/>
<pagination
:total-row="totalRow"
Expand Down Expand Up @@ -43,6 +44,7 @@ import pagination from "./utils/pagination.vue";
import SearchCards from "./utils/SearchCards.vue";
import dataLoadingMixin from "../../components/common/mixins/apiDataLoading";
import Card from "./utils/Card.vue";
import { EventBus } from '../index.js';

export default {
components: {
Expand All @@ -63,6 +65,7 @@ export default {
data: null,
totalPages: 1,
pmql: "",
filter: "",
bookmarkIcon: "far fa-bookmark",
showEmpty: false,
loading: false,
Expand All @@ -71,6 +74,7 @@ export default {
watch: {
categoryId() {
this.pmql = "";
this.filter = "";
this.loadCard();
},
},
Expand Down Expand Up @@ -100,7 +104,7 @@ export default {
* Build URL for Process Cards
*/
buildURL() {
if (!this.categoryId || this.categoryId === 'all_processes') {
if (this.categoryId === 'all_processes') {
return "process_bookmarks/processes?"
+ `&page=${this.currentPage}`
+ `&per_page=${this.perPage}`
Expand All @@ -118,6 +122,14 @@ export default {
+ "&launchpad=true"
+ "&order_by=name&order_direction=asc";
}
if (this.categoryId === 'all_templates') {
return `templates/process?page=${this.currentPage}`
+ `&per_page=${this.perPage}`
+ `&filter=${encodeURIComponent(this.filter)}`
+ `&order_by=name`
+ `&order_direction=asc`
+ `&include=user,categories,category`;
}
return `process_bookmarks/processes?page=${this.currentPage}`
+ `&per_page=${this.perPage}`
+ `&category=${this.categoryId}`
Expand All @@ -130,6 +142,10 @@ export default {
* Go to process info
*/
openProcessInfo(process) {
if (this.categoryId === 'all_templates') {
EventBus.$emit('templates-selected', { template: process, type: "Process" });
return;
}
this.$router.push({ name: "show", params: { process: process, processId: process.id } });
this.$emit("openProcess", process);
},
Expand All @@ -146,6 +162,7 @@ export default {
onFilter(value, showEmpty = false) {
this.currentPage = 1;
this.pmql = `(fulltext LIKE "%${value}%")`;
this.filter = value;
this.showEmpty = showEmpty;
this.loadCard();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
},
computed: {
isTemplateCategory() {
return ['all_templates', 'guided_templates'].includes(this.categoryId)
return ['guided_templates'].includes(this.categoryId)
},
}
};
Expand Down
35 changes: 22 additions & 13 deletions resources/js/processes-catalogue/components/menuCatologue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
<script>
import SearchCategories from "./utils/SearchCategories.vue";
import SelectTemplateModal from "../../components/templates/SelectTemplateModal.vue";
import { EventBus } from '../index.js';

export default {
components: {
Expand Down Expand Up @@ -148,6 +149,11 @@ export default {
comeFromProcess: false,
};
},
created() {
EventBus.$on('templates-selected', (obj) => {
this.openTemplate(obj);
});
},
computed: {
/**
* Filters options regarding user permissions
Expand All @@ -172,12 +178,6 @@ export default {
}
},
watch: {
selectedProcessItem: {
deep: true,
handler: function () {
this.$emit('categorySelected', this.selectedProcessItem);
},
},
$route(r) {
this.handleRouteQuery();
},
Expand All @@ -204,6 +204,9 @@ export default {
this.selectedProcessItem = this.data.find((category) => {
return String(category.id) === String(query.categoryId);
});
this.selectedTemplateItem = this.filteredTemplateOptions.find((category) => {
return String(category.id) === String(query.categoryId);
});
}
},
/**
Expand All @@ -216,6 +219,7 @@ export default {
this.comeFromProcess = false;
this.selectedProcessItem = item;
this.selectedTemplateItem = null;
this.$emit('categorySelected', item);
},
/**
* Enables All Templates option only if user has create-processes permission
Expand All @@ -229,13 +233,9 @@ export default {
return obj.id === "guided_templates";
});
}
if (item.id === "all_templates") {
this.addNewProcess();
return;
}
this.selectedTemplateItem = item;
this.selectedProcessItem = null;
this.$emit('categorySelected', this.selectedTemplateItem);
this.$emit('categorySelected', item);
},
/**
* This method opens New Process modal window
Expand All @@ -245,11 +245,20 @@ export default {
this.$refs.addProcessModal.show();
});
},
openTemplate(obj) {
this.$nextTick(() => {
this.$refs.addProcessModal.show();
this.$refs.addProcessModal.$nextTick(() => {
this.$refs.addProcessModal.$refs["template-search"].showDetails(obj);
this.$refs.addProcessModal.hideBackButton();
});
});
},
isSelectedProcess(item) {
return this.selectedProcessItem === item;
},
isSelectedTemplate(index) {
return this.selectedTemplateItem === index;
isSelectedTemplate(item) {
return this.selectedTemplateItem === item;
},
onToggleCatalogue() {
this.showCatalogue = !this.showCatalogue;
Expand Down
9 changes: 8 additions & 1 deletion resources/js/processes-catalogue/components/utils/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
</div>
<div class="card-bookmark">
<i
v-if="!hideBookmark"
:ref="`bookmark-${process.id}`"
v-b-tooltip.hover.bottom
:title="$t(labelTooltip)"
Expand All @@ -46,7 +47,13 @@

<script>
export default {
props: ["process"],
props: {
process: null,
hideBookmark: {
type: Boolean,
default: false
}
},
data() {
return {
labelIcon: "Default Icon",
Expand Down
1 change: 1 addition & 0 deletions resources/js/processes-catalogue/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Process from "./components/Process";
import ProcessesCatalogue from "./components/ProcessesCatalogue";
import ProcessListing from "./components/ProcessListing";

export const EventBus = new Vue();
Vue.use(VueRouter);
const router = new VueRouter({
mode: "history",
Expand Down
Loading