Skip to content

Commit 94ab60e

Browse files
committed
fixup
1 parent 3e3e056 commit 94ab60e

File tree

3 files changed

+32
-12
lines changed

3 files changed

+32
-12
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,7 @@
469469
{
470470
"command": "spfx-toolkit.setFormCustomizer",
471471
"title": "Set Form Customizer",
472-
"category": "SharePoint Framework Toolkit",
473-
"icon": "$(file-code)"
472+
"category": "SharePoint Framework Toolkit"
474473
},
475474
{
476475
"command": "spfx-toolkit.showMoreActions",

src/panels/CommandPanel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ export class CommandPanel {
310310

311311
actionCommands.push(new ActionTreeItem('Add new component', '', { name: 'add', custom: false }, undefined, Commands.addToProject));
312312
actionCommands.push(new ActionTreeItem('Scaffold CI/CD Workflow', '', { name: 'rocket', custom: false }, undefined, Commands.pipeline));
313-
actionCommands.push(new ActionTreeItem('View samples', '', { name: 'library', custom: false }, undefined, Commands.samplesGallery));
314313
actionCommands.push(new ActionTreeItem('Set Form Customizer', '', { name: 'checklist', custom: false }, undefined, Commands.setFormCustomizer));
314+
actionCommands.push(new ActionTreeItem('View samples', '', { name: 'library', custom: false }, undefined, Commands.samplesGallery));
315315

316316
window.registerTreeDataProvider('pnp-view-actions', new ActionTreeDataProvider(actionCommands));
317317
}

src/services/actions/CliActions.ts

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -928,23 +928,43 @@ export class CliActions {
928928
* Sets the form customizer for a content type on a list.
929929
*/
930930
public static async setFormCustomizer() {
931-
const siteUrl = await window.showInputBox({
932-
prompt: 'Enter the site URL',
931+
const relativeUrl = await window.showInputBox({
932+
prompt: 'Enter the relative URL of the site',
933933
ignoreFocusOut: true,
934-
validateInput: (value) => value ? undefined : 'Site URL is required'
934+
placeHolder: 'e.g., sites/sales',
935+
validateInput: (input) => {
936+
if (!input) {
937+
return 'site URL is required';
938+
}
939+
940+
const trimmedInput = input.trim();
941+
942+
if (trimmedInput.startsWith('https://')) {
943+
return 'Please provide a relative URL, not an absolute URL.';
944+
}
945+
if (trimmedInput.startsWith('/')) {
946+
return 'Please provide a relative URL without a leading slash.';
947+
}
948+
949+
return undefined;
950+
}
935951
});
936952

937-
if (!siteUrl) {
953+
if (relativeUrl === undefined) {
954+
Notifications.warning('No site URL provided. Setting form customizer aborted.');
938955
return;
939956
}
940957

958+
const siteUrl = `${EnvironmentInformation.tenantUrl}/${relativeUrl.trim()}`;
959+
941960
const listTitle = await window.showInputBox({
942961
prompt: 'Enter the list title',
943962
ignoreFocusOut: true,
944963
validateInput: (value) => value ? undefined : 'List title is required'
945964
});
946965

947966
if (!listTitle) {
967+
Notifications.warning('No list title provided. Setting form customizer aborted.');
948968
return;
949969
}
950970

@@ -955,21 +975,22 @@ export class CliActions {
955975
});
956976

957977
if (!contentType) {
978+
Notifications.warning('No content type name provided. Setting form customizer aborted.');
958979
return;
959980
}
960981

961982
const editFormClientSideComponentId = await window.showInputBox({
962-
prompt: 'Enter the Edit form customizer (leave empty to skip)',
983+
prompt: 'Enter the Edit form customizer ID (leave empty to skip)',
963984
ignoreFocusOut: true
964985
});
965986

966-
const newFormClientSideComponentId = await window.showInputBox({
967-
prompt: 'Enter the New form customizer (leave empty to skip)',
987+
const newFormClientSideComponentId = await window.showInputBox({
988+
prompt: 'Enter the New form customizer ID (leave empty to skip)',
968989
ignoreFocusOut: true
969990
});
970991

971992
const displayFormClientSideComponentId = await window.showInputBox({
972-
prompt: 'Enter the View form customizer (leave empty to skip)',
993+
prompt: 'Enter the View form customizer ID (leave empty to skip)',
973994
ignoreFocusOut: true
974995
});
975996

@@ -984,7 +1005,7 @@ export class CliActions {
9841005
}
9851006

9861007
if (newFormClientSideComponentId ) {
987-
commandOptions.newFormCustomizer = newFormClientSideComponentId ;
1008+
commandOptions.NewFormClientSideComponentId = newFormClientSideComponentId ;
9881009
}
9891010

9901011
if (displayFormClientSideComponentId) {

0 commit comments

Comments
 (0)