mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-05 05:42:16 +00:00
feat(console): Add organization ID filter to organization list (#9823)
<!-- Please inform yourself about the contribution guidelines on submitting a PR here: https://github.com/zitadel/zitadel/blob/main/CONTRIBUTING.md#submit-a-pull-request-pr. Take note of how PR/commit titles should be written and replace the template texts in the sections below. Don't remove any of the sections. It is important that the commit history clearly shows what is changed and why. Important: By submitting a contribution you agree to the terms from our Licensing Policy as described here: https://github.com/zitadel/zitadel/blob/main/LICENSING.md#community-contributions. --> # Which Problems Are Solved Replace this example text with a concise list of problems that this PR solves. - Organization list lacked the ability to filter by organization ID - No efficient method was provided for users to search organizations by ID # How the Problems Are Solved Replace this example text with a concise list of changes that this PR introduces. - Added organization ID filtering functionality to `filter-org.component.ts` - Added `ID` to the `SubQuery` enum - Added `ID` case handling to `changeCheckbox`, `setValue`, and `getSubFilter` methods - Added ID filter UI to `filter-org.component.html` - Added checkbox and text input field - Used translation key to display "Organization ID" label - Added new translation key to translation file (`en.json`) - Added `FILTER.ORGID` key with "Organization ID" value # Additional Changes Replace this example text with a concise list of additional changes that this PR introduces, that are not directly solving the initial problem but are related. - Maintained consistency with existing filtering functionality - Ensured intuitive user interface usability - Added new key while maintaining translation file structure # Additional Context Replace this example with links to related issues, discussions, discord threads, or other sources with more context. Use the Closing #issue syntax for issues that are resolved with this PR. - Closes #8792 - Discussion #xxx - Follow-up for PR #xxx - https://discord.com/channels/xxx/xxx --------- Co-authored-by: Marco A. <[email protected]>
This commit is contained in:
@@ -69,4 +69,19 @@
|
||||
</cnsl-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="id-query">
|
||||
<mat-checkbox id="id" class="cb" [checked]="getSubFilter(SubQuery.ID)" (change)="changeCheckbox(SubQuery.ID, $event)"
|
||||
>{{ 'FILTER.ORGID' | translate }}
|
||||
</mat-checkbox>
|
||||
<div class="subquery" *ngIf="getSubFilter(SubQuery.ID) as idq">
|
||||
<span class="nomethod cnsl-secondary-text">
|
||||
{{ 'FILTER.METHODS.1' | translate }}
|
||||
</span>
|
||||
|
||||
<cnsl-form-field class="filter-input-value">
|
||||
<input cnslInput name="value" [value]="idq.getId()" (change)="setValue(SubQuery.ID, idq, $event)" />
|
||||
</cnsl-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</cnsl-filter>
|
||||
|
||||
@@ -3,7 +3,14 @@ import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { take } from 'rxjs';
|
||||
import { TextQueryMethod } from 'src/app/proto/generated/zitadel/object_pb';
|
||||
import { OrgDomainQuery, OrgNameQuery, OrgQuery, OrgState, OrgStateQuery } from 'src/app/proto/generated/zitadel/org_pb';
|
||||
import {
|
||||
OrgDomainQuery,
|
||||
OrgNameQuery,
|
||||
OrgQuery,
|
||||
OrgState,
|
||||
OrgStateQuery,
|
||||
OrgIDQuery,
|
||||
} from 'src/app/proto/generated/zitadel/org_pb';
|
||||
import { UserNameQuery } from 'src/app/proto/generated/zitadel/user_pb';
|
||||
|
||||
import { FilterComponent } from '../filter/filter.component';
|
||||
@@ -12,6 +19,7 @@ enum SubQuery {
|
||||
NAME,
|
||||
STATE,
|
||||
DOMAIN,
|
||||
ID,
|
||||
}
|
||||
|
||||
@Component({
|
||||
@@ -61,6 +69,12 @@ export class FilterOrgComponent extends FilterComponent implements OnInit {
|
||||
orgDomainQuery.setMethod(filter.domainQuery.method);
|
||||
orgQuery.setDomainQuery(orgDomainQuery);
|
||||
return orgQuery;
|
||||
} else if (filter.idQuery) {
|
||||
const orgQuery = new OrgQuery();
|
||||
const orgIdQuery = new OrgIDQuery();
|
||||
orgIdQuery.setId(filter.idQuery.id);
|
||||
orgQuery.setIdQuery(orgIdQuery);
|
||||
return orgQuery;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
@@ -100,6 +114,13 @@ export class FilterOrgComponent extends FilterComponent implements OnInit {
|
||||
odq.setDomainQuery(dq);
|
||||
this.searchQueries.push(odq);
|
||||
break;
|
||||
case SubQuery.ID:
|
||||
const idq = new OrgIDQuery();
|
||||
idq.setId('');
|
||||
const oidq = new OrgQuery();
|
||||
oidq.setIdQuery(idq);
|
||||
this.searchQueries.push(oidq);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (subquery) {
|
||||
@@ -121,6 +142,12 @@ export class FilterOrgComponent extends FilterComponent implements OnInit {
|
||||
this.searchQueries.splice(index_pdn, 1);
|
||||
}
|
||||
break;
|
||||
case SubQuery.ID:
|
||||
const index_id = this.searchQueries.findIndex((q) => (q as OrgQuery).toObject().idQuery !== undefined);
|
||||
if (index_id > -1) {
|
||||
this.searchQueries.splice(index_id, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,6 +167,10 @@ export class FilterOrgComponent extends FilterComponent implements OnInit {
|
||||
(query as OrgDomainQuery).setDomain(value);
|
||||
this.filterChanged.emit(this.searchQueries ? this.searchQueries : []);
|
||||
break;
|
||||
case SubQuery.ID:
|
||||
(query as OrgIDQuery).setId(value);
|
||||
this.filterChanged.emit(this.searchQueries ? this.searchQueries : []);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,6 +197,13 @@ export class FilterOrgComponent extends FilterComponent implements OnInit {
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
case SubQuery.ID:
|
||||
const id = this.searchQueries.find((q) => (q as OrgQuery).toObject().idQuery !== undefined);
|
||||
if (id) {
|
||||
return (id as OrgQuery).getIdQuery();
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user