Blame view

js/app/views/PlotComponents/intervalSelection/PlotFunctionIntervalSelection.js 1.82 KB
1591d4c2   Menouard AZIB   Basic functionali...
1
Ext.define('amdaPlotComp.intervalSelection.PlotFunctionIntervalSelection', {
e9597b38   Menouard AZIB   Add comments to P...
2
3
    extend: 'amdaPlotComp.intervalSelection.IntervalSelection', // This class extends from amdaPlotComp.intervalSelection.IntervalSelection
    requires: ['amdaPlotComp.plotFunction.FunctionType'], // This class requires the FunctionType class from amdaPlotComp.plotFunction
1591d4c2   Menouard AZIB   Basic functionali...
4

9150eb42   Menouard AZIB   Add comments to F...
5
    title: "Plot Function", // The title of the window
e9597b38   Menouard AZIB   Add comments to P...
6
    plotFunctionType: null, // An instance of the FunctionType class, initially set to null
1591d4c2   Menouard AZIB   Basic functionali...
7

e9597b38   Menouard AZIB   Add comments to P...
8
9
10
11
    /**
     * Initializes the component.
     * It calls the parent's initComponent method, then creates a new instance of FunctionType and adds it to the form.
     */
1591d4c2   Menouard AZIB   Basic functionali...
12
13
14
    initComponent: function () {
        this.callParent(arguments);
        this.plotFunctionType = new amdaPlotComp.plotFunction.FunctionType();
9ea5aa6b   Menouard AZIB   Add comments to I...
15
        this.form.add(this.plotFunctionType);
1591d4c2   Menouard AZIB   Basic functionali...
16
17
    },

e9597b38   Menouard AZIB   Add comments to P...
18
19
20
21
22
    /**
     * Applies the plot function based on the values of the fields.
     * If the values are not valid, it shows a warning message.
     * Otherwise, it calls the interactive plot with the plotFunction action and resets the host component selection.
     */
1591d4c2   Menouard AZIB   Basic functionali...
23
24
    _apply: function () {
        if (this._notValidValues()) {
aba2eb97   Menouard AZIB   Add InsertToTTCat...
25
            myDesktopApp.warningMsg('Please note that either the Start Time or the Stop Time has not been defined. To proceed, ensure both times are properly set.');
1591d4c2   Menouard AZIB   Basic functionali...
26
        } else {
11c71fa5   Menouard AZIB   Add comments to P...
27
            const request_to_send = Object.assign({}, this.plotFunctionType.getValues(), {
1591d4c2   Menouard AZIB   Basic functionali...
28
29
30
31
32
33
34
35
                'action': 'plotFunction',
                'interactiveId': this.interactiveId,
                'panelId': this.panelId,
                'starttime': this.getField1Value(),
                'stoptime': this.getField2Value(),
            });

            this.hostCmp.callInteractivePlot(request_to_send);
2dc9b65a   Menouard AZIB   All refactored cm...
36
            this._resetHostCmpSelection();
1591d4c2   Menouard AZIB   Basic functionali...
37
38
39
40
        }
    },

});