Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding the option to submit the JCL from the File Tree #158

Open
wants to merge 3 commits into
base: v1.x/staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 0.13.0
* Added the option to download the dataset file.
* Added create folder, delete and collapse icons in tree explorer
* Added the option to submit the JCL

## 0.12.0
* Added the option to open a file in new browser tab
Expand Down
44 changes: 44 additions & 0 deletions src/app/components/filebrowsermvs/filebrowsermvs.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class FileBrowserMVSComponent implements OnInit, OnDestroy {//IFileBrowse
public isLoading: boolean;
private rightClickedFile: any;
private rightClickPropertiesDatasetFile: ContextMenuItem[];
private rightClickPropertiesDatasetJCLFile: ContextMenuItem[];
private rightClickPropertiesDatasetFolder: ContextMenuItem[];
private deletionQueue = new Map();
private additionalQualifiers: boolean;
Expand Down Expand Up @@ -175,6 +176,26 @@ export class FileBrowserMVSComponent implements OnInit, OnDestroy {//IFileBrowse
}},
{ text: "Download", action:() => {
this.attemptDownload(this.rightClickedFile);
}},
{ text: "Submit JCL", action:() => {
this.attemptSubmit(this.rightClickedFile);
}}
];
this.rightClickPropertiesDatasetJCLFile = [
{ text: "Request Open in New Browser Tab", action:() => {
this.openInNewTab.emit(this.rightClickedFile);
}},
{ text: "Properties", action:() => {
this.showPropertiesDialog(this.rightClickedFile);
}},
{ text: "Delete", action:() => {
this.showDeleteDialog(this.rightClickedFile);
}},
{ text: "Download", action:() => {
this.attemptDownload(this.rightClickedFile);
}},
{ text: "Submit JCL", action:() => {
this.attemptSubmit(this.rightClickedFile);
}}
];
this.rightClickPropertiesDatasetFolder = [
Expand Down Expand Up @@ -375,6 +396,25 @@ export class FileBrowserMVSComponent implements OnInit, OnDestroy {//IFileBrowse
});
}

attemptSubmit(rightClickedFile: any) {
let dataset = rightClickedFile.data.path;
this.datasetService.submitJCL(dataset).subscribe((response) => {
if (response.jobId) {
let ref = this.snackBar.open('JCL Submitted. ID='+response.jobId,'View in Explorer', {duration: 5000, panelClass: 'center' })
.onAction().subscribe(()=> {
const dispatcher = ZoweZLUX.dispatcher;
const argumentFormatter = {data: {op:'deref',source:'event',path:['data']}};
let action = dispatcher.makeAction('org.zowe.editor.jcl.view', 'View JCL',
dispatcher.constants.ActionTargetMode.PluginFindAnyOrCreate,
dispatcher.constants.ActionType.Launch,'org.zowe.explorer-jes',argumentFormatter);
dispatcher.invokeAction(action,{'data':{'owner':'*','prefix':'*','jobId':response.jobId}});
});
} else {
this.snackBar.open('Warning: JCL submitted but Job ID not found.', 'Dismiss', {duration: 10000, panelClass: 'center' });
}
});
}

showPropertiesDialog(rightClickedFile: any) {
const filePropConfig = new MatDialogConfig();
filePropConfig.data = {
Expand Down Expand Up @@ -502,6 +542,10 @@ export class FileBrowserMVSComponent implements OnInit, OnDestroy {//IFileBrowse
let rightClickProperties;
if(node.type === 'file'){
rightClickProperties = this.rightClickPropertiesDatasetFile;
if(node.data.fileName.includes('.JCL','.JCL.','.CNTL','.CNTL.'))
{
rightClickProperties = this.rightClickPropertiesDatasetJCLFile
}
}
else{
rightClickProperties = this.rightClickPropertiesDatasetFolder;
Expand Down
7 changes: 7 additions & 0 deletions src/app/services/dataset.crud.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ export class DatasetCrudService {
.catch(this.handleErrorObservable);
}

submitJCL(rightClickedFile: any): Observable<any> {
let url = ZoweZLUX.uriBroker.agentRootUri('jes');
return this.http.put(url, { file: rightClickedFile })
.map(res => res.json())
.catch(this.handleErrorObservable);
}

queryDatasets(query:string, detail?: boolean, includeAdditionalQualifiers?: boolean): Observable<any> {
let url:string;
url = ZoweZLUX.uriBroker.datasetMetadataUri(encodeURIComponent(query.toUpperCase( ).replace(/\.$/, '')), detail.toString(), undefined, true, undefined, undefined, undefined, undefined, undefined, includeAdditionalQualifiers.toString());
Expand Down