Completed
Pull Request — master (#391)
by Jonas
08:46 queued 05:29
created

Views/backend/connect/view/main/progress.js   A

Complexity

Total Complexity 4
Complexity/F 1.33

Size

Lines of Code 79
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
nc 1
dl 0
loc 79
rs 10
c 1
b 0
f 0
wmc 4
mnd 1
bc 4
fnc 3
bpm 1.3333
cpm 1.3333
noi 3

3 Functions

Rating   Name   Duplication   Size   Complexity  
A Ext.define(ꞌShopware.apps.Connect.view.main.Progressꞌ).initComponent 0 7 1
A Ext.define(ꞌShopware.apps.Connect.view.main.Progressꞌ).createItems 0 15 1
A Ext.define(ꞌShopware.apps.Connect.view.main.Progressꞌ).closeWindow 0 11 2
1
//{namespace name=backend/connect/view/main}
2
3
//{block name="backend/connect/view/main/progress"}
4
Ext.define('Shopware.apps.Connect.view.main.Progress', {
0 ignored issues
show
Bug introduced by
The variable Ext seems to be never declared. If this is a global, consider adding a /** global: Ext */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
5
6
    extend:'Enlight.app.Window',
7
    cls: Ext.baseCSSPrefix + 'connect',
8
9
    alias: 'widget.connect-main-migration-progress-window',
10
    border: false,
11
    autoShow: true,
12
    layout: 'anchor',
13
    width: 420,
14
    height: 80,
15
    maximizable: false,
16
    minimizable: false,
17
    closable: false,
18
    footerButton: true,
19
    stateful: true,
20
    modal: true,
21
    inProcess: false,
22
23
    /**
24
     * Contains the batch size for each request of the generation.
25
     */
26
    batchSize: 200,
27
28
    /**
29
     * Contains array with source ids which have to exported
30
     */
31
    sourceIds: [],
32
33
    /**
34
     * Contains all snippets for the component
35
     * @object
36
     */
37
    snippets: {
38
        title: 'Migration',
39
        process: '{s name=connect/import/dataMigrations/progress/process}[0] of [1] imported product(s) migrated...{/s}',
40
    },
41
42
    bodyPadding: 10,
43
44
    initComponent:function () {
45
        var me = this;
46
47
        me.items = me.createItems();
48
        me.title = me.snippets.title;
49
        me.callParent(arguments);
50
    },
51
52
    /**
53
     * Creates the items for the progress window.
54
     */
55
    createItems: function() {
56
        var me = this;
57
58
        me.progressField = Ext.create('Ext.ProgressBar', {
0 ignored issues
show
Bug introduced by
The variable Ext seems to be never declared. If this is a global, consider adding a /** global: Ext */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
59
            name: 'productExportBar',
60
            text: Ext.String.format(me.snippets.process, 0, me.sourceIds.length),
61
            margin: '0 0 15',
62
            border: 1,
63
            style: 'border-width: 1px !important;',
64
            cls: 'left-align',
65
            value: 0
66
        });
67
68
        return [ me.progressField ];
69
    },
70
71
    closeWindow: function() {
72
        var me = this;
73
74
        if (me.progressField.getActiveAnimation()) {
75
            Ext.defer(me.closeWindow, 200, me);
0 ignored issues
show
Bug introduced by
The variable Ext seems to be never declared. If this is a global, consider adding a /** global: Ext */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
76
            return;
77
        }
78
79
        // Wait a little before destroy the window for a better use feeling
80
        Ext.defer(me.destroy, 500, me);
81
    }
82
});
83
//{/block}
84