Skip to content

Commit 05ca618

Browse files
msivasubramaniaandatho7561
authored andcommitted
config git functionality added
Signed-off-by: msivasubramaniaan <msivasub@redhat.com>
1 parent be8c61a commit 05ca618

File tree

3 files changed

+53
-11
lines changed

3 files changed

+53
-11
lines changed

package.json

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,11 @@
829829
"title": "Volumes",
830830
"category": "OpenShift"
831831
},
832+
{
833+
"command": "openshift.Serverless.addGit",
834+
"title": "Git",
835+
"category": "OpenShift"
836+
},
832837
{
833838
"command": "openshift.Serverless.removeEnv",
834839
"title": "Environment Variables",
@@ -843,6 +848,11 @@
843848
"command": "openshift.Serverless.removeVolume",
844849
"title": "Volumes",
845850
"category": "OpenShift"
851+
},
852+
{
853+
"command": "openshift.Serverless.removeGit",
854+
"title": "Git",
855+
"category": "OpenShift"
846856
}
847857
],
848858
"keybindings": [
@@ -1188,6 +1198,10 @@
11881198
"command": "openshift.Serverless.addVolume",
11891199
"when": "false"
11901200
},
1201+
{
1202+
"command": "openshift.Serverless.addGit",
1203+
"when": "false"
1204+
},
11911205
{
11921206
"command": "openshift.Serverless.removeEnv",
11931207
"when": "false"
@@ -1199,6 +1213,10 @@
11991213
{
12001214
"command": "openshift.Serverless.removeVolume",
12011215
"when": "false"
1216+
},
1217+
{
1218+
"command": "openshift.Serverless.removeGit",
1219+
"when": "false"
12021220
}
12031221
],
12041222
"view/title": [
@@ -1270,36 +1288,46 @@
12701288
],
12711289
"serverlessfunction/addConfig": [
12721290
{
1273-
"command": "openshift.Serverless.addLabel",
1291+
"command": "openshift.Serverless.addEnv",
1292+
"when": "view == openshiftServerlessFunctionsView && viewItem =~ /^(localFunctionsWithBuild|localDeployFunctions)$/",
1293+
"group": "c1@0"
1294+
},
1295+
{
1296+
"command": "openshift.Serverless.addGit",
12741297
"when": "view == openshiftServerlessFunctionsView && viewItem =~ /^(localFunctionsWithBuild|localDeployFunctions)$/",
12751298
"group": "c1@1"
12761299
},
12771300
{
1278-
"command": "openshift.Serverless.addVolume",
1301+
"command": "openshift.Serverless.addLabel",
12791302
"when": "view == openshiftServerlessFunctionsView && viewItem =~ /^(localFunctionsWithBuild|localDeployFunctions)$/",
12801303
"group": "c1@2"
12811304
},
12821305
{
1283-
"command": "openshift.Serverless.addEnv",
1284-
"when": "view == openshiftServerlessFunctionsView && viewItem =~ /^(localFunctionsWithBuild|localDeployFunctions)$/",
1285-
"group": "c1@3"
1306+
"command": "openshift.Serverless.addVolume",
1307+
"when": "view == openshiftServerlessFunctionsView && viewItem =~ /^(localFunctionsWithBuild|localDeployFunctions)$/",
1308+
"group": "c1@3"
12861309
}
12871310
],
12881311
"serverlessfunction/removeConfig": [
12891312
{
1290-
"command": "openshift.Serverless.removeLabel",
1313+
"command": "openshift.Serverless.removeEnv",
1314+
"when": "view == openshiftServerlessFunctionsView && viewItem =~ /^(localFunctionsWithBuild|localDeployFunctions)$/",
1315+
"group": "c1@0"
1316+
},
1317+
{
1318+
"command": "openshift.Serverless.removeGit",
12911319
"when": "view == openshiftServerlessFunctionsView && viewItem =~ /^(localFunctionsWithBuild|localDeployFunctions)$/",
12921320
"group": "c1@1"
12931321
},
12941322
{
1295-
"command": "openshift.Serverless.removeVolume",
1323+
"command": "openshift.Serverless.removeLabel",
12961324
"when": "view == openshiftServerlessFunctionsView && viewItem =~ /^(localFunctionsWithBuild|localDeployFunctions)$/",
12971325
"group": "c1@2"
12981326
},
12991327
{
1300-
"command": "openshift.Serverless.removeEnv",
1301-
"when": "view == openshiftServerlessFunctionsView && viewItem =~ /^(localFunctionsWithBuild|localDeployFunctions)$/",
1302-
"group": "c1@3"
1328+
"command": "openshift.Serverless.removeVolume",
1329+
"when": "view == openshiftServerlessFunctionsView && viewItem =~ /^(localFunctionsWithBuild|localDeployFunctions)$/",
1330+
"group": "c1@3"
13031331
}
13041332
],
13051333
"view/item/context": [

src/serverlessFunction/commands.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ export class ServerlessCommand {
8686
new CommandOption('-p', functionPath)
8787
]);
8888
if (isAdd) {
89-
commandText.addOption(new CommandOption('add'));
89+
if (mode === 'git') {
90+
commandText.addOption(new CommandOption('set'));
91+
} else {
92+
commandText.addOption(new CommandOption('add'));
93+
}
9094
} else {
9195
commandText.addOption(new CommandOption('remove'));
9296
}

src/serverlessFunction/view.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ export class ServerlessFunctionView implements TreeDataProvider<ExplorerItem>, D
271271
await BuildAndDeploy.getInstance().config(`Add Volumes '${context.name}'`, context, 'volumes');
272272
}
273273

274+
@vsCommand('openshift.Serverless.addGit')
275+
static async addGit(context: FunctionObject) {
276+
await BuildAndDeploy.getInstance().config(`Add Git '${context.name}'`, context, 'git');
277+
}
278+
274279
@vsCommand('openshift.Serverless.removeEnv')
275280
static removeEnv(context: FunctionObject) {
276281
void BuildAndDeploy.getInstance().config(`Remove environment variables '${context.name}'`, context, 'envs', false);
@@ -285,4 +290,9 @@ export class ServerlessFunctionView implements TreeDataProvider<ExplorerItem>, D
285290
static async removeVolume(context: FunctionObject) {
286291
await BuildAndDeploy.getInstance().config(`Remove Volumes '${context.name}'`, context, 'volumes', false);
287292
}
293+
294+
@vsCommand('openshift.Serverless.removeGit')
295+
static async removeGit(context: FunctionObject) {
296+
await BuildAndDeploy.getInstance().config(`Remove Git '${context.name}'`, context, 'git', false);
297+
}
288298
}

0 commit comments

Comments
 (0)