Skip to content

Commit

Permalink
Merge pull request #511 from TCourtneyOwen/add-outlook-sso-support
Browse files Browse the repository at this point in the history
Add Outlook host for Single-Sign-On
  • Loading branch information
TCourtneyOwen authored Jan 23, 2020
2 parents 195d748 + d5a97c2 commit b96a98a
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 29 deletions.
70 changes: 52 additions & 18 deletions src/app/config/projectProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
"branch": "yo-office",
"prerelease": "yo-office-prerelease"
}
}
},
"supportedHosts": [
"Excel",
"Onenote",
"Outlook",
"Powerpoint",
"Project",
"Word"]
},
"angular": {
"displayname": "Office Add-in Task Pane project using Angular framework",
Expand All @@ -28,7 +35,15 @@
"branch": "yo-office",
"prerelease": "yo-office-prerelease"
}
}
},
"supportedHosts": [
"Excel",
"Onenote",
"Outlook",
"Powerpoint",
"Project",
"Word"
]
},
"react": {
"displayname": "Office Add-in Task Pane project using React framework",
Expand All @@ -43,7 +58,15 @@
"branch": "yo-office",
"prerelease": "yo-office-prerelease"
}
}
},
"supportedHosts": [
"Excel",
"Onenote",
"Outlook",
"Powerpoint",
"Project",
"Word"
]
},
"single-sign-on": {
"displayname": "Office Add-in Task Pane project supporting single sign-on",
Expand All @@ -58,15 +81,29 @@
"branch": "yo-office",
"prerelease": "yo-office-prerelease"
}
}
},
"supportedHosts": [
"Excel",
"Outlook",
"Powerpoint",
"Word"
]
},
"manifest": {
"displayname": "Office Add-in project containing the manifest only",
"templates": {
"manifestonly": {
"repository": ""
}
}
},
"supportedHosts": [
"Excel",
"Onenote",
"Outlook",
"Powerpoint",
"Project",
"Word"
]
},
"excel-functions": {
"displayname": "Excel Custom Functions Add-in project",
Expand All @@ -81,33 +118,30 @@
"branch": "yo-office",
"prerelease": "yo-office-prerelease"
}
}
},
"supportedHosts": [
"Excel"
]
}
},
"hostTypes": {
"excel": {
"displayname": "Excel",
"repository": ""
"displayname": "Excel"
},
"onenote": {
"displayname": "OneNote",
"repository": ""
"displayname": "OneNote"
},
"outlook": {
"displayname": "Outlook",
"repository": ""
"displayname": "Outlook"
},
"powerpoint": {
"displayname": "PowerPoint",
"repository": ""
"displayname": "PowerPoint"
},
"project": {
"displayname": "Project",
"repository": ""
"displayname": "Project"
},
"word": {
"displayname": "Word",
"repository": ""
"displayname": "Word"
}
}
}
12 changes: 4 additions & 8 deletions src/app/config/projectsJsonData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,11 @@ export default class projectsJsonData {
return this.m_projectJsonData.projectTypes[_.toLower(projectType)].templates.javascript != undefined && this.m_projectJsonData.projectTypes[_.toLower(projectType)].templates.typescript != undefined;
}

getHostTemplateNames(isSsoProject: boolean) {
getHostTemplateNames(projectType: string) {
let hosts: string[] = [];
for (let key in this.m_projectJsonData.hostTypes) {
if (isSsoProject) {
if (key === 'excel' || key === 'word' || key === 'powerpoint') {
hosts.push(this.m_projectJsonData.hostTypes[key].displayname);
}
} else {
hosts.push(this.m_projectJsonData.hostTypes[key].displayname);
for (let key in this.m_projectJsonData.projectTypes) {
if (key === projectType) {
hosts = this.m_projectJsonData.projectTypes[key].supportedHosts;
}
}
return hosts;
Expand Down
6 changes: 3 additions & 3 deletions src/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ module.exports = yo.extend({
/* Setup the generator */
constructor: function () {
if (parseInt(process.version.slice(1, process.version.indexOf('.'))) % 2 == 1) {
console.log(yosay('generator-office does not support your version of Node. Please switch to the latest LTS version of Node.'));
this._exitProcess();
console.log(yosay('generator-office does not support your version of Node. Please switch to the latest LTS version of Node.'));
this._exitProcess();
}
yo.apply(this, arguments);

Expand Down Expand Up @@ -206,7 +206,7 @@ module.exports = yo.extend({
message: 'Which Office client application would you like to support?',
type: 'list',
default: 'Excel',
choices: jsonData.getHostTemplateNames(isSsoProject).map(host => ({ name: host, value: host })),
choices: jsonData.getHostTemplateNames(answerForProjectType.projectType).map(host => ({ name: host, value: host })),
when: (this.options.host == null || this.options.host != null && !jsonData.isValidInput(this.options.host, true /* isHostParam */))
&& !isExcelFunctionsProject
}];
Expand Down

0 comments on commit b96a98a

Please sign in to comment.