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

fix:The Credential View displays a list that does not match the sub-tab #2055

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/components/backend-ai-credential-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export default class BackendAICredentialView extends BackendAIPage {
@property({ type: Number }) selectAreaHeight;
@property({ type: Boolean }) enableSessionLifetime = false;
@property({ type: Boolean }) enableParsingStoragePermissions = false;
@property({ type: String }) activeUserInnerTab = 'active';
@property({ type: String }) activeCredentialInnerTab = 'active';
@query('#active-credential-list')
activeCredentialList!: BackendAICredentialList;
@query('#inactive-credential-list')
Expand Down Expand Up @@ -761,15 +763,23 @@ export default class BackendAICredentialView extends BackendAIPage {
(
this.shadowRoot?.querySelector('#' + tab.title) as HTMLElement
).style.display = 'block';
let tabKeyword;
const tabKeyword = this._activeTab.substring(0, this._activeTab.length - 1); // to remove '-s'.
let innerTab;
// show inner tab(active) after selecting outer tab
switch (this._activeTab) {
case 'user-lists':
innerTab = this.shadowRoot?.querySelector(
'mwc-tab[title=' + this.activeUserInnerTab + '-' + tabKeyword + ']',
);
this._showList(innerTab);
break;
case 'credential-lists':
tabKeyword = this._activeTab.substring(0, this._activeTab.length - 1); // to remove '-s'.
innerTab = this.shadowRoot?.querySelector(
'mwc-tab[title=active-' + tabKeyword + ']',
'mwc-tab[title=' +
this.activeCredentialInnerTab +
'-' +
tabKeyword +
']',
);
this._showList(innerTab);
break;
Expand All @@ -793,6 +803,12 @@ export default class BackendAICredentialView extends BackendAIPage {
(
this.shadowRoot?.querySelector('#' + list.title) as HTMLElement
).style.display = 'block';
const splitTitle = list.title.split('-');
if (splitTitle[1] == 'user') {
this.activeUserInnerTab = splitTitle[0];
} else {
this.activeCredentialInnerTab = splitTitle[0];
}
const event = new CustomEvent('user-list-updated', {});
this.shadowRoot?.querySelector('#' + list.title)?.dispatchEvent(event);
}
Expand Down