Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(776)

Side by Side Diff: app/views/utils.js

Issue 13237053: Adds relation error support to simulator
Patch Set: Adds relation error support to simulator Created 11 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « app/templates/unitOverview.handlebars ('k') | app/views/viewlet-manager.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 1158
1159 /* Given one of the many "real" states return a "UI" state. 1159 /* Given one of the many "real" states return a "UI" state.
1160 * 1160 *
1161 * If a state ends in "-error" or is simply "error" then it is an error 1161 * If a state ends in "-error" or is simply "error" then it is an error
1162 * state, if it is "started" then it is "running", otherwise it is "pending". 1162 * state, if it is "started" then it is "running", otherwise it is "pending".
1163 */ 1163 */
1164 utils.simplifyState = function(unit, ignoreRelationErrors) { 1164 utils.simplifyState = function(unit, ignoreRelationErrors) {
1165 var state = unit.agent_state; 1165 var state = unit.agent_state;
1166 if (state === 'started') { 1166 if (state === 'started') {
1167 if (!ignoreRelationErrors && 1167 if (!ignoreRelationErrors &&
1168 // No longer used in the Go back end.
1168 unit.relation_errors && 1169 unit.relation_errors &&
1169 Y.Object.size(unit.relation_errors)) { 1170 Y.Object.size(unit.relation_errors)) {
1170 return 'error'; 1171 return 'error';
1171 } 1172 }
1172 return 'running'; 1173 return 'running';
1173 } 1174 }
1174 if ((/-?error$/).test(state)) { 1175 if ((/-?error$/).test(state)) {
1175 return 'error'; 1176 return 'error';
1176 } 1177 }
1177 // "pending", "installed", and "stopped", plus anything unforeseen 1178 // "pending", "installed", and "stopped", plus anything unforeseen
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 'base-build', 1552 'base-build',
1552 'handlebars', 1553 'handlebars',
1553 'node', 1554 'node',
1554 'view', 1555 'view',
1555 'panel', 1556 'panel',
1556 'json-stringify', 1557 'json-stringify',
1557 'gallery-markdown', 1558 'gallery-markdown',
1558 'datatype-date-format' 1559 'datatype-date-format'
1559 ] 1560 ]
1560 }); 1561 });
OLDNEW
« no previous file with comments | « app/templates/unitOverview.handlebars ('k') | app/views/viewlet-manager.js » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b