LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 This file is part of the Juju GUI, which lets users view and manage Juju | 2 This file is part of the Juju GUI, which lets users view and manage Juju |
3 environments within a graphical interface (https://launchpad.net/juju-gui). | 3 environments within a graphical interface (https://launchpad.net/juju-gui). |
4 Copyright (C) 2012-2013 Canonical Ltd. | 4 Copyright (C) 2012-2013 Canonical Ltd. |
5 | 5 |
6 This program is free software: you can redistribute it and/or modify it under | 6 This program is free software: you can redistribute it and/or modify it under |
7 the terms of the GNU Affero General Public License version 3, as published by | 7 the terms of the GNU Affero General Public License version 3, as published by |
8 the Free Software Foundation. | 8 the Free Software Foundation. |
9 | 9 |
10 This program is distributed in the hope that it will be useful, but WITHOUT | 10 This program is distributed in the hope that it will be useful, but WITHOUT |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 message: 'Import from "' + file.name + | 91 message: 'Import from "' + file.name + |
92 '" failed.<br/>' + result.error, | 92 '" failed.<br/>' + result.error, |
93 level: 'error' | 93 level: 'error' |
94 }); | 94 }); |
95 } | 95 } |
96 }); | 96 }); |
97 }; | 97 }; |
98 reader.readAsText(file); | 98 reader.readAsText(file); |
99 }); | 99 }); |
100 } else { | 100 } else { |
101 env.importEnvironment(evt._event.dataTransfer.getData('Text')); | 101 // If this is not a drop event generated by the application (all |
| 102 // of which have a dataType), then it was caused by dropping |
| 103 // something external to the app, in which case it might be an |
| 104 // environment configuration, so process it as such. |
| 105 var dataType = evt._event.dataTransfer.getData('dataType'); |
| 106 if (dataType === undefined) { |
| 107 env.importEnvironment(evt._event.dataTransfer.getData('Text')); |
| 108 } |
102 } | 109 } |
103 evt.preventDefault(); | 110 evt.preventDefault(); |
104 evt.stopPropagation(); | 111 evt.stopPropagation(); |
105 }, | 112 }, |
106 | 113 |
107 /** | 114 /** |
108 * Update lifecycle phase | 115 * Update lifecycle phase |
109 * @method update | 116 * @method update |
110 */ | 117 */ |
111 update: function() { | 118 update: function() { |
(...skipping 30 matching lines...) Expand all Loading... |
142 }, '0.1.0', { | 149 }, '0.1.0', { |
143 requires: [ | 150 requires: [ |
144 'node', | 151 'node', |
145 'event', | 152 'event', |
146 'd3-components', | 153 'd3-components', |
147 'juju-models', | 154 'juju-models', |
148 'juju-env', | 155 'juju-env', |
149 'juju-view-utils' | 156 'juju-view-utils' |
150 ] | 157 ] |
151 }); | 158 }); |
LEFT | RIGHT |