Skip to content

Commit

Permalink
doc: audit log
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitFicus committed Dec 14, 2024
1 parent cdadcf8 commit cee509c
Show file tree
Hide file tree
Showing 97 changed files with 509 additions and 296 deletions.
7 changes: 7 additions & 0 deletions izanami-frontend/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,10 @@ input[type="time"] {
.log-result-count {
color: var(--color_level3);
}

table .cm-merge-theme {
max-width: 73vw;
@media screen and (max-width: $screen-lg) {
max-width: 85vw;
}
}
48 changes: 27 additions & 21 deletions izanami-frontend/src/pages/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function Menu(props: {
const [selectedProject, selectProject] = React.useState<string | undefined>();
const tenantsQuery = useQuery({
queryKey: [MutationNames.TENANTS],
queryFn: () => queryTenants()
queryFn: () => queryTenants(),
});
const navigate = useNavigate();
const isAdmin = useAdmin();
Expand All @@ -54,7 +54,7 @@ export function Menu(props: {
const tenantQuery = useQuery({
queryKey: [tenantQueryKey(tenant!)],
queryFn: () => queryTenant(tenant!),
enabled: !!tenant
enabled: !!tenant,
});

if (tenantsQuery.isSuccess) {
Expand All @@ -69,27 +69,33 @@ export function Menu(props: {
<>
<ul className="nav flex-column">
<li className="w-100">
<>
{tenantsQuery.data.length > 1 || !tenant ? (
<>
<h3>
<i className="fas fa-cloud" aria-hidden></i> Tenant
</h3>
<div>
<Select
options={tenantsQuery.data.map((t) => ({
value: t.name,
label: t.name,
}))}
styles={customStyles}
value={tenant ? { value: tenant, label: tenant } : null}
placeholder="Select tenant..."
onChange={(v) => {
selectProject(undefined);
selectTenant(v!.value);
navigate(`/tenants/${v!.value}`);
}}
/>
</div>
</>
) : (
<h3>
<i className="fas fa-cloud" aria-hidden></i> Tenant
<i className="fas fa-cloud" aria-hidden></i> {tenant}
</h3>
<div>
<Select
options={tenantsQuery.data.map((t) => ({
value: t.name,
label: t.name,
}))}
styles={customStyles}
value={tenant ? { value: tenant, label: tenant } : null}
placeholder="Select tenant..."
onChange={(v) => {
selectProject(undefined);
selectTenant(v!.value);
navigate(`/tenants/${v!.value}`);
}}
/>
</div>
</>
)}
</li>
{tenant && (
<>
Expand Down
14 changes: 9 additions & 5 deletions izanami-frontend/src/utils/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { isArray } from "lodash";


export const featureEventTypeOptions = [{label: "Created", value: "FEATURE_CREATED"}, {label: "Updated", value: "FEATURE_UPDATED"}, {label: "Deleted", value: "FEATURE_DELETED"}] as const;
export type TFeatureEventTypes = (typeof featureEventTypeOptions)[number]["value"];
export const featureEventTypeOptions = [
{ label: "Created", value: "FEATURE_CREATED" },
{ label: "Updated", value: "FEATURE_UPDATED" },
{ label: "Deleted", value: "FEATURE_DELETED" },
] as const;
export type TFeatureEventTypes =
typeof featureEventTypeOptions[number]["value"];

export type ProjectLogSearchQuery = {
users: string[];
Expand All @@ -11,7 +15,7 @@ export type ProjectLogSearchQuery = {
begin?: Date;
end?: Date;
order: "asc" | "desc";
total: boolean,
total: boolean;
pageSize: number;
};

Expand Down Expand Up @@ -95,7 +99,7 @@ export interface TKey {
}

export interface TenantType extends TenantInCreationType {
id: string;
name: string;
projects?: TenantProjectType[];
tags?: TagType[];
}
Expand Down
5 changes: 3 additions & 2 deletions izanami-frontend/tests/screenshots/audit-logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export async function generate() {

await screenshot("natural-language-diff");
await page.getByLabel("Display JSON diff").click();
await page.getByRole("heading", { name: "Before" }).scrollIntoViewIfNeeded();
await page.getByRole("button", { name: "Close" }).scrollIntoViewIfNeeded();
await page.evaluate(() => window.scrollBy(0, -230));
await screenshot("json-diff");

await page.getByRole("button", { name: "Close" }).click();
Expand All @@ -70,4 +71,4 @@ export async function generate() {
await screenshot("search-form");
}

generate();
//generate();
2 changes: 2 additions & 0 deletions izanami-frontend/tests/screenshots/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { generate as userInvitationGenerate } from "./user-invitation";
import { generate as webhookGenerate } from "./webhooks";
import { generate as exportImportV2 } from "./export-import-v2";
import { generate as nonBooleanFeatureGenerate } from "./non-boolean-features";
import { generate as auditLogGenerate } from "./audit-logs";

async function generateAll() {
await apiKeyGenerate();
Expand All @@ -28,6 +29,7 @@ async function generateAll() {
await webhookGenerate();
await exportImportV2();
await nonBooleanFeatureGenerate();
await auditLogGenerate();
}

generateAll();
1 change: 1 addition & 0 deletions izanami-frontend/tests/screenshots/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export async function setup(shouldLogin) {
const context = await browser.newContext();
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
const page = await context.newPage();
page.setViewportSize({ width: 1440, height: 900 });

if (shouldLogin) {
await login(page);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import lunr from "/home/runner/work/izanami/izanami/manual/node_modules/lunr/lunr.js";
require("/home/runner/work/izanami/izanami/manual/node_modules/lunr-languages/lunr.stemmer.support.js")(lunr);
import lunr from "/Users/77199M/workspaces/oss/izanami/manual/node_modules/lunr/lunr.js";
require("/Users/77199M/workspaces/oss/izanami/manual/node_modules/lunr-languages/lunr.stemmer.support.js")(lunr);
require("@easyops-cn/docusaurus-search-local/dist/client/shared/lunrLanguageZh").lunrLanguageZh(lunr);
require("/home/runner/work/izanami/izanami/manual/node_modules/lunr-languages/lunr.multi.js")(lunr);
require("/Users/77199M/workspaces/oss/izanami/manual/node_modules/lunr-languages/lunr.multi.js")(lunr);
export const language = ["en","zh"];
export const removeDefaultStopWordFilter = false;
export const removeDefaultStemmer = false;
export { default as Mark } from "/home/runner/work/izanami/izanami/manual/node_modules/mark.js/dist/mark.js"
export const searchIndexUrl = "search-index{dir}.json?_=7765494f";
export { default as Mark } from "/Users/77199M/workspaces/oss/izanami/manual/node_modules/mark.js/dist/mark.js"
export const searchIndexUrl = "search-index{dir}.json?_=6a2baaaa";
export const searchResultLimits = 8;
export const searchResultContextMaxLength = 50;
export const explicitSearchResultPath = true;
Expand Down
8 changes: 4 additions & 4 deletions manual/.docusaurus/client-modules.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default [
require("/home/runner/work/izanami/izanami/manual/node_modules/infima/dist/css/default/default.css"),
require("/home/runner/work/izanami/izanami/manual/node_modules/@docusaurus/theme-classic/lib/prism-include-languages"),
require("/home/runner/work/izanami/izanami/manual/node_modules/@docusaurus/theme-classic/lib/nprogress"),
require("/home/runner/work/izanami/izanami/manual/src/css/custom.css"),
require("/Users/77199M/workspaces/oss/izanami/manual/node_modules/infima/dist/css/default/default.css"),
require("/Users/77199M/workspaces/oss/izanami/manual/node_modules/@docusaurus/theme-classic/lib/prism-include-languages"),
require("/Users/77199M/workspaces/oss/izanami/manual/node_modules/@docusaurus/theme-classic/lib/nprogress"),
require("/Users/77199M/workspaces/oss/izanami/manual/src/css/custom.css"),
];
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@
"href": "/izanami/docs/guides/personnal-access-tokens",
"docId": "guides/personnal-access-tokens",
"unlisted": false
},
{
"type": "link",
"label": "Audit logs",
"href": "/izanami/docs/guides/audit-logs",
"docId": "guides/audit-logs",
"unlisted": false
}
],
"href": "/izanami/docs/guides/"
Expand Down Expand Up @@ -278,6 +285,12 @@
"description": "This guide will help you to:",
"sidebar": "tutorialSidebar"
},
"guides/audit-logs": {
"id": "guides/audit-logs",
"title": "Audit logs",
"description": "Sometimes it's helpful to see what happened to a flag to understand why a feature was activated / deactivated.",
"sidebar": "tutorialSidebar"
},
"guides/bulk-feature-modification": {
"id": "guides/bulk-feature-modification",
"title": "Bulk feature modification",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
},
"sidebar": "tutorialSidebar",
"previous": {
"title": "Access tokens",
"permalink": "/izanami/docs/guides/personnal-access-tokens"
"title": "Audit logs",
"permalink": "/izanami/docs/guides/audit-logs"
},
"next": {
"title": "Java client",
Expand Down Expand Up @@ -212,6 +212,32 @@
"permalink": "/izanami/docs/concepts/"
}
},
{
"id": "guides/audit-logs",
"title": "Audit logs",
"description": "Sometimes it's helpful to see what happened to a flag to understand why a feature was activated / deactivated.",
"source": "@site/docs/04-guides/17-audit-logs.mdx",
"sourceDirName": "04-guides",
"slug": "/guides/audit-logs",
"permalink": "/izanami/docs/guides/audit-logs",
"draft": false,
"unlisted": false,
"tags": [],
"version": "current",
"sidebarPosition": 17,
"frontMatter": {
"title": "Audit logs"
},
"sidebar": "tutorialSidebar",
"previous": {
"title": "Access tokens",
"permalink": "/izanami/docs/guides/personnal-access-tokens"
},
"next": {
"title": "Clients",
"permalink": "/izanami/docs/clients/"
}
},
{
"id": "guides/bulk-feature-modification",
"title": "Bulk feature modification",
Expand Down Expand Up @@ -519,8 +545,8 @@
"permalink": "/izanami/docs/guides/non-boolean-features"
},
"next": {
"title": "Clients",
"permalink": "/izanami/docs/clients/"
"title": "Audit logs",
"permalink": "/izanami/docs/guides/audit-logs"
}
},
{
Expand Down Expand Up @@ -893,6 +919,10 @@
{
"type": "doc",
"id": "guides/personnal-access-tokens"
},
{
"type": "doc",
"id": "guides/audit-logs"
}
],
"link": {
Expand Down
5 changes: 5 additions & 0 deletions manual/.docusaurus/globalData.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
"path": "/izanami/docs/getstarted/",
"sidebar": "tutorialSidebar"
},
{
"id": "guides/audit-logs",
"path": "/izanami/docs/guides/audit-logs",
"sidebar": "tutorialSidebar"
},
{
"id": "guides/bulk-feature-modification",
"path": "/izanami/docs/guides/bulk-feature-modification",
Expand Down
Loading

0 comments on commit cee509c

Please sign in to comment.