Skip to content

Commit 16393c8

Browse files
committed
Integration updates: package details, inspect object for single/multiple variant(s) nodes.
1 parent 1ee257d commit 16393c8

File tree

6 files changed

+68
-32
lines changed

6 files changed

+68
-32
lines changed

src/Umbraco.Cms.Integrations.SEO.GoogleSearchConsole.UrlInspectionTool/App_Plugins/UmbracoCms.Integrations/SEO/GoogleSearchConsole/URLInspectionTool/js/url-inspection-tool.controller.js

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
vm.oauthConfiguration = {};
77
vm.inspectionResult = {};
88

9-
// get available cultures for current node
10-
vm.currentCultures = editorState.current.urls.map(p => p.culture);
11-
129
// build default url inspection object
13-
vm.siteUrl = location.href.slice(0, location.href.indexOf("umbraco") - 1);
14-
vm.urlInspection = {
15-
inspectionUrl: `${vm.siteUrl}${editorState.current.urls.find(p => p.culture === vm.currentCultures[0]).text}`,
16-
siteUrl: vm.siteUrl,
17-
languageCode: vm.currentCultures[0],
10+
vm.inspectionObj = {
11+
urls: editorState.current.urls,
12+
inspectionUrl: editorState.current.urls[0].text,
13+
siteUrl: window.location.origin,
14+
languageCode: editorState.current.urls[0].culture,
15+
multipleUrls: editorState.current.urls.length > 1,
1816
enabled: false
1917
};
2018

@@ -37,7 +35,7 @@
3735

3836
vm.loading = true;
3937

40-
umbracoCmsIntegrationsGoogleSearchConsoleUrlInspectionToolResource.inspect(vm.urlInspection.inspectionUrl, vm.urlInspection.siteUrl, vm.urlInspection.languageCode)
38+
umbracoCmsIntegrationsGoogleSearchConsoleUrlInspectionToolResource.inspect(vm.inspectionObj.inspectionUrl, vm.inspectionObj.siteUrl, vm.inspectionObj.languageCode)
4139
.then(function (response) {
4240

4341
vm.loading = false;
@@ -51,14 +49,7 @@
5149
vm.isConnected = false;
5250

5351
// refresh access token
54-
notificationsService.warning("Google Search Console Authorization", "Refreshing access token.");
55-
56-
umbracoCmsIntegrationsGoogleSearchConsoleUrlInspectionToolResource.refreshAccessToken().then(
57-
function(response) {
58-
if (response.length !== "error") {
59-
vm.isConnected = true;
60-
}
61-
});
52+
refreshAccessToken();
6253
}
6354
} else {
6455
vm.showResults = true;
@@ -68,12 +59,13 @@
6859
}
6960

7061
vm.onEdit = function() {
71-
vm.urlInspection.enabled = true;
62+
vm.inspectionObj.multipleUrls = false;
63+
vm.inspectionObj.enabled = true;
7264
}
7365

74-
vm.onChangeLanguageCode = function() {
75-
vm.urlInspection.inspectionUrl =
76-
`${vm.siteUrl}${editorState.current.urls.find(p => p.culture === vm.urlInspection.languageCode).text}`;
66+
vm.onChangeInspectionUrl = function() {
67+
vm.inspectionObj.languageCode =
68+
editorState.current.urls.find(p => p.text === vm.inspectionObj.inspectionUrl).culture;
7769
}
7870

7971
// authorization listener
@@ -103,6 +95,23 @@
10395

10496
}, false);
10597

