mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-24 22:46:40 +00:00
Remove unused Switch Directory Pane (#766)
This commit is contained in:
parent
487fbf2072
commit
7efa8ca58f
@ -1,21 +0,0 @@
|
||||
<div data-bind="visible: visible, event: { keydown: onPaneKeyDown }">
|
||||
<div class="contextual-pane-out" data-bind="click: close, clickBubble: false"></div>
|
||||
<div class="contextual-pane" id="switchdirectorypane">
|
||||
<!-- Switch Directory -- Start -->
|
||||
<div class="contextual-pane-in">
|
||||
<!-- Switch Directory header - Start -->
|
||||
<div class="firstdivbg headerline">
|
||||
<span role="heading" aria-level="2" data-bind="text: title"></span>
|
||||
<div class="closeImg" role="button" aria-label="Close pane" tabindex="0" data-bind="click: close">
|
||||
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- Switch Directory header - End -->
|
||||
|
||||
<!-- Switch Directory content - Start -->
|
||||
<div class="paneMainContent" data-bind="react: directoryComponentAdapter"></div>
|
||||
<!-- Switch Directory content - Start -->
|
||||
</div>
|
||||
<!-- Switch Directory -- End -->
|
||||
</div>
|
||||
</div>
|
@ -1,88 +0,0 @@
|
||||
import * as ko from "knockout";
|
||||
|
||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||
import { DirectoryListProps } from "../Controls/Directory/DirectoryListComponent";
|
||||
import { DefaultDirectoryDropdownProps } from "../Controls/Directory/DefaultDirectoryDropdownComponent";
|
||||
import { DirectoryComponentAdapter } from "../Controls/Directory/DirectoryComponentAdapter";
|
||||
import SwitchDirectoryPaneTemplate from "./SwitchDirectoryPane.html";
|
||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
|
||||
class PaneComponent {
|
||||
constructor(data: any) {
|
||||
return data.data;
|
||||
}
|
||||
}
|
||||
|
||||
export class SwitchDirectoryPaneComponent {
|
||||
constructor() {
|
||||
return {
|
||||
viewModel: PaneComponent,
|
||||
template: SwitchDirectoryPaneTemplate,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export class SwitchDirectoryPane {
|
||||
public id: string;
|
||||
public firstFieldHasFocus: ko.Observable<boolean>;
|
||||
public title: ko.Observable<string>;
|
||||
public visible: ko.Observable<boolean>;
|
||||
|
||||
public directoryComponentAdapter: DirectoryComponentAdapter;
|
||||
|
||||
constructor(
|
||||
dropdownProps: ko.Observable<DefaultDirectoryDropdownProps>,
|
||||
listProps: ko.Observable<DirectoryListProps>
|
||||
) {
|
||||
this.id = "switchdirectorypane";
|
||||
this.title = ko.observable("Switch directory");
|
||||
this.visible = ko.observable(false);
|
||||
this.firstFieldHasFocus = ko.observable(false);
|
||||
this.resetData();
|
||||
this.directoryComponentAdapter = new DirectoryComponentAdapter(dropdownProps, listProps);
|
||||
}
|
||||
|
||||
public open() {
|
||||
this.visible(true);
|
||||
this.firstFieldHasFocus(true);
|
||||
this.resizePane();
|
||||
TelemetryProcessor.trace(Action.ContextualPane, ActionModifiers.Open, {
|
||||
paneTitle: this.title(),
|
||||
});
|
||||
|
||||
this.directoryComponentAdapter.forceRender();
|
||||
}
|
||||
|
||||
public close() {
|
||||
this.visible(false);
|
||||
this.resetData();
|
||||
this.directoryComponentAdapter.forceRender();
|
||||
}
|
||||
|
||||
public resetData() {
|
||||
this.firstFieldHasFocus(false);
|
||||
}
|
||||
|
||||
public onCloseKeyPress(source: any, event: KeyboardEvent): void {
|
||||
if (event.key === " " || event.key === "Enter") {
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
||||
public onPaneKeyDown(source: any, event: KeyboardEvent): boolean {
|
||||
if (event.key === "Escape") {
|
||||
this.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private resizePane(): void {
|
||||
const paneElement: HTMLElement = document.getElementById(this.id);
|
||||
const headerElement: HTMLElement = document.getElementsByTagName("header")[0];
|
||||
const newPaneElementHeight = window.innerHeight - headerElement.offsetHeight;
|
||||
|
||||
paneElement.style.height = `${newPaneElementHeight}px`;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user