Skip to content

Add tenant app catalog & add/remove site app catalog. Closes #360 #453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,24 @@
"title": "Deploy project assets to Azure Storage",
"category": "SPFx Toolkit",
"icon": "$(cloud-upload)"
},
{
"command": "spfx-toolkit.addTenantAppCatalog",
"title": "Add Tenant App Catalog",
"category": "SharePoint Framework Toolkit",
"icon": "$(add)"
},
{
"command": "spfx-toolkit.addSiteAppCatalog",
"title": "Add Site App Catalog",
"category": "SharePoint Framework Toolkit",
"icon": "$(add)"
},
{
"command": "spfx-toolkit.removeSiteAppCatalog",
"title": "Remove Site App Catalog",
"category": "SharePoint Framework Toolkit",
"icon": "$(trash)"
}
],
"menus": {
Expand Down Expand Up @@ -906,6 +924,21 @@
"submenu": "spfx-toolkit.showMoreActions",
"when": "view == pnp-view-environment && viewItem == pnp.etv.hasAppCatalogApp",
"group": "inline@2"
},
{
"command": "spfx-toolkit.addTenantAppCatalog",
"when": "view == pnp-view-environment && viewItem == pnp.etv.hasNoAppCatalog",
"group": "inline"
},
{
"command": "spfx-toolkit.addSiteAppCatalog",
"when": "viewItem == sp-app-catalog-root",
"group": "inline"
},
{
"command": "spfx-toolkit.removeSiteAppCatalog",
"when": "viewItem == sp-app-catalog-url",
"group": "inline"
}
],
"spfx-toolkit.showMoreActions": [
Expand Down
5 changes: 5 additions & 0 deletions src/constants/Commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ export const Commands = {
uninstallAppCatalogApp: `${EXTENSION_NAME}.uninstallAppCatalogApp`,
showMoreActions: `${EXTENSION_NAME}.showMoreActions`,

// App Catalog actions
addTenantAppCatalog: `${EXTENSION_NAME}.addTenantAppCatalog`,
addSiteAppCatalog: `${EXTENSION_NAME}.addSiteAppCatalog`,
removeSiteAppCatalog: `${EXTENSION_NAME}.removeSiteAppCatalog`,

// Set form customizer
setFormCustomizer: `${EXTENSION_NAME}.setFormCustomizer`
};
1 change: 1 addition & 0 deletions src/constants/ContextKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export const ContextKeys = {
isSPFxProject: 'pnp.project.isSPFxProject',
isLoggedIn: 'pnp.project.isLoggedIn',
hasAppCatalog: 'pnp.project.hasAppCatalog',
hasNoAppCatalog: 'pnp.project.hasNoAppCatalog',
hasAppCatalogApp: 'pnp.etv.hasAppCatalogApp',
deployApp: 'pnp.etv.app.deploy',
retractApp: 'pnp.etv.app.retract',
Expand Down
14 changes: 8 additions & 6 deletions src/panels/CommandPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export class CommandPanel {
const environmentCommands: ActionTreeItem[] = [];

if (!appCatalogUrls) {
environmentCommands.push(new ActionTreeItem('No app catalog found', ''));
environmentCommands.push(new ActionTreeItem('Create an app catalog', '', { name: 'add', custom: false }, undefined, Commands.addTenantAppCatalog, ContextKeys.hasAppCatalogApp, 'sp-add-tenant-app-catalog'));
} else {
const tenantAppCatalogUrl = appCatalogUrls[0];
const origin = new URL(tenantAppCatalogUrl).origin;
Expand Down Expand Up @@ -199,7 +199,7 @@ export class CommandPanel {
const showTenantAppCatalogApps: boolean = getExtensionSettings<boolean>('showAppsInAppCatalogs', true);
const showExpandTreeIcon = showTenantAppCatalogApps ? TreeItemCollapsibleState.Collapsed : TreeItemCollapsibleState.None;

const tenantAppCatalogNode = new ActionTreeItem(tenantAppCatalogUrl.replace(origin, '...'), '', { name: 'globe', custom: false }, showExpandTreeIcon, 'vscode.open', `${Uri.parse(tenantAppCatalogUrl)}/AppCatalog`, 'sp-app-catalog-url', undefined,
const tenantAppCatalogNode = new ActionTreeItem(tenantAppCatalogUrl.replace(origin, '...'), '', { name: 'globe', custom: false }, showExpandTreeIcon, 'vscode.open', `${Uri.parse(tenantAppCatalogUrl)}/AppCatalog`, 'sp-tenant-app-catalog-url', undefined,
async () => {
const tenantAppCatalogApps = await CliActions.getAppCatalogApps();
const tenantAppCatalogAppsList: ActionTreeItem[] = [];
Expand Down Expand Up @@ -276,11 +276,13 @@ export class CommandPanel {
siteAppCatalogActionItems.push(siteAppCatalogNode);
}

if (siteAppCatalogActionItems.length > 0) {
environmentCommands.push(
new ActionTreeItem('Site App Catalogs', '', { name: 'spo-logo', custom: true }, TreeItemCollapsibleState.Collapsed, undefined, undefined, undefined, siteAppCatalogActionItems)
);
if (siteAppCatalogActionItems.length === 0) {
siteAppCatalogActionItems.push(new ActionTreeItem('No site app catalog found', ''));
}

environmentCommands.push(
new ActionTreeItem('Site App Catalogs', '', { name: 'spo-logo', custom: true }, TreeItemCollapsibleState.Collapsed, Commands.addSiteAppCatalog , undefined, 'sp-app-catalog-root', siteAppCatalogActionItems)
);
}

window.createTreeView('pnp-view-environment', { treeDataProvider: new ActionTreeDataProvider(environmentCommands), showCollapseAll: true });
Expand Down
Loading