98+
function refreshAccessToken() {
99+
notificationsService.warning("Google Search Console Authorization", "Refreshing access token.");
100+
101+
umbracoCmsIntegrationsGoogleSearchConsoleUrlInspectionToolResource.refreshAccessToken().then(
102+
function (response) {
103+
if (response.length !== "error") {
104+
105+
notificationsService.success("Google Search Console Authorization",
106+
"Refresh access token - completed.");
107+
108+
vm.isConnected = true;
109+
} else
110+
notificationsService.error("Google Search Console Authorization",
111+
"An error has occurred.");
112+
});
113+
}
114+
106115
function revokeToken() {
107116
umbracoCmsIntegrationsGoogleSearchConsoleUrlInspectionToolResource.revokeToken().then(function () {
108117
vm.oauthConfiguration.isConnected = false;

src/Umbraco.Cms.Integrations.SEO.GoogleSearchConsole.UrlInspectionTool/App_Plugins/UmbracoCms.Integrations/SEO/GoogleSearchConsole/URLInspectionTool/urlInspection.html

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,16 @@ <h5>About Google Search Console - URL Inspection API</h5>
4141
<div class="flex justify-start">
4242
<div class="w25r">
4343
<h5>Inspection URL</h5>
44-
<input type="text" class="w-100" ng-model="vm.urlInspection.inspectionUrl" no-dirty-check ng-disabled="!vm.urlInspection.enabled"/>
44+
<input type="text" class="w-100" ng-if="!vm.inspectionObj.multipleUrls" ng-model="vm.inspectionObj.inspectionUrl"
45+
no-dirty-check ng-disabled="!vm.inspectionObj.enabled" />
46+
<select ng-if="vm.inspectionObj.multipleUrls" ng-model="vm.inspectionObj.inspectionUrl" ng-change="vm.onChangeInspectionUrl()"
47+
no-dirty-check class="w-100">
48+
<option ng-repeat="url in vm.inspectionObj.urls" value="{{ url.text }}">{{ url.text }}</option>
49+
</select>
4550
</div>
4651
<div class="ml3 w25r">
4752
<h5>Site URL</h5>
48-
<input type="text" class="w-100" ng-model="vm.urlInspection.siteUrl" no-dirty-check ng-disabled="!vm.urlInspection.enabled"/>
49-
</div>
50-
<div class="ml3">
51-
<h5>Language Code</h5>
52-
<select ng-model="vm.urlInspection.languageCode" ng-change="vm.onChangeLanguageCode()">
53-
<option ng-repeat="item in vm.currentCultures" value="{{ item }}">{{ item }}</option>
54-
</select>
53+
<input type="text" class="w-100" ng-model="vm.inspectionObj.siteUrl" no-dirty-check ng-disabled="!vm.inspectionObj.enabled"/>
5554
</div>
5655
</div>
5756
</div>

src/Umbraco.Cms.Integrations.SEO.GoogleSearchConsole.UrlInspectionTool/Controllers/UrlInspectionApiController.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ public async Task<string> RefreshAccessToken()
113113
var tokenDto = JsonConvert.DeserializeObject<TokenDto>(result);
114114

115115
_tokenService.SaveParameters(_googleService.TokenDbKey, tokenDto.AccessToken);
116-
_tokenService.SaveParameters(_googleService.RefreshTokenDbKey, tokenDto.RefreshToken);
117116

118117
return result;
119118
}

src/Umbraco.Cms.Integrations.SEO.GoogleSearchConsole.UrlInspectionTool/Services/GoogleService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class GoogleService : BaseAuthService
88
/// local testing: https://localhost:44364/
99
/// deployed version: https://hubspot-forms-auth.umbraco.com/
1010
/// </summary>
11-
private const string AuthProxyBaseAddress = "https://localhost:44364/";
11+
private const string AuthProxyBaseAddress = "https://hubspot-forms-auth.umbraco.com/";
1212

1313
public const string AuthProxyServiceAuthEndpoint = "oauth/google";
1414

src/Umbraco.Cms.Integrations.SEO.GoogleSearchConsole.UrlInspectionTool/Umbraco.Cms.Integrations.SEO.GoogleSearchConsole.URLInspectionTool.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<PackageIconUrl></PackageIconUrl>
1111
<PackageProjectUrl>https://github.com/umbraco/Umbraco.Cms.Integrations</PackageProjectUrl>
1212
<RepositoryUrl>https://github.com/umbraco/Umbraco.Cms.Integrations</RepositoryUrl>
13-
<Version>1.0.0</Version>
13+
<Version>0.1.0</Version>
1414
<Authors>Umbraco HQ</Authors>
1515
<Company>Umbraco</Company>
1616
<ApplicationManifest>App_Plugins\UmbracoCms.Integrations\SEO\GoogleSearchConsole\URLInspectionTool\package.manifest</ApplicationManifest>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<umbPackage>
3+
<info>
4+
<package>
5+
<name>Umbraco.Cms.Integrations.SEO.GoogleSearchConsole.URLInspectionTool</name>
6+
<version>0.1.0</version>
7+
<iconUrl></iconUrl>
8+
<licence url="https://opensource.org/licenses/MIT">MIT</licence>
9+
<url>https://github.com/umbraco/Umbraco.Cms.Integrations</url>
10+
<requirements type="strict">
11+
<major>8</major>
12+
<minor>4</minor>
13+
<patch>0</patch>
14+
</requirements>
15+
</package>
16+
<author>
17+
<name>Umbraco HQ</name>
18+
<website>https://github.com/umbraco/Umbraco.Cms.Integrations</website>
19+
</author>
20+
<contributors>
21+
<contributor>Adrian Cojocariu</contributor>
22+
</contributors>
23+
<readme><![CDATA[An extension for Umbraco CMS providing programmatic access to URL-level data for properties managed in Search Console and the indexed version of a URL.]]></readme>
24+
</info>
25+
<files>
26+
<folder path="App_Plugins/UmbracoCms.Integrations/SEO/GoogleSearchConsole/URLInspectionTool" orgPath="App_Plugins/UmbracoCms.Integrations/SEO/GoogleSearchConsole/URLInspectionTool" />
27+
<file path="bin/release/net472/Umbraco.Cms.Integrations.SEO.GoogleSearchConsole.URLInspectionTool.dll" orgPath="bin/Umbraco.Cms.Integrations.SEO.GoogleSearchConsole.URLInspectionTool.dll" />
28+
</files>
29+
</umbPackage>

0 commit comments

Comments
 (0)