Skip to content

Commit e5fd4af

Browse files
feat: add plugin store authentication configuration
- Introduced a new configuration field for plugin store authentication in `configSearchIndex.ts`. - Enhanced the `PluginStorePage` component to support installation options with version overrides and authentication rules. - Added a modal for configuring plugin installation options, including version input and authentication handling. - Implemented styles for the new installation options dialog and error handling in `PluginStorePage.module.scss`. - Updated the API service to handle plugin installation with optional authentication parameters. - Extended the visual configuration to include plugin store authentication rules, with serialization and parsing logic. - Added new translations for authentication-related fields in multiple languages. - Introduced types for plugin store authentication rules and platform support in TypeScript definitions.
1 parent 07a9c82 commit e5fd4af

14 files changed

Lines changed: 1006 additions & 32 deletions

src/components/config/VisualConfigEditor.module.scss

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,111 @@
211211
box-shadow: 0 1px 2px color-mix(in srgb, var(--text-primary) 10%, transparent);
212212
}
213213

214+
.storeAuthEditor {
215+
display: flex;
216+
flex-direction: column;
217+
gap: 10px;
218+
}
219+
220+
.storeAuthEmpty {
221+
margin: 0;
222+
color: var(--text-secondary);
223+
font-size: 13px;
224+
line-height: 1.5;
225+
}
226+
227+
.storeAuthRule {
228+
display: flex;
229+
flex-direction: column;
230+
gap: 12px;
231+
padding: 14px;
232+
border: 1px solid var(--border-color);
233+
border-radius: 8px;
234+
background: color-mix(in srgb, var(--bg-secondary) 42%, transparent);
235+
}
236+
237+
.storeAuthRuleHeader {
238+
display: flex;
239+
align-items: center;
240+
justify-content: space-between;
241+
gap: 12px;
242+
min-width: 0;
243+
244+
strong {
245+
min-width: 0;
246+
overflow: hidden;
247+
color: var(--text-primary);
248+
font-size: 13px;
249+
font-weight: 700;
250+
text-overflow: ellipsis;
251+
white-space: nowrap;
252+
}
253+
}
254+
255+
.storeAuthGrid {
256+
display: grid;
257+
grid-template-columns: repeat(2, minmax(0, 1fr));
258+
gap: 10px;
259+
260+
@include mobile {
261+
grid-template-columns: 1fr;
262+
}
263+
}
264+
265+
.storeAuthField {
266+
display: flex;
267+
min-width: 0;
268+
flex-direction: column;
269+
gap: 6px;
270+
271+
> span {
272+
color: var(--text-secondary);
273+
font-size: 12px;
274+
font-weight: 700;
275+
}
276+
}
277+
278+
.storeAuthApplyTo {
279+
display: flex;
280+
flex-direction: column;
281+
gap: 7px;
282+
283+
> span {
284+
color: var(--text-secondary);
285+
font-size: 12px;
286+
font-weight: 700;
287+
}
288+
289+
small {
290+
color: var(--text-tertiary);
291+
font-size: 12px;
292+
line-height: 1.45;
293+
}
294+
}
295+
296+
.storeAuthCheckboxes {
297+
display: flex;
298+
flex-wrap: wrap;
299+
gap: 8px;
300+
}
301+
302+
.storeAuthCheckbox {
303+
display: inline-flex;
304+
align-items: center;
305+
gap: 7px;
306+
min-height: 28px;
307+
color: var(--text-secondary);
308+
font-size: 12px;
309+
font-weight: 650;
310+
line-height: 1.4;
311+
312+
input {
313+
width: 14px;
314+
height: 14px;
315+
accent-color: var(--primary-color);
316+
}
317+
}
318+
214319
// ── Global field search (P1) ────────────────────────────────────────────────
215320
.searchBox {
216321
position: relative;

src/components/config/VisualConfigEditor.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import type {
3232
PayloadFilterRule,
3333
PayloadParamValidationErrorCode,
3434
PayloadRule,
35+
PluginStoreAuthRule,
3536
VisualConfigFieldPath,
3637
VisualConfigValidationErrorCode,
3738
VisualConfigValidationErrors,
@@ -41,6 +42,7 @@ import {
4142
ApiKeysCardEditor,
4243
PayloadFilterRulesEditor,
4344
PayloadRulesEditor,
45+
PluginStoreAuthEditor,
4446
StringListEditor,
4547
} from './VisualConfigEditorBlocks';
4648
import {
@@ -371,6 +373,10 @@ export function VisualConfigEditor({
371373
(pluginStoreSources: string[]) => onChange({ pluginStoreSources }),
372374
[onChange]
373375
);
376+
const handlePluginStoreAuthChange = useCallback(
377+
(pluginStoreAuth: PluginStoreAuthRule[]) => onChange({ pluginStoreAuth }),
378+
[onChange]
379+
);
374380
const handlePayloadDefaultRulesChange = useCallback(
375381
(payloadDefaultRules: PayloadRule[]) => onChange({ payloadDefaultRules }),
376382
[onChange]
@@ -1533,6 +1539,26 @@ export function VisualConfigEditor({
15331539
</div>
15341540
</SectionSubsection>
15351541
</FieldAnchor>
1542+
1543+
<FieldAnchor fieldId="pluginStoreAuth">
1544+
<SectionSubsection
1545+
title={t('config_management.visual.sections.system.plugin_store_auth')}
1546+
description={t(
1547+
'config_management.visual.sections.system.plugin_store_auth_desc'
1548+
)}
1549+
>
1550+
<div className={styles.fieldShell}>
1551+
<div className={styles.fieldHint}>
1552+
{t('config_management.visual.sections.system.plugin_store_auth_hint')}
1553+
</div>
1554+
<PluginStoreAuthEditor
1555+
value={values.pluginStoreAuth}
1556+
disabled={disabled}
1557+
onChange={handlePluginStoreAuthChange}
1558+
/>
1559+
</div>
1560+
</SectionSubsection>
1561+
</FieldAnchor>
15361562
</SectionStack>
15371563
</Collapsible>
15381564

0 commit comments

Comments
 (0)