feat(api, agents): add agent node profile retrieval and update functionality
Implemented new API functions to fetch and update agent node profiles, enhancing the management capabilities for agent data. This addition improves the overall functionality of the admin agents console, allowing for better user interaction with agent profiles. Updated related types for improved type safety and clarity in the codebase.
This commit is contained in:
@@ -139,7 +139,14 @@ function formToPayload(
|
||||
return base;
|
||||
}
|
||||
|
||||
export function IntegrationSitesConsole() {
|
||||
type IntegrationSitesConsoleProps = {
|
||||
/** 代理线路内站点列表:仅超管可新建站点,普通账号走「开通线路」。 */
|
||||
restrictCreateToSuperAdmin?: boolean;
|
||||
};
|
||||
|
||||
export function IntegrationSitesConsole({
|
||||
restrictCreateToSuperAdmin = false,
|
||||
}: IntegrationSitesConsoleProps = {}) {
|
||||
const { t } = useTranslation("config");
|
||||
const tRef = useTranslationRef("config");
|
||||
const profile = useAdminProfile();
|
||||
@@ -147,6 +154,9 @@ export function IntegrationSitesConsole() {
|
||||
profile?.permissions,
|
||||
getAdminPageBundle("integration-sites", "manage"),
|
||||
);
|
||||
const canCreate =
|
||||
canManage &&
|
||||
(!restrictCreateToSuperAdmin || profile?.is_super_admin === true);
|
||||
|
||||
const [items, setItems] = useState<AdminIntegrationSiteRow[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -346,7 +356,7 @@ export function IntegrationSitesConsole() {
|
||||
title={t("integrationSites.title")}
|
||||
description={t("integrationSites.description")}
|
||||
actions={
|
||||
canManage ? (
|
||||
canCreate ? (
|
||||
<Button type="button" onClick={openCreate}>
|
||||
{t("integrationSites.create")}
|
||||
</Button>
|
||||
@@ -445,7 +455,7 @@ export function IntegrationSitesConsole() {
|
||||
value={form.code}
|
||||
disabled={mode === "edit"}
|
||||
onChange={(e) => updateForm("code", e.target.value)}
|
||||
placeholder="partner-a"
|
||||
placeholder={t("integrationSites.placeholders.code")}
|
||||
/>
|
||||
{mode === "edit" ? (
|
||||
<p className="text-xs text-muted-foreground">{t("integrationSites.codeImmutable")}</p>
|
||||
@@ -456,6 +466,7 @@ export function IntegrationSitesConsole() {
|
||||
<Input
|
||||
id="is-name"
|
||||
value={form.name}
|
||||
placeholder={t("integrationSites.placeholders.name")}
|
||||
onChange={(e) => updateForm("name", e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
@@ -465,6 +476,7 @@ export function IntegrationSitesConsole() {
|
||||
<Input
|
||||
id="is-currency"
|
||||
value={form.currency_code}
|
||||
placeholder={t("integrationSites.placeholders.currency")}
|
||||
onChange={(e) => updateForm("currency_code", e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
@@ -486,6 +498,7 @@ export function IntegrationSitesConsole() {
|
||||
<Input
|
||||
id="is-wallet-url"
|
||||
value={form.wallet_api_url}
|
||||
placeholder={t("integrationSites.placeholders.walletApiUrl")}
|
||||
onChange={(e) => updateForm("wallet_api_url", e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
@@ -494,6 +507,7 @@ export function IntegrationSitesConsole() {
|
||||
<Input
|
||||
id="is-h5"
|
||||
value={form.lottery_h5_base_url}
|
||||
placeholder={t("integrationSites.placeholders.lotteryH5BaseUrl")}
|
||||
onChange={(e) => updateForm("lottery_h5_base_url", e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
@@ -504,7 +518,7 @@ export function IntegrationSitesConsole() {
|
||||
rows={3}
|
||||
value={form.iframe_allowed_origins}
|
||||
onChange={(e) => updateForm("iframe_allowed_origins", e.target.value)}
|
||||
placeholder="https://www.example.com"
|
||||
placeholder={t("integrationSites.placeholders.iframeOrigins")}
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
@@ -513,6 +527,7 @@ export function IntegrationSitesConsole() {
|
||||
id="is-notes"
|
||||
rows={2}
|
||||
value={form.notes}
|
||||
placeholder={t("integrationSites.placeholders.notes")}
|
||||
onChange={(e) => updateForm("notes", e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
@@ -581,7 +596,7 @@ export function IntegrationSitesConsole() {
|
||||
id="ct-player"
|
||||
value={connectivityPlayerId}
|
||||
onChange={(e) => setConnectivityPlayerId(e.target.value)}
|
||||
placeholder="10001"
|
||||
placeholder={t("integrationSites.placeholders.connectivityPlayerId")}
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
@@ -589,6 +604,7 @@ export function IntegrationSitesConsole() {
|
||||
<Input
|
||||
id="ct-currency"
|
||||
value={connectivityCurrency}
|
||||
placeholder={t("integrationSites.placeholders.currency")}
|
||||
onChange={(e) => setConnectivityCurrency(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user