Blame view

js/app/views/EpnTapUI.js 4.99 KB
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
1
2
3
4
5
6
7
8
9
10
/**
 * Project: AMDA-NG
 * Name: EpnTapUI.js
 * @class amdaUI.EpnTapUI
 * @extends Ext.tab.Panel
 * @brief client for EPN-TAP services (View)
 * @author Nathanael JOURDANE
 * 24/10/2016: file creation
 */

bfcf6dc8   Nathanael Jourdane   Fill the combo-bo...
11
12
13
 Ext.create('Ext.data.Store', {
	storeId:'productTypes_store',
	fields: ['id', 'name']
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
14
15
16
});

Ext.create('Ext.data.Store', {
bfcf6dc8   Nathanael Jourdane   Fill the combo-bo...
17
18
	storeId:'targetClasses_store',
	fields: ['id', 'name']
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
19
20
21
});

Ext.create('Ext.data.Store', {
bfcf6dc8   Nathanael Jourdane   Fill the combo-bo...
22
23
	storeId: 'targetNames_store',
	fields: ['id', 'name']
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
24
25
26
});

Ext.create('Ext.data.Store', {
bfcf6dc8   Nathanael Jourdane   Fill the combo-bo...
27
28
	storeId: 'services_store',
	fields: ['id', 'nb_results']
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
29
30
31
});

Ext.create('Ext.data.Store', {
bfcf6dc8   Nathanael Jourdane   Fill the combo-bo...
32
33
	storeId:'granules_store',
	fields:['type', 'target_name', 'time_min', 'time_max']
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
});

var serviceFilterPanel = {
	id: 'serviceFilterPanel',
	xtype: 'panel',
	region : 'north',
	layout: { type: 'hbox', pack: 'start', align: 'stretch' },
	defaults: { margin: 5 },
	items: [{ // Left part
		xtype : 'container',
		layout: 'form',
		flex: 2,
		items: [{
			id: 'productTypeCB',
			xtype: 'combobox',
			fieldLabel: 'Product type',
			store: Ext.data.StoreManager.lookup('productTypes_store'),
			queryMode: 'local',
			displayField: 'name',
			valueField: 'id',
			name: 'productType',
			editable: false,
bfcf6dc8   Nathanael Jourdane   Fill the combo-bo...
56
57
58
59
60
61
			listeners: {
				scope: window,
				'select': function(store, records) {
					myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.epntap.id).onProductTypeCB(records);
				}
			}
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
62
63
64
65
66
67
68
69
70
71
		}, {
			id: 'targetClassCB',
			xtype: 'combobox',
			fieldLabel: 'Target class',
			store: Ext.data.StoreManager.lookup('targetClasses_store'),
			queryMode: 'local',
			displayField: 'name',
			valueField: 'id',
			name: 'targetClass',
			editable: false,
bfcf6dc8   Nathanael Jourdane   Fill the combo-bo...
72
73
74
75
76
77
			listeners: {
				scope: window,
				'select': function(store, records) {
					myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.epntap.id).onTargetClassCB(records);
				}
			}
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
78
79
80
81
82
83
		}, {
			id: 'targetNameCB',
			xtype: 'combobox',
			fieldLabel: 'Target name',
			store: Ext.data.StoreManager.lookup('targetNames_store'),
			queryMode: 'local',
bfcf6dc8   Nathanael Jourdane   Fill the combo-bo...
84
85
			displayField: 'name',
			valueField: 'id',
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
86
			name: 'targetName',
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
87
88
89
90
			triggerAction: 'all',
			typeAhead: true,
			mode: 'remote',
			minChars: 2,
bfcf6dc8   Nathanael Jourdane   Fill the combo-bo...
91
92
93
94
95
96
97
			forceSelection: true,
			listeners: {
				scope: window,
				'select': function(store, records) {
					myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.epntap.id).onTargetNameCB(records);
				}
			}
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
		}]
	}, { // Right part
		xtype : 'container',
		layout: 'form',
		flex: 2,
		items: [{
			id: 'startTimeDF',
			xtype: 'datefield',
			fieldLabel: 'Start time',
			name: 'start_time',
			allowBlank:false
		}, {
			id: 'stopTimeDF',
			xtype: 'datefield',
			fieldLabel: 'Stop time',
			name: 'stop_time',
			allowBlank:false
		}, {
			id: 'searchServicesBtn',
			xtype: 'button',
			text: 'Search services',
			handler: function() {
				myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.epntap.id).onSearchBtnClicked();
			}
		}]
	}]
}

var servicesPanel = {
	id: 'servicesPanel',
	xtype : 'grid',
	title: 'Services',
	multiSelect: true,
	store: Ext.data.StoreManager.lookup('services_store'),
	flex: 1,
	columns: [
bfcf6dc8   Nathanael Jourdane   Fill the combo-bo...
134
135
		{text: 'Name', dataIndex: 'id', flex: 1},
		{text: 'Results', dataIndex: 'nb_results', flex: 1}
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
136
	],
b09a9c3a   Nathanael Jourdane   Use the VESPA ser...
137
138
139
	renderer: function(value, metadata,record) {
		return getExpandableImage(value, metadata,record);
	},
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
	listeners: {
		'cellclick': function(grid, td, cellIndex, record, tr, rowIndex, e, eOpts) {
			myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.epntap.id).onServiceSelected(record.data);
		}
	}
}

var granulesPanel = {
	id: 'granulesPanel',
	xtype : 'grid',
	title: 'Granules',
	store: Ext.data.StoreManager.lookup('granulesStore'),
	flex: 3,
	columns: [
		{ text: 'Type',  dataIndex: 'type', flex: 1 },
		{ text: 'Target', dataIndex: 'target_name', flex: 1 },
		{ text: 'Time min', dataIndex: 'time_min', flex: 2 },
		{ text: 'Time max', dataIndex: 'time_max', flex: 2 }
	],
	listeners: {
		'cellclick': function(grid, td, cellIndex, record, tr, rowIndex, e, eOpts) {
			myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.epntap.id).onGranuleSelected(record.data);
		}
	}
}

var mainPanel = {
	id: 'mainPanel',
	xtype: 'panel',
	region: 'center',
	height: 350,
	layout: { type: 'hbox', pack: 'start', align: 'stretch' },
	items: [ servicesPanel, granulesPanel ],
	listeners: {
		afterrender: function() {
			myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.epntap.id).onWindowLoaded();
		}
	}
}

var infoPanel = {
	id: 'infoPanel',
	xtype : 'panel',
	region: 'south',
	title: 'Information',
	collapsible: true,
	flex: 0,
	height: 100,
	autoHide: false,
	bodyStyle: 'padding: 5px',
	iconCls: 'icon-information',
	loader: { autoLoad: true, url: helpDir + 'epnTapHOWTO' }
}

Ext.define('amdaUI.EpnTapUI', {
	extend: 'Ext.container.Container',
	alias: 'widget.panelEpnTap',

	constructor: function(config) {
		this.init(config);
		this.callParent(arguments);
	},

	init : function(config) {
		var myConf = {
			width: 600,
			height: 550,
			layout: 'border',
			items: [
				serviceFilterPanel,
				mainPanel,
				infoPanel
			]
		};
		Ext.apply(this, Ext.apply(arguments, myConf));
	}
});