2222
2323 <div class =" divider-custom" ></div >
2424
25- <div class =" dashboard-section" >
26- <div class =" buttons-list-dashboard" >
27- <button
28- v-for =" dashboard in dashboards"
29- :key =" dashboard.id"
30- class =" menu-btn"
31- @click =" openProcessDashboard(dashboard.id, 'dashboard')"
32- >
33- <i class =" fp-tachometer-alt-average" ></i >
34- <span :id =" `dashboard-${dashboard.id}`" class =" title-dashboard" >
35- {{ dashboard.name }}
36- </span >
37- </button >
38- </div >
25+ <div class =" buttons-list-dashboard" >
26+ <button
27+ v-for =" dashboard in dashboards"
28+ :key =" dashboard.id"
29+ class =" menu-btn"
30+ @click =" openProcessDashboard(dashboard.id, 'dashboard')"
31+ >
32+ <i class =" fp-tachometer-alt-average" ></i >
33+ <span :id =" `dashboard-${dashboard.id}`" class =" title-dashboard" >
34+ {{ dashboard.title }}
35+ </span >
36+ </button >
3937 </div >
4038 </div >
4139 </div >
@@ -50,15 +48,14 @@ export default {
5048 pmql: ` user_id=${ window .ProcessMaker .user .id } ` ,
5149 processesList: [],
5250 labelIcon: " Default Icon" ,
53- dashboards: [
54- { id: 1 , name: " Dashboard 1" },
55- { id: 2 , name: " Dashboard 2" },
56- { id: 3 , name: " Dashboard 3" },
57- ],
51+ dashboards: [],
52+ screen : null ,
53+ formData: null ,
5854 };
5955 },
6056 mounted () {
6157 this .loadProcesses ();
58+ this .loadDashboards ();
6259 },
6360 methods: {
6461 openProcessDashboard (id , type ) {
@@ -76,28 +73,43 @@ export default {
7673 }
7774 });
7875 } else {
79- router
80- .push ({
81- name: " dashboard" ,
82- params: { dashboardId: id .toString () },
83- })
84- .catch ((err ) => {
85- if (err .name !== " NavigationDuplicated" ) {
86- throw err;
87- }
88- });
76+ this .getDashboardViewScreen (id .toString ());
8977 }
9078
9179 this .$emit (" processDashboardSelected" , { id, type });
9280 this .$emit (" menuItemSelected" );
9381 },
82+ callDashboardViewScreen (id , screen , formData ) {
83+ const router = this .$router || this .$root .$router ;
84+ router
85+ .push ({
86+ name: " dashboard" ,
87+ params: {
88+ dashboardId: id .toString (),
89+ screen : screen ,
90+ formData: formData,
91+ },
92+ })
93+ .catch ((err ) => {
94+ if (err .name !== " NavigationDuplicated" ) {
95+ throw err;
96+ }
97+ });
98+ },
9499 loadProcesses () {
95100 const url = this .buildURL ();
96101
97102 ProcessMaker .apiClient .get (url).then ((response ) => {
98103 this .processesList = this .processesList .concat (response .data .data );
99104 });
100105 },
106+ loadDashboards () {
107+ const url = this .buildURLDashboards ();
108+
109+ ProcessMaker .apiClient .get (url).then ((response ) => {
110+ this .dashboards = this .dashboards .concat (response .data );
111+ });
112+ },
101113 /**
102114 * Build URL for Process Cards
103115 */
@@ -109,6 +121,13 @@ export default {
109121 &order_by=name&order_direction=asc
110122 &include=user,categories,category` ;
111123 },
124+ buildURLDashboards () {
125+ return ` /dynamic-ui/custom-dashboards` ;
126+ },
127+ buildURLDashboardsScreen (id ) {
128+ // return `/dynamic-ui/custom-dashboards/${token}`;
129+ return ` /dynamic-ui/custom-dashboards/screen/${ id} ` ;
130+ },
112131 getIconProcess (process ) {
113132 let icon = " Default Icon" ;
114133 const unparseProperties = process ? .launchpad ? .properties || null ;
@@ -118,6 +137,15 @@ export default {
118137
119138 return ` /img/launchpad-images/icons/${ icon} .svg` ;
120139 },
140+ getDashboardViewScreen (id ) {
141+ const url = this .buildURLDashboardsScreen (id);
142+
143+ ProcessMaker .apiClient .get (url).then ((response ) => {
144+ this .screen = response .data .screen ;
145+ this .formData = response .data .formData ;
146+ this .callDashboardViewScreen (id, this .screen , this .formData );
147+ });
148+ },
121149 },
122150};
123151< / script>
0 commit comments