zcatalyst-cli 1.11.0 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/.DS_Store +0 -0
- package/lib/client-utils.js +0 -27
- package/lib/commands/iac/import.js +26 -5
- package/lib/endpoints/lib/sdk.js +2 -2
- package/lib/init/features/client/initializers/angular.js +23 -5
- package/lib/init/features/client/initializers/basic.js +36 -13
- package/lib/init/features/client/initializers/lyte.js +43 -26
- package/lib/init/features/client/initializers/react.js +50 -26
- package/lib/init/util/client.js +88 -4
- package/lib/serve/server/lib/master.js +2 -6
- package/lib/serve/server/lib/web_client/server.js +2 -2
- package/lib/util_modules/constants/lib/placeholders.js +1 -2
- package/lib/util_modules/constants/lib/urls.js +4 -4
- package/lib/util_modules/fs/index.js +1 -9
- package/lib/util_modules/fs/lib/async.js +3 -3
- package/lib/util_modules/fs/utils.js +8 -0
- package/package.json +2 -2
- package/templates/.DS_Store +0 -0
- package/templates/init/.DS_Store +0 -0
- package/templates/init/client/lyte/package.json +1 -1
- package/templates/init/client/react/react_js/template.json +1 -1
- package/templates/init/client/react/react_ts/template.json +1 -1
- package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +94 -109
- package/templates/init/functions/java/integ/cliq/com/handlers/CommandHandler.java +20 -27
- package/templates/init/functions/java/integ/cliq/com/handlers/FunctionHandler.java +143 -112
- package/templates/init/functions/java/integ/cliq/com/handlers/InstallationHandler.java +4 -7
- package/templates/init/functions/java/integ/cliq/com/handlers/InstallationValidator.java +4 -7
- package/templates/init/functions/java/integ/cliq/com/handlers/MessageActionHandler.java +10 -12
- package/templates/init/functions/java/integ/cliq/com/handlers/WidgetHandler.java +100 -66
- package/templates/init/functions/java/integ/cliq/sample.java +5 -7
- package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +0 -1
- package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +46 -0
- package/templates/init/functions/node/integ/cliq/handlers/widget-handler.js +31 -0
- package/lib/serve/server/lib/web_client/utils.js +0 -10
|
@@ -17,17 +17,17 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
17
17
|
const minimatch_1 = __importDefault(require("minimatch"));
|
|
18
18
|
const os_1 = __importDefault(require("os"));
|
|
19
19
|
const path_1 = __importDefault(require("path"));
|
|
20
|
-
const
|
|
20
|
+
const utils_js_1 = require("../utils.js");
|
|
21
21
|
function dirExists(pth) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const stats = yield fs_extra_1.default.stat(
|
|
23
|
+
const stats = yield fs_extra_1.default.stat(utils_js_1.untildify(pth)).catch(() => false);
|
|
24
24
|
return stats && stats.isDirectory();
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
exports.dirExists = dirExists;
|
|
28
28
|
function fileExists(pth) {
|
|
29
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const stats = yield fs_extra_1.default.stat(
|
|
30
|
+
const stats = yield fs_extra_1.default.stat(utils_js_1.untildify(pth)).catch(() => false);
|
|
31
31
|
return stats && stats.isFile();
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.untildify = void 0;
|
|
4
|
+
const os_1 = require("os");
|
|
5
|
+
const tildRegex = /^~(?=$|\/|\\)/;
|
|
6
|
+
const homeDirectory = os_1.homedir();
|
|
7
|
+
const untildify = (pth) => homeDirectory ? pth.replace(tildRegex, homeDirectory) : pth;
|
|
8
|
+
exports.untildify = untildify;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zcatalyst-cli",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "Command Line Tool for CATALYST",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"ws": "^8.2.3",
|
|
57
57
|
"xml2js": "^0.4.23",
|
|
58
58
|
"yaml": "^1.10.2",
|
|
59
|
-
"zcatalyst-angular-schematics": "0.0.1"
|
|
59
|
+
"zcatalyst-angular-schematics": "^0.0.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/app-module-path": "^2.2.0",
|
|
Binary file
|
package/templates/init/.DS_Store
CHANGED
|
Binary file
|
|
@@ -21,7 +21,7 @@ import com.zc.cliq.objects.BotContextParam;
|
|
|
21
21
|
import com.zc.cliq.objects.BotSuggestion;
|
|
22
22
|
import com.zc.cliq.objects.ButtonObject;
|
|
23
23
|
import com.zc.cliq.objects.CardDetails;
|
|
24
|
-
import com.zc.cliq.objects.
|
|
24
|
+
import com.zc.cliq.objects.Message;
|
|
25
25
|
import com.zc.cliq.objects.Slide;
|
|
26
26
|
import com.zc.cliq.requests.BotContextHandlerRequest;
|
|
27
27
|
import com.zc.cliq.requests.BotMentionHandlerRequest;
|
|
@@ -32,112 +32,101 @@ import com.zc.cliq.requests.BotWebhookHandlerRequest;
|
|
|
32
32
|
import com.zc.cliq.requests.BotWelcomeHandlerRequest;
|
|
33
33
|
import com.zc.cliq.util.ZCCliqUtil;
|
|
34
34
|
|
|
35
|
-
public class BotHandler implements com.zc.cliq.interfaces.BotHandler
|
|
36
|
-
{
|
|
35
|
+
public class BotHandler implements com.zc.cliq.interfaces.BotHandler {
|
|
37
36
|
Logger LOGGER = Logger.getLogger(BotHandler.class.getName());
|
|
38
|
-
|
|
37
|
+
|
|
39
38
|
@Override
|
|
40
|
-
public Map<String,Object> welcomeHandler(BotWelcomeHandlerRequest req) {
|
|
39
|
+
public Map<String, Object> welcomeHandler(BotWelcomeHandlerRequest req) {
|
|
41
40
|
String uName = req.getUser() != null ? req.getUser().getFirstName() : "user";
|
|
42
41
|
String text = "Hello " + uName + ". Thank you for subscribing :smile:";
|
|
43
|
-
|
|
42
|
+
Message msg = Message.getInstance(text);
|
|
44
43
|
return ZCCliqUtil.toMap(msg);
|
|
45
44
|
}
|
|
46
|
-
|
|
45
|
+
|
|
47
46
|
@Override
|
|
48
|
-
public Map<String,Object> messageHandler(BotMessageHandlerRequest req) {
|
|
49
|
-
try{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
text = "Sorry, I'm not programmed yet to do this :sad:";
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
resp.put("text", text);
|
|
114
|
-
return resp;
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
catch(Exception ex){
|
|
47
|
+
public Map<String, Object> messageHandler(BotMessageHandlerRequest req) {
|
|
48
|
+
try {
|
|
49
|
+
String message = req.getMessage();
|
|
50
|
+
Map<String, Object> resp = new HashMap<String, Object>();
|
|
51
|
+
|
|
52
|
+
String text;
|
|
53
|
+
if (message == null) {
|
|
54
|
+
text = "Please enable 'Message' in bot settings";
|
|
55
|
+
} else if (message.equalsIgnoreCase("hi") || message.equalsIgnoreCase("hey")) {
|
|
56
|
+
text = "Hi " + req.getUser().getFirstName() + " :smile: How are you doing?";
|
|
57
|
+
BotSuggestion suggestion = BotSuggestion.getInstance();
|
|
58
|
+
suggestion.addSuggestion("Good");
|
|
59
|
+
suggestion.addSuggestion("Not bad");
|
|
60
|
+
suggestion.addSuggestion("Meh");
|
|
61
|
+
suggestion.addSuggestion("Worst");
|
|
62
|
+
resp.put("suggestions", suggestion);
|
|
63
|
+
} else if (message.equalsIgnoreCase("Good") || message.equalsIgnoreCase("Not bad")) {
|
|
64
|
+
text = "That's glad to hear :smile:";
|
|
65
|
+
} else if (message.equalsIgnoreCase("Meh") || message.equalsIgnoreCase("Worst")) {
|
|
66
|
+
text = "Oops! Don't you worry. Your day is definitely going to get better. :grinning:";
|
|
67
|
+
} else if (message.equalsIgnoreCase("details")) {
|
|
68
|
+
text = "Welcome to details collection center :wink:";
|
|
69
|
+
|
|
70
|
+
BotContext context = BotContext.getInstance();
|
|
71
|
+
context.setId("personal_details");
|
|
72
|
+
context.setTimeout(300);
|
|
73
|
+
|
|
74
|
+
BotContextParam param1 = BotContextParam.getInstance();
|
|
75
|
+
param1.setName("name");
|
|
76
|
+
param1.setQuestion("Please enter your name: ");
|
|
77
|
+
|
|
78
|
+
BotContextParam param2 = BotContextParam.getInstance();
|
|
79
|
+
param2.setName("dept");
|
|
80
|
+
param2.setQuestion("Please enter your department: ");
|
|
81
|
+
param2.addSuggestion("CSE");
|
|
82
|
+
param2.addSuggestion("IT");
|
|
83
|
+
param2.addSuggestion("MECH");
|
|
84
|
+
|
|
85
|
+
context.setParams(param1, param2);
|
|
86
|
+
resp.put("context", context);
|
|
87
|
+
} else if (message.equalsIgnoreCase("button")) {
|
|
88
|
+
|
|
89
|
+
Message msg = Message.getInstance("Here's your button");
|
|
90
|
+
ButtonObject btnObj = new ButtonObject();
|
|
91
|
+
btnObj.setType(BUTTON_TYPE.RED_OUTLINE);
|
|
92
|
+
btnObj.setLabel("Button1");
|
|
93
|
+
Action action = new Action();
|
|
94
|
+
action.setType(ACTION_TYPE.INVOKE_FUNCTION);
|
|
95
|
+
ActionData actionData = new ActionData();
|
|
96
|
+
actionData.setName("btnFunction");// ** ENTER YOUR BUTTON FUNCTION NAME HERE **
|
|
97
|
+
action.setData(actionData);
|
|
98
|
+
btnObj.setAction(action);
|
|
99
|
+
msg.addButton(btnObj);
|
|
100
|
+
return ZCCliqUtil.toMap(msg);
|
|
101
|
+
} else {
|
|
102
|
+
text = "Sorry, I'm not programmed yet to do this :sad:";
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
resp.put("text", text);
|
|
106
|
+
return resp;
|
|
107
|
+
|
|
108
|
+
} catch (Exception ex) {
|
|
118
109
|
LOGGER.log(Level.SEVERE, "Exception in message handler. ", ex);
|
|
119
110
|
throw ex;
|
|
120
111
|
}
|
|
121
112
|
}
|
|
122
|
-
|
|
113
|
+
|
|
123
114
|
@Override
|
|
124
115
|
public Map<String, Object> contextHandler(BotContextHandlerRequest req) {
|
|
125
|
-
|
|
126
116
|
Map<String, Object> resp = new HashMap<String, Object>();
|
|
127
|
-
if(req.getContextId().equals("personal_details")){
|
|
117
|
+
if (req.getContextId().equals("personal_details")) {
|
|
128
118
|
Map<String, String> answers = req.getAnswers();
|
|
129
119
|
StringBuilder str = new StringBuilder();
|
|
130
120
|
str.append("Name: ").append(answers.get("name")).append("\n");
|
|
131
121
|
str.append("Department: ").append(answers.get("dept")).append("\n");
|
|
132
|
-
|
|
122
|
+
|
|
133
123
|
resp.put("text", "Nice ! I have collected your info: \n" + str.toString());
|
|
134
124
|
}
|
|
135
125
|
return resp;
|
|
136
126
|
}
|
|
137
127
|
|
|
138
128
|
@Override
|
|
139
|
-
public Map<String, Object> mentionHandler(BotMentionHandlerRequest req)
|
|
140
|
-
{
|
|
129
|
+
public Map<String, Object> mentionHandler(BotMentionHandlerRequest req) {
|
|
141
130
|
String text = "Hey *" + req.getUser().getFirstName() + "*, thanks for mentioning me here. I'm from Catalyst city";
|
|
142
131
|
Map<String, Object> resp = new HashMap<String, Object>();
|
|
143
132
|
resp.put("text", text);
|
|
@@ -148,13 +137,11 @@ public class BotHandler implements com.zc.cliq.interfaces.BotHandler
|
|
|
148
137
|
public Map<String, Object> menuActionHandler(BotMenuActionHandlerRequest req) {
|
|
149
138
|
Map<String, Object> resp = new HashMap<String, Object>();
|
|
150
139
|
String text;
|
|
151
|
-
if(req.getActionName().equals("Say Hi")){
|
|
140
|
+
if (req.getActionName().equals("Say Hi")) {
|
|
152
141
|
text = "Hi";
|
|
153
|
-
}
|
|
154
|
-
else if(req.getActionName().equals("Look Angry")){
|
|
142
|
+
} else if (req.getActionName().equals("Look Angry")) {
|
|
155
143
|
text = ":angry:";
|
|
156
|
-
}
|
|
157
|
-
else{
|
|
144
|
+
} else {
|
|
158
145
|
text = "Menu action triggered :fist:";
|
|
159
146
|
}
|
|
160
147
|
resp.put("text", text);
|
|
@@ -162,60 +149,58 @@ public class BotHandler implements com.zc.cliq.interfaces.BotHandler
|
|
|
162
149
|
}
|
|
163
150
|
|
|
164
151
|
@Override
|
|
165
|
-
public Map<String, Object> webhookHandler(BotWebhookHandlerRequest req) throws Exception
|
|
166
|
-
{
|
|
152
|
+
public Map<String, Object> webhookHandler(BotWebhookHandlerRequest req) throws Exception {
|
|
167
153
|
// Sample handler class for incoming mails in ZohoMail
|
|
168
154
|
// Please configure the bot in ZohoMail's outgoing webhooks
|
|
169
155
|
JSONObject reqBody = req.getBody();
|
|
170
156
|
String summary;
|
|
171
|
-
String bodyStr = new StringBuilder("*From*: ").append(reqBody.getString("fromAddress"))
|
|
172
|
-
|
|
173
|
-
.append("\n*Content*: ").append((summary=reqBody.getString("summary")).length() > 100 ? summary.substring(0, 100) : summary).toString();
|
|
174
|
-
MessageBuilder msg = MessageBuilder.getInstance(bodyStr);
|
|
157
|
+
String bodyStr = new StringBuilder("*From*: ").append(reqBody.getString("fromAddress")).append("\n*Subject*: ").append(reqBody.getString("subject")).append("\n*Content*: ").append((summary = reqBody.getString("summary")).length() > 100 ? summary.substring(0, 100) : summary).toString();
|
|
158
|
+
Message msg = Message.getInstance(bodyStr);
|
|
175
159
|
msg.setBot("PostPerson", "https://previews.123rf.com/images/nastyatrel/nastyatrel2006/nastyatrel200600035/149438272-flat-vector-illustration-chat-bot-icon-flat-line-style-vector-.jpg");
|
|
176
160
|
CardDetails card = CardDetails.getInstance();
|
|
177
161
|
card.setTitle("New Mail");
|
|
178
162
|
card.setThumbnail("https://seekicon.com/free-icon-download/mail-icon_18.svg");
|
|
179
163
|
msg.setCard(card);
|
|
180
|
-
|
|
164
|
+
|
|
181
165
|
ButtonObject button = new ButtonObject();
|
|
182
166
|
button.setLabel("Open mail");
|
|
183
167
|
button.setType(BUTTON_TYPE.GREEN_OUTLINE);
|
|
184
168
|
button.setHint("Click to open the mail in a new tab");
|
|
185
|
-
Action action
|
|
169
|
+
Action action = new Action();
|
|
186
170
|
action.setType(ACTION_TYPE.OPEN_URL);
|
|
187
171
|
ActionData actionData = new ActionData();
|
|
188
172
|
actionData.setWeb("https://mail.zoho.com/zm/#mail/folder/inbox/p/" + reqBody.getLong("messageId"));
|
|
189
173
|
action.setData(actionData);
|
|
190
174
|
button.setAction(action);
|
|
191
|
-
|
|
175
|
+
|
|
192
176
|
msg.addButton(button);
|
|
193
|
-
|
|
177
|
+
|
|
194
178
|
Slide gifSlide = Slide.getInstance();
|
|
195
179
|
gifSlide.setType(SLIDE_TYPE.IMAGES);
|
|
196
180
|
gifSlide.setTitle("");
|
|
197
|
-
List<String> obj = new ArrayList<String>(){
|
|
181
|
+
List<String> obj = new ArrayList<String>() {
|
|
182
|
+
{
|
|
183
|
+
add("https://media.giphy.com/media/efyEShk2FJ9X2Kpd7V/giphy.gif");
|
|
184
|
+
}
|
|
185
|
+
};
|
|
198
186
|
gifSlide.setData(obj);
|
|
199
|
-
|
|
187
|
+
|
|
200
188
|
msg.addSlide(gifSlide);
|
|
201
|
-
|
|
189
|
+
|
|
202
190
|
return ZCCliqUtil.toMap(msg);
|
|
203
191
|
}
|
|
204
192
|
|
|
205
193
|
@Override
|
|
206
|
-
public Map<String, Object> participationHandler(BotParticipationHandlerRequest req) throws Exception
|
|
207
|
-
{
|
|
194
|
+
public Map<String, Object> participationHandler(BotParticipationHandlerRequest req) throws Exception {
|
|
208
195
|
String text;
|
|
209
|
-
if(req.getOperation().equals(CHANNEL_OPERATION.ADDED)){
|
|
196
|
+
if (req.getOperation().equals(CHANNEL_OPERATION.ADDED)) {
|
|
210
197
|
text = "Hi. Thanks for adding me to the channel :smile:";
|
|
211
|
-
}
|
|
212
|
-
else if(req.getOperation().equals(CHANNEL_OPERATION.REMOVED)){
|
|
198
|
+
} else if (req.getOperation().equals(CHANNEL_OPERATION.REMOVED)) {
|
|
213
199
|
text = "Bye-Bye :bye-bye:";
|
|
214
|
-
}
|
|
215
|
-
else{
|
|
200
|
+
} else {
|
|
216
201
|
text = "I'm too a participant of this chat :wink:";
|
|
217
202
|
}
|
|
218
|
-
|
|
203
|
+
Message msg = Message.getInstance(text);
|
|
219
204
|
return ZCCliqUtil.toMap(msg);
|
|
220
205
|
}
|
|
221
206
|
}
|
|
@@ -15,39 +15,33 @@ import com.zc.cliq.objects.FormValue;
|
|
|
15
15
|
import com.zc.cliq.requests.CommandHandlerRequest;
|
|
16
16
|
import com.zc.cliq.util.ZCCliqUtil;
|
|
17
17
|
|
|
18
|
-
public class CommandHandler implements com.zc.cliq.interfaces.CommandHandler
|
|
19
|
-
{
|
|
18
|
+
public class CommandHandler implements com.zc.cliq.interfaces.CommandHandler {
|
|
20
19
|
@Override
|
|
21
|
-
public Map<String, Object> executionHandler(CommandHandlerRequest req) throws Exception{
|
|
22
|
-
|
|
20
|
+
public Map<String, Object> executionHandler(CommandHandlerRequest req) throws Exception {
|
|
21
|
+
|
|
23
22
|
Map<String, Object> resp = new HashMap<String, Object>();
|
|
24
23
|
String text;
|
|
25
24
|
String commandName = req.getName();
|
|
26
|
-
if(commandName.equals("catalystresource")){
|
|
25
|
+
if (commandName.equals("catalystresource")) {
|
|
27
26
|
List<CommandSuggestion> suggestions = req.getSelections();
|
|
28
|
-
if(suggestions == null || suggestions.isEmpty()){
|
|
27
|
+
if (suggestions == null || suggestions.isEmpty()) {
|
|
29
28
|
text = "Please select a suggestion from the command";
|
|
30
|
-
}
|
|
31
|
-
else{
|
|
29
|
+
} else {
|
|
32
30
|
String prefix = "Take a look at our ";
|
|
33
|
-
if(suggestions.get(0).getTitle().equals("API doc")){
|
|
31
|
+
if (suggestions.get(0).getTitle().equals("API doc")) {
|
|
34
32
|
text = prefix + "[API Documentation](https://www.zoho.com/catalyst/help/api/introduction/overview.html)";
|
|
35
|
-
}
|
|
36
|
-
else if(suggestions.get(0).getTitle().equals("CLI doc")){
|
|
33
|
+
} else if (suggestions.get(0).getTitle().equals("CLI doc")) {
|
|
37
34
|
text = prefix + "[CLI Documentation](https://www.zoho.com/catalyst/help/cli-command-reference.html)";
|
|
38
|
-
}
|
|
39
|
-
else{
|
|
35
|
+
} else {
|
|
40
36
|
text = prefix + "[help documentation](https://www.zoho.com/catalyst/help/)";
|
|
41
37
|
}
|
|
42
38
|
}
|
|
43
|
-
}
|
|
44
|
-
else if(commandName.equals("getform")){
|
|
39
|
+
} else if (commandName.equals("getform")) {
|
|
45
40
|
return getForm();
|
|
46
|
-
}
|
|
47
|
-
else{
|
|
41
|
+
} else {
|
|
48
42
|
text = "Command executed successfully!";
|
|
49
43
|
}
|
|
50
|
-
|
|
44
|
+
|
|
51
45
|
resp.put("text", text);
|
|
52
46
|
return resp;
|
|
53
47
|
}
|
|
@@ -55,7 +49,7 @@ public class CommandHandler implements com.zc.cliq.interfaces.CommandHandler
|
|
|
55
49
|
@Override
|
|
56
50
|
public List<CommandSuggestion> suggestionHandler(CommandHandlerRequest req) {
|
|
57
51
|
List<CommandSuggestion> suggestionList = new ArrayList<CommandSuggestion>();
|
|
58
|
-
if(req.getName().equals("catalystresource")){
|
|
52
|
+
if (req.getName().equals("catalystresource")) {
|
|
59
53
|
CommandSuggestion sugg1 = CommandSuggestion.getInstance("API doc", "Catalyst API documentation", "https://www.zohowebstatic.com/sites/default/files/styles/product-home-page/public/catalyst-icon.png");
|
|
60
54
|
CommandSuggestion sugg2 = CommandSuggestion.getInstance("CLI doc", "Catalyst CLI documentation", "https://www.zohowebstatic.com/sites/default/files/styles/product-home-page/public/catalyst-icon.png");
|
|
61
55
|
CommandSuggestion sugg3 = CommandSuggestion.getInstance("Help doc", "Catalyst Help documentation", "https://www.zohowebstatic.com/sites/default/files/styles/product-home-page/public/catalyst-icon.png");
|
|
@@ -66,20 +60,19 @@ public class CommandHandler implements com.zc.cliq.interfaces.CommandHandler
|
|
|
66
60
|
return suggestionList;
|
|
67
61
|
}
|
|
68
62
|
|
|
69
|
-
private static Map<String, Object> getForm()
|
|
70
|
-
{
|
|
63
|
+
private static Map<String, Object> getForm() {
|
|
71
64
|
Form form = Form.getInstance();
|
|
72
65
|
form.setTitle("Asset Request");
|
|
73
66
|
form.setHint("Raise your asset request");
|
|
74
67
|
form.setName("ID");
|
|
75
68
|
form.setButtonLabel("Raise Request");
|
|
76
69
|
form.setVersion(1);
|
|
77
|
-
|
|
70
|
+
|
|
78
71
|
FormActionsObject actions = FormActionsObject.getInstance();
|
|
79
72
|
actions.setSubmitAction("formFunctionLatest"); // ** ENTER YOUR FORM FUNCTION NAME HERE **
|
|
80
|
-
|
|
73
|
+
|
|
81
74
|
form.setActions(actions);
|
|
82
|
-
|
|
75
|
+
|
|
83
76
|
FormInput username = FormInput.getIntance();
|
|
84
77
|
username.setType(FORM_FIELD_TYPE.TEXT);
|
|
85
78
|
username.setName("username");
|
|
@@ -89,7 +82,7 @@ public class CommandHandler implements com.zc.cliq.interfaces.CommandHandler
|
|
|
89
82
|
username.setMandatory(true);
|
|
90
83
|
username.setValue("Harold Finch");
|
|
91
84
|
form.addFormInput(username);
|
|
92
|
-
|
|
85
|
+
|
|
93
86
|
FormInput email = FormInput.getIntance();
|
|
94
87
|
email.setType(FORM_FIELD_TYPE.TEXT);
|
|
95
88
|
email.setFormat(FORM_FIELD_TEXT_FORMAT.EMAIL);
|
|
@@ -100,7 +93,7 @@ public class CommandHandler implements com.zc.cliq.interfaces.CommandHandler
|
|
|
100
93
|
email.setMandatory(true);
|
|
101
94
|
email.setValue("haroldfinch@samaritan.com");
|
|
102
95
|
form.addFormInput(email);
|
|
103
|
-
|
|
96
|
+
|
|
104
97
|
FormInput assetType = FormInput.getIntance();
|
|
105
98
|
assetType.setType(FORM_FIELD_TYPE.SELECT);
|
|
106
99
|
assetType.setTriggerOnChange(true);
|
|
@@ -112,7 +105,7 @@ public class CommandHandler implements com.zc.cliq.interfaces.CommandHandler
|
|
|
112
105
|
assetType.addOption(new FormValue("Laptop", "laptop"));
|
|
113
106
|
assetType.addOption(new FormValue("Mobile", "mobile"));
|
|
114
107
|
form.addFormInput(assetType);
|
|
115
|
-
|
|
108
|
+
|
|
116
109
|
return ZCCliqUtil.toMap(form);
|
|
117
110
|
}
|
|
118
111
|
}
|