@@ -23,159 +23,159 @@ var s3;
23
23
var dashlist ;
24
24
25
25
function Commands ( ) {
26
- config = new Config ( ) ;
27
- if ( config . statusCheck ( ) ) {
28
- components = new Components ( config . getProperty ( 'config' ) ) ;
29
- grafana = new Grafana ( config . getProperty ( 'config' ) , components ) ;
30
- s3 = new S3 ( config . getProperty ( 'config' ) , components ) ;
31
- }
32
- gnet = new GNet ( components ) ;
33
- dashlist = new Dashlist ( ) ;
26
+ config = new Config ( ) ;
27
+ if ( config . statusCheck ( ) ) {
28
+ components = new Components ( config . getProperty ( 'config' ) ) ;
29
+ grafana = new Grafana ( config . getProperty ( 'config' ) , components ) ;
30
+ s3 = new S3 ( config . getProperty ( 'config' ) , components ) ;
31
+ }
32
+ gnet = new GNet ( components ) ;
33
+ dashlist = new Dashlist ( ) ;
34
34
}
35
35
36
36
// Creates an entity in wizzy or Grafana
37
37
Commands . prototype . instructions = function ( ) {
38
38
39
- /* Key points before editing the cases:
40
- 1. process.argv[0] - reserverd for `node`
41
- 2. process.argv[1] - reserverd for `wizzy` or `index.js`
42
- */
39
+ /* Key points before editing the cases:
40
+ 1. process.argv[0] - reserverd for `node`
41
+ 2. process.argv[1] - reserverd for `wizzy` or `index.js`
42
+ */
43
43
44
- var commands = _ . drop ( process . argv , 2 ) ;
45
- var command = commands [ 0 ] ;
44
+ var commands = _ . drop ( process . argv , 2 ) ;
45
+ var command = commands [ 0 ] ;
46
46
47
- switch ( command ) {
48
- case 'version' :
49
- console . log ( '0.6.0' ) ;
50
- break ;
51
- case 'help' :
52
- help . showHelp ( ) ;
53
- break ;
54
- case 'init' :
55
- config . initialize ( ) ;
56
- break ;
57
- case 'status' :
58
- status ( ) ;
59
- break ;
60
- case 'conf' :
61
- config . showProperty ( 'config' ) ;
62
- break ;
63
- case 'set' :
64
- config . addProperty ( _ . drop ( commands , 1 ) ) ;
65
- break ;
66
- case 'unset' :
67
- config . removeProperty ( _ . drop ( commands , 1 ) ) ;
68
- break ;
69
- case 'import' :
70
- grafana . import ( _ . drop ( commands ) ) ;
71
- break ;
72
- case 'export' :
73
- grafana . export ( _ . drop ( commands ) ) ;
74
- break ;
75
- case 'create' :
76
- if ( commands [ 1 ] === 'dash-list' ) {
77
- dashlist . createList ( _ . drop ( commands , 2 ) ) ;
78
- } else {
79
- grafana . create ( _ . drop ( commands ) ) ;
80
- }
81
- break ;
82
- case 'delete' :
83
- if ( commands [ 1 ] === 'dash-list' ) {
84
- dashlist . deleteList ( _ . drop ( commands , 2 ) ) ;
85
- } else {
86
- grafana . delete ( _ . drop ( commands ) ) ;
87
- }
88
- break ;
89
- case 'show' :
90
- if ( commands [ 1 ] === 'dash-list' ) {
91
- dashlist . showList ( _ . drop ( commands , 2 ) ) ;
92
- } else {
93
- grafana . show ( _ . drop ( commands ) ) ;
94
- }
95
- break ;
96
- case 'list' :
97
- if ( commands [ 1 ] === 'gnet' ) {
98
- gnet . list ( _ . drop ( commands , 2 ) ) ;
99
- } else if ( commands [ 1 ] === 'panels' ) {
100
- components . list ( _ . drop ( commands , 1 ) ) ;
101
- } else {
102
- grafana . list ( _ . drop ( commands ) ) ;
103
- }
104
- break ;
105
- case 'clip' :
106
- grafana . clip ( _ . drop ( commands ) ) ;
107
- break ;
108
- case 'summarize' :
109
- components . summarize ( _ . drop ( commands ) ) ;
110
- break ;
111
- case 'change' :
47
+ switch ( command ) {
48
+ case 'version' :
49
+ console . log ( '0.6.0' ) ;
50
+ break ;
51
+ case 'help' :
52
+ help . showHelp ( ) ;
53
+ break ;
54
+ case 'init' :
55
+ config . initialize ( ) ;
56
+ break ;
57
+ case 'status' :
58
+ status ( ) ;
59
+ break ;
60
+ case 'conf' :
61
+ config . showProperty ( 'config' ) ;
62
+ break ;
63
+ case 'set' :
64
+ config . addProperty ( _ . drop ( commands , 1 ) ) ;
65
+ break ;
66
+ case 'unset' :
67
+ config . removeProperty ( _ . drop ( commands , 1 ) ) ;
68
+ break ;
69
+ case 'import' :
70
+ grafana . import ( _ . drop ( commands ) ) ;
71
+ break ;
72
+ case 'export' :
73
+ grafana . export ( _ . drop ( commands ) ) ;
74
+ break ;
75
+ case 'create' :
76
+ if ( commands [ 1 ] === 'dash-list' ) {
77
+ dashlist . createList ( _ . drop ( commands , 2 ) ) ;
78
+ } else {
79
+ grafana . create ( _ . drop ( commands ) ) ;
80
+ }
81
+ break ;
82
+ case 'delete' :
83
+ if ( commands [ 1 ] === 'dash-list' ) {
84
+ dashlist . deleteList ( _ . drop ( commands , 2 ) ) ;
85
+ } else {
86
+ grafana . delete ( _ . drop ( commands ) ) ;
87
+ }
88
+ break ;
89
+ case 'show' :
90
+ if ( commands [ 1 ] === 'dash-list' ) {
91
+ dashlist . showList ( _ . drop ( commands , 2 ) ) ;
92
+ } else {
93
+ grafana . show ( _ . drop ( commands ) ) ;
94
+ }
95
+ break ;
96
+ case 'list' :
97
+ if ( commands [ 1 ] === 'gnet' ) {
98
+ gnet . list ( _ . drop ( commands , 2 ) ) ;
99
+ } else if ( commands [ 1 ] === 'panels' ) {
100
+ components . list ( _ . drop ( commands , 1 ) ) ;
101
+ } else {
102
+ grafana . list ( _ . drop ( commands ) ) ;
103
+ }
104
+ break ;
105
+ case 'clip' :
106
+ grafana . clip ( _ . drop ( commands ) ) ;
107
+ break ;
108
+ case 'summarize' :
109
+ components . summarize ( _ . drop ( commands ) ) ;
110
+ break ;
111
+ case 'change' :
112
112
components . change ( _ . drop ( commands ) ) ;
113
113
break ;
114
- case 'move' :
115
- components . moveCopyOrRemove ( commands ) ;
116
- break ;
117
- case 'copy' :
118
- components . moveCopyOrRemove ( commands ) ;
119
- break ;
120
- case 'remove' :
121
- if ( commands [ 1 ] === 'from-dash-list' ) {
122
- dashlist . removeDashboard ( _ . drop ( commands , 2 ) ) ;
123
- } else {
124
- components . moveCopyOrRemove ( commands ) ;
125
- }
126
- break ;
127
- case 'extract' :
128
- components . extract ( _ . drop ( commands ) ) ;
129
- break ;
130
- case 'insert' :
131
- components . insert ( _ . drop ( commands ) ) ;
132
- break ;
133
- case 'download' :
134
- if ( commands [ 1 ] === 'from-gnet' ) {
135
- gnet . download ( _ . drop ( commands , 2 ) ) ;
136
- } else if ( commands [ 1 ] === 'from-s3' ) {
137
- s3 . download ( _ . drop ( commands , 2 ) ) ;
138
- }
139
- break ;
140
- case 'upload' :
141
- if ( commands [ 1 ] === 'to-s3' ) {
142
- s3 . upload ( _ . drop ( commands , 2 ) ) ;
143
- }
144
- break ;
145
- case 'add' :
146
- if ( commands [ 1 ] === 'to-dash-list' ) {
147
- dashlist . addDashboard ( _ . drop ( commands , 2 ) ) ;
148
- }
149
- break ;
150
- case 'clear' :
151
- if ( commands [ 1 ] === 'dash-list' ) {
152
- dashlist . clearList ( _ . drop ( commands , 2 ) ) ;
153
- }
154
- break ;
155
- case 'switch' :
156
- grafana . switch ( _ . drop ( commands ) ) ;
157
- break ;
158
- default :
159
- logger . showError ( 'Unsupported command called.' ) ;
160
- help . showHelp ( ) ;
161
- }
114
+ case 'move' :
115
+ components . moveCopyOrRemove ( commands ) ;
116
+ break ;
117
+ case 'copy' :
118
+ components . moveCopyOrRemove ( commands ) ;
119
+ break ;
120
+ case 'remove' :
121
+ if ( commands [ 1 ] === 'from-dash-list' ) {
122
+ dashlist . removeDashboard ( _ . drop ( commands , 2 ) ) ;
123
+ } else {
124
+ components . moveCopyOrRemove ( commands ) ;
125
+ }
126
+ break ;
127
+ case 'extract' :
128
+ components . extract ( _ . drop ( commands ) ) ;
129
+ break ;
130
+ case 'insert' :
131
+ components . insert ( _ . drop ( commands ) ) ;
132
+ break ;
133
+ case 'download' :
134
+ if ( commands [ 1 ] === 'from-gnet' ) {
135
+ gnet . download ( _ . drop ( commands , 2 ) ) ;
136
+ } else if ( commands [ 1 ] === 'from-s3' ) {
137
+ s3 . download ( _ . drop ( commands , 2 ) ) ;
138
+ }
139
+ break ;
140
+ case 'upload' :
141
+ if ( commands [ 1 ] === 'to-s3' ) {
142
+ s3 . upload ( _ . drop ( commands , 2 ) ) ;
143
+ }
144
+ break ;
145
+ case 'add' :
146
+ if ( commands [ 1 ] === 'to-dash-list' ) {
147
+ dashlist . addDashboard ( _ . drop ( commands , 2 ) ) ;
148
+ }
149
+ break ;
150
+ case 'clear' :
151
+ if ( commands [ 1 ] === 'dash-list' ) {
152
+ dashlist . clearList ( _ . drop ( commands , 2 ) ) ;
153
+ }
154
+ break ;
155
+ case 'switch' :
156
+ grafana . switch ( _ . drop ( commands ) ) ;
157
+ break ;
158
+ default :
159
+ logger . showError ( 'Unsupported command called.' ) ;
160
+ help . showHelp ( ) ;
161
+ }
162
162
} ;
163
163
164
164
// Shows wizzy status
165
165
function status ( ) {
166
166
167
- var setupProblem = config . statusCheck ( true ) ;
168
- if ( setupProblem ) {
169
- var setupGit = localfs . checkExists ( '.git' , '.git directory' , true ) ;
170
- if ( setupGit ) {
171
- logger . showResult ( 'wizzy setup complete.' ) ;
172
- }
173
- else {
174
- logger . showResult ( 'wizzy setup complete without Git.' ) ;
175
- }
176
- } else {
177
- logger . showError ( 'wizzy setup incomplete.' ) ;
178
- }
167
+ var setupProblem = config . statusCheck ( true ) ;
168
+ if ( setupProblem ) {
169
+ var setupGit = localfs . checkExists ( '.git' , '.git directory' , true ) ;
170
+ if ( setupGit ) {
171
+ logger . showResult ( 'wizzy setup complete.' ) ;
172
+ }
173
+ else {
174
+ logger . showResult ( 'wizzy setup complete without Git.' ) ;
175
+ }
176
+ } else {
177
+ logger . showError ( 'wizzy setup incomplete.' ) ;
178
+ }
179
179
180
180
}
181
181
0 commit comments