mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 23:16:56 +00:00
* Ensure TabsBase.tabPath is always observable * In tests, Date.getTime() is not different enough * Add class name only in the Tab that needs it
This commit is contained in:
parent
19e39ea62f
commit
19cf203606
@ -1,4 +1,4 @@
|
|||||||
<div class="tab-pane flexContainer" data-bind="attr:{ id: tabId }" role="tabpanel">
|
<div class="tab-pane flexContainer stored-procedure-tab" data-bind="attr:{ id: tabId }" role="tabpanel">
|
||||||
<!-- Stored Procedure Tab Form - Start -->
|
<!-- Stored Procedure Tab Form - Start -->
|
||||||
<div class="storedTabForm flexContainer">
|
<div class="storedTabForm flexContainer">
|
||||||
<div class="formTitleFirst">Stored Procedure Id</div>
|
<div class="formTitleFirst">Stored Procedure Id</div>
|
||||||
|
@ -14,6 +14,7 @@ import { TabsManager } from "./TabsManager";
|
|||||||
|
|
||||||
// TODO: Use specific actions for logging telemetry data
|
// TODO: Use specific actions for logging telemetry data
|
||||||
export default class TabsBase extends WaitsForTemplateViewModel {
|
export default class TabsBase extends WaitsForTemplateViewModel {
|
||||||
|
private static id = 0;
|
||||||
public static readonly component = { name: "tab", template: "" };
|
public static readonly component = { name: "tab", template: "" };
|
||||||
public closeTabButton: ViewModels.Button;
|
public closeTabButton: ViewModels.Button;
|
||||||
public node: ViewModels.TreeNode;
|
public node: ViewModels.TreeNode;
|
||||||
@ -22,7 +23,7 @@ export default class TabsBase extends WaitsForTemplateViewModel {
|
|||||||
public rid: string;
|
public rid: string;
|
||||||
public hasFocus: ko.Observable<boolean>;
|
public hasFocus: ko.Observable<boolean>;
|
||||||
public isMouseOver: ko.Observable<boolean>;
|
public isMouseOver: ko.Observable<boolean>;
|
||||||
public tabId: string;
|
public tabId = `tab${TabsBase.id++}`;
|
||||||
public tabKind: ViewModels.CollectionTabKind;
|
public tabKind: ViewModels.CollectionTabKind;
|
||||||
public tabTitle: ko.Observable<string>;
|
public tabTitle: ko.Observable<string>;
|
||||||
public tabPath: ko.Observable<string>;
|
public tabPath: ko.Observable<string>;
|
||||||
@ -31,14 +32,11 @@ export default class TabsBase extends WaitsForTemplateViewModel {
|
|||||||
public isExecuting: ko.Observable<boolean>;
|
public isExecuting: ko.Observable<boolean>;
|
||||||
public pendingNotification?: ko.Observable<DataModels.Notification>;
|
public pendingNotification?: ko.Observable<DataModels.Notification>;
|
||||||
public manager?: TabsManager;
|
public manager?: TabsManager;
|
||||||
|
|
||||||
protected _theme: string;
|
protected _theme: string;
|
||||||
public onLoadStartKey: number;
|
public onLoadStartKey: number;
|
||||||
|
|
||||||
constructor(options: ViewModels.TabOptions) {
|
constructor(options: ViewModels.TabOptions) {
|
||||||
super();
|
super();
|
||||||
const id = new Date().getTime().toString();
|
|
||||||
|
|
||||||
this._theme = ThemeUtility.getMonacoTheme(options.theme);
|
this._theme = ThemeUtility.getMonacoTheme(options.theme);
|
||||||
this.node = options.node;
|
this.node = options.node;
|
||||||
this.collection = options.collection;
|
this.collection = options.collection;
|
||||||
@ -46,11 +44,10 @@ export default class TabsBase extends WaitsForTemplateViewModel {
|
|||||||
this.rid = options.rid || (this.collection && this.collection.rid) || "";
|
this.rid = options.rid || (this.collection && this.collection.rid) || "";
|
||||||
this.hasFocus = ko.observable<boolean>(false);
|
this.hasFocus = ko.observable<boolean>(false);
|
||||||
this.isMouseOver = ko.observable<boolean>(false);
|
this.isMouseOver = ko.observable<boolean>(false);
|
||||||
this.tabId = `tab${id}`;
|
|
||||||
this.tabKind = options.tabKind;
|
this.tabKind = options.tabKind;
|
||||||
this.tabTitle = ko.observable<string>(options.title);
|
this.tabTitle = ko.observable<string>(options.title);
|
||||||
this.tabPath =
|
this.tabPath =
|
||||||
(options.tabPath && ko.observable<string>(options.tabPath)) ||
|
ko.observable(options.tabPath ?? "") ||
|
||||||
(this.collection &&
|
(this.collection &&
|
||||||
ko.observable<string>(`${this.collection.databaseId}>${this.collection.id()}>${this.tabTitle()}`));
|
ko.observable<string>(`${this.collection.databaseId}>${this.collection.id()}>${this.tabTitle()}`));
|
||||||
this.isExecutionError = ko.observable<boolean>(false);
|
this.isExecutionError = ko.observable<boolean>(false);
|
||||||
|
@ -85,9 +85,7 @@
|
|||||||
<div class="tabPanesContainer">
|
<div class="tabPanesContainer">
|
||||||
<!-- ko foreach: openedTabs -->
|
<!-- ko foreach: openedTabs -->
|
||||||
<div class="tabs-container" data-bind="visible: $parent.activeTab() === $data">
|
<div class="tabs-container" data-bind="visible: $parent.activeTab() === $data">
|
||||||
<span
|
<span data-bind="component: { name: $data.constructor.component.name, params: $data }"></span>
|
||||||
data-bind="class: $data.constructor.component.name, component: { name: $data.constructor.component.name, params: $data }"
|
|
||||||
></span>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user