From b54bbed12758a7ea923208a8170dc0e50792082b Mon Sep 17 00:00:00 2001 From: Glauber Costa Vila Verde Date: Thu, 15 Mar 2018 16:32:35 -0300 Subject: [PATCH] Closed #1095 - Add link to product log --- api/product/serializers.py | 14 +++++- frontend/build/production/Target/app.json | 2 +- frontend/build/production/Target/app.jsonp | 2 +- frontend/explorer/app/model/Product.js | 1 + frontend/explorer/app/view/system/Form.js | 52 +++++++++++++++++--- frontend/explorer/app/view/system/VacGrid.js | 10 ++++ 6 files changed, 72 insertions(+), 9 deletions(-) diff --git a/api/product/serializers.py b/api/product/serializers.py index 0a1c74256..d1bee179c 100644 --- a/api/product/serializers.py +++ b/api/product/serializers.py @@ -2,6 +2,7 @@ import logging import os import time +from urllib.parse import urljoin import humanize from django.contrib.auth.models import User @@ -42,6 +43,8 @@ class ProductSerializer(serializers.HyperlinkedModelSerializer): tablename = serializers.SerializerMethodField() + productlog = serializers.SerializerMethodField() + class Meta: model = Product @@ -63,7 +66,8 @@ class Meta: 'prl_related', 'prl_cross_identification', 'prl_cross_property', - 'tablename' + 'tablename', + 'productlog' ) def get_pcl_name(self, obj): @@ -126,6 +130,14 @@ def get_tablename(self, obj): except: return None + def get_productlog(self, obj): + try: + site = obj.prd_process_id.epr_site.sti_url + return urljoin(site, "VP/getViewProcessCon?process_id=%s" % obj.prd_process_id.epr_original_id) + + except: + return None + class FileSerializer(serializers.HyperlinkedModelSerializer): class Meta: diff --git a/frontend/build/production/Target/app.json b/frontend/build/production/Target/app.json index ceb7c100c..a304edfc6 100644 --- a/frontend/build/production/Target/app.json +++ b/frontend/build/production/Target/app.json @@ -1 +1 @@ -{"packages":{"classic":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core"],"version":"6.0.1.250"},"cmd":{"current":"6.5.1.240","version":"6.5.1.240"},"common":{"css":true,"included":true,"required":true,"requires":["ext","core","classic","ux"],"version":"1.0.0"},"core":{"css":true,"included":true,"required":true,"requires":["ext","classic"],"version":"6.0.1.250"},"ext":{"css":true,"included":true,"license":"gpl","namespace":"Ext","required":true,"requires":[],"version":"6.0.1.250"},"font-awesome":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base","theme-neutral","theme-neptune"],"theme":"theme-neptune","version":"6.0.1.250"},"theme-base":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic"],"version":"6.0.1.250"},"theme-crisp":{"css":true,"extend":"theme-neptune","included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base","theme-neutral","theme-neptune"],"version":"6.0.1.250"},"theme-neptune":{"css":true,"extend":"theme-neutral","included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base","theme-neutral"],"version":"6.0.1.250"},"theme-neutral":{"css":true,"extend":"theme-base","included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base"],"version":"6.0.1.250"},"ux":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic"],"version":"6.0.1.250"},"visiomatic":{"css":true,"included":true,"namespace":"visiomatic","required":true,"requires":["ext","core","classic"],"version":"1.0.0"}},"js":[{"path":"packages/local/visiomatic/src/Leaflet/dist/leaflet.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/jquery-min.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/jqplot-min.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/spectrum.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/visiomatic-src.js"},{"path":"app.js"}],"css":[{"path":"packages/local/visiomatic/src/Leaflet/dist/leaflet.css"},{"path":"packages/local/visiomatic/src/visiomatic/dist/visiomatic.css"},{"path":"packages/local/visiomatic/src/visiomatic/dist/spectrum.css"},{"path":"packages/local/visiomatic/src/visiomatic/dist/jqplot.css"},{"exclude":["fashion"],"path":"resources/Target-all.css"}],"cache":{"enable":true,"deltas":true},"fashion":{"inliner":{"enable":false}},"name":"Target","version":"1.0.0.0","framework":"ext","toolkit":"classic","theme":"theme-crisp","loader":{"cache":"20180315155043","cacheParam":"_dc"},"id":"85a0e2c2-ad9b-4f4a-84ed-649bd3f711fd","hash":"9065716416f42f9b331a586af38106702b22fdae","profile":"","resources":{"path":"resources"}} \ No newline at end of file +{"packages":{"classic":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core"],"version":"6.0.1.250"},"cmd":{"current":"6.5.1.240","version":"6.5.1.240"},"common":{"css":true,"included":true,"required":true,"requires":["ext","core","classic","ux"],"version":"1.0.0"},"core":{"css":true,"included":true,"required":true,"requires":["ext","classic"],"version":"6.0.1.250"},"ext":{"css":true,"included":true,"license":"gpl","namespace":"Ext","required":true,"requires":[],"version":"6.0.1.250"},"font-awesome":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base","theme-neutral","theme-neptune"],"theme":"theme-neptune","version":"6.0.1.250"},"theme-base":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic"],"version":"6.0.1.250"},"theme-crisp":{"css":true,"extend":"theme-neptune","included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base","theme-neutral","theme-neptune"],"version":"6.0.1.250"},"theme-neptune":{"css":true,"extend":"theme-neutral","included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base","theme-neutral"],"version":"6.0.1.250"},"theme-neutral":{"css":true,"extend":"theme-base","included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base"],"version":"6.0.1.250"},"ux":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic"],"version":"6.0.1.250"},"visiomatic":{"css":true,"included":true,"namespace":"visiomatic","required":true,"requires":["ext","core","classic"],"version":"1.0.0"}},"js":[{"path":"packages/local/visiomatic/src/Leaflet/dist/leaflet.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/jquery-min.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/jqplot-min.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/spectrum.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/visiomatic-src.js"},{"path":"app.js"}],"css":[{"path":"packages/local/visiomatic/src/Leaflet/dist/leaflet.css"},{"path":"packages/local/visiomatic/src/visiomatic/dist/visiomatic.css"},{"path":"packages/local/visiomatic/src/visiomatic/dist/spectrum.css"},{"path":"packages/local/visiomatic/src/visiomatic/dist/jqplot.css"},{"exclude":["fashion"],"path":"resources/Target-all.css"}],"cache":{"enable":true,"deltas":true},"fashion":{"inliner":{"enable":false}},"name":"Target","version":"1.0.0.0","framework":"ext","toolkit":"classic","theme":"theme-crisp","loader":{"cache":"20180315162947","cacheParam":"_dc"},"id":"85a0e2c2-ad9b-4f4a-84ed-649bd3f711fd","hash":"81aada18b1b74d7bfc44c6effa88f1e82bcf6b50","profile":"","resources":{"path":"resources"}} \ No newline at end of file diff --git a/frontend/build/production/Target/app.jsonp b/frontend/build/production/Target/app.jsonp index 15ffc4e1b..6e4ba527b 100644 --- a/frontend/build/production/Target/app.jsonp +++ b/frontend/build/production/Target/app.jsonp @@ -1 +1 @@ -Ext.Microloader.setManifest({"packages":{"classic":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core"],"version":"6.0.1.250"},"cmd":{"current":"6.5.1.240","version":"6.5.1.240"},"common":{"css":true,"included":true,"required":true,"requires":["ext","core","classic","ux"],"version":"1.0.0"},"core":{"css":true,"included":true,"required":true,"requires":["ext","classic"],"version":"6.0.1.250"},"ext":{"css":true,"included":true,"license":"gpl","namespace":"Ext","required":true,"requires":[],"version":"6.0.1.250"},"font-awesome":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base","theme-neutral","theme-neptune"],"theme":"theme-neptune","version":"6.0.1.250"},"theme-base":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic"],"version":"6.0.1.250"},"theme-crisp":{"css":true,"extend":"theme-neptune","included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base","theme-neutral","theme-neptune"],"version":"6.0.1.250"},"theme-neptune":{"css":true,"extend":"theme-neutral","included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base","theme-neutral"],"version":"6.0.1.250"},"theme-neutral":{"css":true,"extend":"theme-base","included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base"],"version":"6.0.1.250"},"ux":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic"],"version":"6.0.1.250"},"visiomatic":{"css":true,"included":true,"namespace":"visiomatic","required":true,"requires":["ext","core","classic"],"version":"1.0.0"}},"js":[{"path":"packages/local/visiomatic/src/Leaflet/dist/leaflet.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/jquery-min.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/jqplot-min.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/spectrum.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/visiomatic-src.js"},{"path":"app.js"}],"css":[{"path":"packages/local/visiomatic/src/Leaflet/dist/leaflet.css"},{"path":"packages/local/visiomatic/src/visiomatic/dist/visiomatic.css"},{"path":"packages/local/visiomatic/src/visiomatic/dist/spectrum.css"},{"path":"packages/local/visiomatic/src/visiomatic/dist/jqplot.css"},{"exclude":["fashion"],"path":"resources/Target-all.css"}],"cache":{"enable":true,"deltas":true},"fashion":{"inliner":{"enable":false}},"name":"Target","version":"1.0.0.0","framework":"ext","toolkit":"classic","theme":"theme-crisp","loader":{"cache":"20180315155043","cacheParam":"_dc"},"id":"85a0e2c2-ad9b-4f4a-84ed-649bd3f711fd","hash":"9065716416f42f9b331a586af38106702b22fdae","profile":"","resources":{"path":"resources"}}); \ No newline at end of file +Ext.Microloader.setManifest({"packages":{"classic":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core"],"version":"6.0.1.250"},"cmd":{"current":"6.5.1.240","version":"6.5.1.240"},"common":{"css":true,"included":true,"required":true,"requires":["ext","core","classic","ux"],"version":"1.0.0"},"core":{"css":true,"included":true,"required":true,"requires":["ext","classic"],"version":"6.0.1.250"},"ext":{"css":true,"included":true,"license":"gpl","namespace":"Ext","required":true,"requires":[],"version":"6.0.1.250"},"font-awesome":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base","theme-neutral","theme-neptune"],"theme":"theme-neptune","version":"6.0.1.250"},"theme-base":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic"],"version":"6.0.1.250"},"theme-crisp":{"css":true,"extend":"theme-neptune","included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base","theme-neutral","theme-neptune"],"version":"6.0.1.250"},"theme-neptune":{"css":true,"extend":"theme-neutral","included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base","theme-neutral"],"version":"6.0.1.250"},"theme-neutral":{"css":true,"extend":"theme-base","included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic","theme-base"],"version":"6.0.1.250"},"ux":{"css":true,"included":true,"namespace":"Ext","required":true,"requires":["ext","core","classic"],"version":"6.0.1.250"},"visiomatic":{"css":true,"included":true,"namespace":"visiomatic","required":true,"requires":["ext","core","classic"],"version":"1.0.0"}},"js":[{"path":"packages/local/visiomatic/src/Leaflet/dist/leaflet.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/jquery-min.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/jqplot-min.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/spectrum.js"},{"path":"packages/local/visiomatic/src/visiomatic/dist/visiomatic-src.js"},{"path":"app.js"}],"css":[{"path":"packages/local/visiomatic/src/Leaflet/dist/leaflet.css"},{"path":"packages/local/visiomatic/src/visiomatic/dist/visiomatic.css"},{"path":"packages/local/visiomatic/src/visiomatic/dist/spectrum.css"},{"path":"packages/local/visiomatic/src/visiomatic/dist/jqplot.css"},{"exclude":["fashion"],"path":"resources/Target-all.css"}],"cache":{"enable":true,"deltas":true},"fashion":{"inliner":{"enable":false}},"name":"Target","version":"1.0.0.0","framework":"ext","toolkit":"classic","theme":"theme-crisp","loader":{"cache":"20180315162947","cacheParam":"_dc"},"id":"85a0e2c2-ad9b-4f4a-84ed-649bd3f711fd","hash":"81aada18b1b74d7bfc44c6effa88f1e82bcf6b50","profile":"","resources":{"path":"resources"}}); \ No newline at end of file diff --git a/frontend/explorer/app/model/Product.js b/frontend/explorer/app/model/Product.js index 6338a5023..3a820056e 100644 --- a/frontend/explorer/app/model/Product.js +++ b/frontend/explorer/app/model/Product.js @@ -17,6 +17,7 @@ Ext.define('Explorer.model.Product', { {name:'is_owner', type:'boolean', defaultValue: false}, {name:'tablename', type:'string'}, {name: 'epr_original_id', type: 'string'}, + {name: 'productlog', type: 'string'}, // Nome do producto + process ID { name:'name_with_process_id', diff --git a/frontend/explorer/app/view/system/Form.js b/frontend/explorer/app/view/system/Form.js index 0bed8bd2c..c3db98a5c 100644 --- a/frontend/explorer/app/view/system/Form.js +++ b/frontend/explorer/app/view/system/Form.js @@ -45,16 +45,56 @@ Ext.define('Explorer.view.system.Form', { } }, { + xtype: 'fieldcontainer', fieldLabel: 'Proccess Id', - bind: { - value: '{currentProduct.epr_original_id}' - } + defaults: { + margin: '0 5 0 0' + }, + layout: 'hbox', + items: [ + { + xtype: "textfield", + width: 140, + bind: { + value: '{currentProduct.epr_original_id}' + } + }, + { + xtype: "button", + iconCls: 'fa fa-info', + tooltip: "Product Log", + bind: { + href: '{currentProduct.productlog}', + disabled: '{!currentProduct.productlog}' + } + } + ] }, { + xtype: 'fieldcontainer', fieldLabel: 'VAC', - bind: { - value: '{vacCluster.epr_original_id} - {vacCluster.prd_display_name}' - } + defaults: { + margin: '0 5 0 0' + }, + layout: 'hbox', + items: [ + { + xtype: "textfield", + width: 140, + bind: { + value: '{vacCluster.epr_original_id} - {vacCluster.prd_display_name}' + } + }, + { + xtype: "button", + iconCls: 'fa fa-info', + tooltip: "Product Log", + bind: { + href: '{vacCluster.productlog}', + disabled: '{!vacCluster.productlog}' + } + } + ] } ] } diff --git a/frontend/explorer/app/view/system/VacGrid.js b/frontend/explorer/app/view/system/VacGrid.js index cdc4868ca..89bca8ffd 100644 --- a/frontend/explorer/app/view/system/VacGrid.js +++ b/frontend/explorer/app/view/system/VacGrid.js @@ -111,6 +111,16 @@ Ext.define('Explorer.view.system.VacGrid', { iconCls: 'x-tbar-loading', handler: 'loadVacObjects', tooltip: 'Refresh' + }, + '-', + { + xtype: "button", + iconCls: 'fa fa-info', + tooltip: "Product Log", + bind: { + href: '{currentVacProduct.productlog}', + disabled: '{!currentVacProduct.productlog}' + } } ] });