-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(vendor): update @lightbase/internal-management
_This PR is created by sync and will be force-pushed daily. Overwriting any manual changes done to this PR._ - chore: migrate to NPM (lightbasenl/frontend-components#94) (lightbasenl/frontend-components@b363957) - chore(deps): bump the minor-prod group with 7 updates (lightbasenl/frontend-components#88) (lightbasenl/frontend-components@14e2493) - feat(internal-management): FF support tenant specific settings (lightbasenl/frontend-components#82) (lightbasenl/frontend-components@adf918c) - chore(deps): bump the minor-prod group with 5 updates (lightbasenl/frontend-components#81) (lightbasenl/frontend-components@69e5fe9) - chore(deps): bump the minor-prod group with 9 updates (lightbasenl/frontend-components#71) (lightbasenl/frontend-components@7eb3791) - chore(deps): update dependencies (lightbasenl/frontend-components#57) (lightbasenl/frontend-components@0e10900) - chore(deps): update dependencies (lightbasenl/frontend-components#54) (lightbasenl/frontend-components@090296e) - chore(deps): update dependencies (lightbasenl/frontend-components#52) (lightbasenl/frontend-components@d4ae062) - chore(deps): update dependencies (lightbasenl/frontend-components#51) (lightbasenl/frontend-components@b4b0600) - chore(deps): update dependencies (lightbasenl/frontend-components#48) (lightbasenl/frontend-components@19c4df1) - chore: test internal-management against the app router (lightbasenl/frontend-components#50) (lightbasenl/frontend-components@290efe6) - chore(internal-management): make RQ5 compatible (lightbasenl/frontend-components#49) (lightbasenl/frontend-components@1998c93) - chore(deps): update dependencies (lightbasenl/frontend-components#46) (lightbasenl/frontend-components@29ce2d6) - chore(deps): update dependencies (lightbasenl/frontend-components#44) (lightbasenl/frontend-components@4c3e680) - chore(deps): update dependencies (lightbasenl/frontend-components#35) (lightbasenl/frontend-components@d3f1651) - chore(deps): update dependencies (lightbasenl/frontend-components#34) (lightbasenl/frontend-components@ae456c4) - chore(deps): update dependencies (lightbasenl/frontend-components#32) (lightbasenl/frontend-components@c7b2f12) - chore(deps): update dependencies (lightbasenl/frontend-components#31) (lightbasenl/frontend-components@3ede89c) - chore(deps): update dependencies (lightbasenl/frontend-components#29) (lightbasenl/frontend-components@3e756c8) - chore(deps): update dependencies (lightbasenl/frontend-components#28) (lightbasenl/frontend-components@15a6b9b) - chore: update api spec & regenerate (lightbasenl/frontend-components#26) (lightbasenl/frontend-components@eb1193e) - chore(deps): update dependencies (lightbasenl/frontend-components#25) (lightbasenl/frontend-components@57ebe6b)- Failed to execute `npm run format`. Sync is not able to correct this, so human checks and fixes are necessary for this PR.
- Loading branch information
1 parent
039d225
commit 5d18e54
Showing
18 changed files
with
718 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
197 changes: 197 additions & 0 deletions
197
vendor/internal-management/src/components/EditTentantSettingsFFModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
import { Dialog, Portal, Transition } from "@headlessui/react"; | ||
import { Fragment, useState } from "react"; | ||
import { tw } from "twind"; | ||
import Button from "../components/Button"; | ||
import type { ManagementFeatureFlagItem } from "../generated/common/types"; | ||
import { useManagementFeatureFlagUpdate } from "../generated/managementFeatureFlag/reactQueries"; | ||
|
||
export default function EditTenantSettingsFFModal({ | ||
show, | ||
onClose, | ||
flag, | ||
tenants, | ||
}: { | ||
show: boolean; | ||
onClose: () => void; | ||
flag: ManagementFeatureFlagItem; | ||
tenants: string[]; | ||
}) { | ||
const { mutate, status, error } = useManagementFeatureFlagUpdate( | ||
{ | ||
onSuccess: () => { | ||
onClose(); | ||
}, | ||
}, | ||
{ invalidateQueries: true }, | ||
); | ||
|
||
const [tenantValues, setTenantValues] = useState({ | ||
...(flag.tenantValues ?? {}), | ||
}); | ||
|
||
return ( | ||
<Portal> | ||
<Transition.Root show={show} as={Fragment}> | ||
<Dialog as="div" className={tw`relative z-10`} onClose={onClose}> | ||
<Transition.Child | ||
as={Fragment} | ||
enter={tw`ease-out duration-300`} | ||
enterFrom={tw`opacity-0`} | ||
enterTo={tw`opacity-100`} | ||
leave={tw`ease-in duration-200`} | ||
leaveFrom={tw`opacity-100`} | ||
leaveTo={tw`opacity-0`} | ||
> | ||
<div className={tw`fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity`} /> | ||
</Transition.Child> | ||
|
||
<div className={tw`fixed inset-0 z-10 overflow-y-auto`}> | ||
<div | ||
className={tw`flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0`} | ||
> | ||
<Transition.Child | ||
as={Fragment} | ||
enter={tw`ease-out duration-300`} | ||
enterFrom={tw`opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95`} | ||
enterTo={tw`opacity-100 translate-y-0 sm:scale-100`} | ||
leave={tw`ease-in duration-200`} | ||
leaveFrom={tw`opacity-100 translate-y-0 sm:scale-100`} | ||
leaveTo={tw`opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95`} | ||
> | ||
<Dialog.Panel | ||
as="form" | ||
data-testid="TenantSettingsFeatureFlag.modal" | ||
onSubmit={e => { | ||
e.preventDefault(); | ||
mutate({ | ||
featureFlagId: flag.id, | ||
tenantValues, | ||
globalValue: flag.globalValue, | ||
description: flag.description, | ||
}); | ||
}} | ||
className={tw`relative w-full transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:max-w-lg`} | ||
> | ||
<div className={tw`bg-white`}> | ||
<div className={tw`border-b bg-white p-4 shadow-sm`}> | ||
<Dialog.Title className={tw`font-medium`}>Edit feature flag</Dialog.Title> | ||
</div> | ||
<div className={tw`p-4 sm:p-6`}> | ||
<div className={tw`space-y-4`}> | ||
{tenants.map((tenant, index) => ( | ||
<div key={`${flag.name}-${index}`} className={tw`group space-y-1`}> | ||
<h3 className={tw`mb-2 font-semibold text-sm text-gray-900`}>{tenant}</h3> | ||
<ul | ||
className={tw`items-center w-full text-sm font-medium text-gray-900 bg-white border border-gray-200 rounded-lg sm:flex`} | ||
> | ||
<li className={tw`w-full border-b border-gray-200 sm:border-b-0 sm:border-r`}> | ||
<div className={tw`flex items-center pl-3`}> | ||
<input | ||
id={`list-radio-${tenant}-${index}-global-value`} | ||
type="radio" | ||
name={`list-radio-${tenant}-${index}-global-value`} | ||
checked={!tenantValues.hasOwnProperty(tenant)} | ||
onClick={() => { | ||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */ | ||
const { [tenant]: remove, ...rest } = tenantValues; | ||
setTenantValues(rest); | ||
}} | ||
className={tw`w-4 h-4 text-blue-600 bg-gray-100 border-gray-300`} | ||
/> | ||
<label | ||
htmlFor={`list-radio-${tenant}-${index}-global-value`} | ||
className={tw`w-full py-3 ml-2 text-sm font-medium text-gray-900 select-none`} | ||
> | ||
Global value | ||
</label> | ||
</div> | ||
</li> | ||
<li className={tw`w-full border-b border-gray-200 sm:border-b-0 sm:border-r`}> | ||
<div className={tw`flex items-center pl-3`}> | ||
<input | ||
id={`list-radio-${tenant}-${index}-enabled`} | ||
type="radio" | ||
name={`list-radio-${tenant}-${index}-enabled`} | ||
checked={tenantValues.hasOwnProperty(tenant) && tenantValues[tenant]} | ||
onClick={() => setTenantValues({ ...tenantValues, [tenant]: true })} | ||
className={tw`w-4 h-4 text-blue-600 bg-gray-100 border-gray-300`} | ||
/> | ||
<label | ||
htmlFor={`list-radio-${tenant}-${index}-enabled`} | ||
className={tw`w-full py-3 ml-2 text-sm font-medium text-gray-900 select-none`} | ||
> | ||
Enabled | ||
</label> | ||
</div> | ||
</li> | ||
<li className={tw`w-full border-b border-gray-200 sm:border-b-0`}> | ||
<div className={tw`flex items-center pl-3`}> | ||
<input | ||
id={`list-radio-${tenant}-${index}-disabled`} | ||
type="radio" | ||
name={`list-radio-${tenant}-${index}-disabled`} | ||
checked={tenantValues.hasOwnProperty(tenant) && !tenantValues[tenant]} | ||
onClick={() => setTenantValues({ ...tenantValues, [tenant]: false })} | ||
className={tw`w-4 h-4 text-blue-600 bg-gray-100 border-gray-300`} | ||
/> | ||
<label | ||
htmlFor={`list-radio-${tenant}-${index}-disabled`} | ||
className={tw`w-full py-3 ml-2 text-sm font-medium text-gray-900 select-none`} | ||
> | ||
Disabled | ||
</label> | ||
</div> | ||
</li> | ||
</ul> | ||
</div> | ||
))} | ||
{!!error && ( | ||
<div className={tw`rounded-md bg-red-50`}> | ||
<p className={tw`p-4 text-sm font-medium text-red-800`} role="alert"> | ||
Something went wrong | ||
</p> | ||
{!!error.response?.data && ( | ||
<div | ||
className={tw`max-h-[100px] overflow-y-auto p-4 shadow-inner`} | ||
aria-hidden="true" | ||
> | ||
<pre className={tw`whitespace-pre-line text-sm text-red-800`}> | ||
{JSON.stringify(error.response.data)} | ||
</pre> | ||
</div> | ||
)} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
<div className={tw`border-t px-4 py-3 sm:flex sm:flex-row-reverse sm:px-6`}> | ||
<Button | ||
data-testid="TenantSettingsFeatureFlag.modal.submit" | ||
type="submit" | ||
isLoading={ | ||
// Compatible between RQ4 & RQ5 | ||
["loading", "pending"].includes(status as string) | ||
} | ||
> | ||
Save | ||
</Button> | ||
<Button | ||
variant="default" | ||
className={tw`ml-2 lg:ml-0 lg:mr-2`} | ||
onClick={() => { | ||
onClose(); | ||
}} | ||
> | ||
Cancel | ||
</Button> | ||
</div> | ||
</Dialog.Panel> | ||
</Transition.Child> | ||
</div> | ||
</div> | ||
</Dialog> | ||
</Transition.Root> | ||
</Portal> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
vendor/internal-management/src/generated/auth/apiClient.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.