Skip to content

Commit

Permalink
Zowe Suite v1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zowe-robot authored Jan 27, 2020
2 parents 3601792 + 9b90169 commit c50f46a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export class ProjectTreeComponent {
// Todo: Create right click menu functionality.
}

onNodeClick($event:any){
onNodeClick($event: any){
if ($event.directory == false) {
//let nodeData: ProjectStructure = new ProjectStructure();
const nodeData: ProjectStructure = {
Expand All @@ -209,12 +209,14 @@ export class ProjectTreeComponent {

this.editorControl.openFile('', nodeData).subscribe(x => {
this.log.debug(`File loaded through File Explorer.`);
this.editorControl.checkForAndSetReadOnlyMode(x.model);
});
} else if($event.data.isDataset){
let data: ProjectStructure = ($event.data as ProjectStructure);
if($event.type == 'file'){
this.editorControl.openFile('', (data)).subscribe(x => {
this.log.debug(`Dataset loaded through File Explorer.`);
this.editorControl.checkForAndSetReadOnlyMode(x.model);
});
}
}
Expand Down
30 changes: 30 additions & 0 deletions webClient/src/app/shared/editor-control/editor-control.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import { MessageDuration } from "../message-duration";

let stateCache = {};
let lastFile;
//Unsupported DS types
const unsupportedTypes: Array<string> = ['G', 'B', 'C', 'D', 'I', 'R'];

export let EditorServiceInstance: BehaviorSubject<any> = new BehaviorSubject(undefined);
/**
Expand Down Expand Up @@ -241,6 +243,7 @@ export class EditorControlService implements ZLUX.IEditor, ZLUX.IEditorMultiBuff
const smallView = editor.viewModel.reduceRestoreState(cache.view);
editor._view.restoreState(smallView);
}
this.checkForAndSetReadOnlyMode(model);
fileOpenSub.unsubscribe();
});

Expand All @@ -255,6 +258,33 @@ export class EditorControlService implements ZLUX.IEditor, ZLUX.IEditorMultiBuff
}
}

public checkForAndSetReadOnlyMode(model: any): void {
let editor = this.editor.getValue();
// Set write mode to true by default
editor.updateOptions({ readOnly: false });
// Current unsupported types:
// B - Generation data group
// C - VSAM Cluster
// D - VSAM Data
// G - Alternate index
// I - VSAM Index
// R - VSAM Path

if (model) {
if (model.datasetAttrs) {
//VSAM & GDG are currently not supported for write mode
if (unsupportedTypes.includes(model.datasetAttrs.csiEntryType)) {
editor.updateOptions({ readOnly: true });
}
// TODO: Uncomment this in case PDSE is not supported for Dataset writing
//PDSE is not supported for write mode
// if (model.datasetAttrs.dsorg.isPDSE && model.datasetAttrs.dsorg.isPDSE == true) {
// editor.updateOptions({ readOnly: true });
// }
}
}
}

public fetchFileContext(fileNode: ProjectStructure, context?: ProjectContext[]): ProjectContext {
let fileContext: ProjectContext;
if (context == null && this._context.getValue()) {
Expand Down

0 comments on commit c50f46a

Please sign in to comment.