Completed
Push — master ( b99875...9db866 )
by Jonas
03:27
created

Progressꞌ).initComponent   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 7
rs 9.4285
c 1
b 0
f 0
1
//{namespace name=backend/connect/view/import}
2
3
//{block name="backend/connect/view/import/progress"}
4
Ext.define('Shopware.apps.Connect.view.import.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
8
    alias: 'widget.connect-import-category-assignment-progress-window',
9
    border: false,
10
    autoShow: true,
11
    layout: 'anchor',
12
    width: 420,
13
    height: 120,
14
    maximizable: false,
15
    minimizable: false,
16
    closable: false,
17
    footerButton: true,
18
    stateful: true,
19
    modal: true,
20
    inProcess: false,
21
22
    /**
23
     * Number of categories that should get assigned
24
     */
25
    categoriesCount: 0,
26
27
    /**
28
     * Number of articles that should get assigned in current category
29
     */
30
    articlesCount: 0,
31
32
33
    /**
34
     * Contains all snippets for the component
35
     * @object
36
     */
37
    snippets: {
38
        title: '{s name=import/assignment/title}Category Assignment{/s}',
39
        processCategories: '{s name=import/assignment/categoryProcess}[0] of [1] categories assigned...{/s}',
40
        processArticles: '{s name=import/assignment/articleProcess}[0] of [1] articles assigned...{/s}'
41
    },
42
43
    bodyPadding: 10,
44
45
    initComponent:function () {
46
        var me = this;
47
48
        me.items = me.createItems();
49
        me.title = me.snippets.title;
50
        me.callParent(arguments);
51
    },
52
53
    /**
54
     * Creates the items for the progress window.
55
     */
56
    createItems: function() {
57
        var me = this;
58
59
        me.progressFieldCategories = 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...
60
            animate: true,
61
            name: 'categoriesProcessedBar',
62
            text: Ext.String.format(me.snippets.processCategories, 0, me.categoriesCount),
63
            margin: '0 0 15',
64
            border: 1,
65
            style: 'border-width: 1px !important;',
66
            cls: 'left-align',
67
            value: 0
68
        });
69
70
        me.progressFieldArticles = Ext.create('Ext.ProgressBar', {
71
            animate: true,
72
            name: 'categoriesProcessedBar',
73
            text: Ext.String.format(me.snippets.processArticles, 0, me.articlesCount),
74
            margin: '0 0 15',
75
            border: 1,
76
            style: 'border-width: 1px !important;',
77
            cls: 'left-align',
78
            value: 0
79
        });
80
81
        return [ me.progressFieldCategories, me.progressFieldArticles ];
82
    },
83
84
    closeWindow: function() {
85
        var me = this;
86
87
        if (me.progressFieldArticles.getActiveAnimation()) {
88
            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...
89
            return;
90
        }
91
92
        // Wait a little before destroy the window for a better use feeling
93
        Ext.defer(me.destroy, 500, me);
94
    }
95
});
96
//{/block}
97