From 708273eb84e2ab4da47a90ae67d1ab78034e2b31 Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Mon, 14 Oct 2024 11:40:47 -0700 Subject: [PATCH 1/2] Revert Icon Url Change --- .../css/shared/language-customizations.scss | 108 +++++++++--------- .../APIView/ClientSPA/workbox-config.js | 63 +++++----- 2 files changed, 91 insertions(+), 80 deletions(-) diff --git a/src/dotnet/APIView/APIViewWeb/Client/css/shared/language-customizations.scss b/src/dotnet/APIView/APIViewWeb/Client/css/shared/language-customizations.scss index 8bd6fd277ac..c5bcb41e33d 100644 --- a/src/dotnet/APIView/APIViewWeb/Client/css/shared/language-customizations.scss +++ b/src/dotnet/APIView/APIViewWeb/Client/css/shared/language-customizations.scss @@ -8,230 +8,230 @@ .java-variant { &.icon-assembly { - background: url(~@wwwroot/icons/java/common/assembly.svg) center left no-repeat !important; + background: url(/icons/java/common/assembly.svg) center left no-repeat !important; } &.icon-gradle { - background: url(~@wwwroot/icons/java/common/gradle.svg) center left no-repeat !important; + background: url(/icons/java/common/gradle.svg) center left no-repeat !important; } &.icon-maven { - background: url(~@wwwroot/icons/java/common/maven.svg) center left no-repeat !important; + background: url(/icons/java/common/maven.svg) center left no-repeat !important; } &.icon-namespace { - background: url(~@wwwroot/icons/java/common/namespace.svg) center left no-repeat !important; + background: url(/icons/java/common/namespace.svg) center left no-repeat !important; } &.icon-spring { - background: url(~@wwwroot/icons/java/common/spring.svg) center left no-repeat !important; + background: url(/icons/java/common/spring.svg) center left no-repeat !important; } &.icon-unknown { - background: url(~@wwwroot/icons/java/common/unknown.svg) center left no-repeat !important; + background: url(/icons/java/common/unknown.svg) center left no-repeat !important; } &.icon-android { - background: url(~@wwwroot/icons/java/common/android.svg) center left no-repeat !important; + background: url(/icons/java/common/android.svg) center left no-repeat !important; } &.icon-annotation { - background: url(~@wwwroot/icons/java/java/annotation.svg) center left no-repeat !important; + background: url(/icons/java/java/annotation.svg) center left no-repeat !important; } &.icon-class { - background: url(~@wwwroot/icons/java/java/class.svg) center left no-repeat !important; + background: url(/icons/java/java/class.svg) center left no-repeat !important; } &.icon-enum { - background: url(~@wwwroot/icons/java/java/enum.svg) center left no-repeat !important; + background: url(/icons/java/java/enum.svg) center left no-repeat !important; } &.icon-interface { - background: url(~@wwwroot/icons/java/java/interface.svg) center left no-repeat !important; + background: url(/icons/java/java/interface.svg) center left no-repeat !important; } &.icon-module { - background: url(~@wwwroot/icons/java/common/module.svg) center left no-repeat !important; + background: url(/icons/java/common/module.svg) center left no-repeat !important; } } .kotlin-variant { &.icon-assembly { - background: url(~@wwwroot/icons/java/common/assembly.svg) center left no-repeat !important; + background: url(/icons/java/common/assembly.svg) center left no-repeat !important; } &.icon-gradle { - background: url(~@wwwroot/icons/java/common/gradle.svg) center left no-repeat !important; + background: url(/icons/java/common/gradle.svg) center left no-repeat !important; } &.icon-maven { - background: url(~@wwwroot/icons/java/common/maven.svg) center left no-repeat !important; + background: url(/icons/java/common/maven.svg) center left no-repeat !important; } &.icon-namespace { - background: url(~@wwwroot/icons/java/common/namespace.svg) center left no-repeat !important; + background: url(/icons/java/common/namespace.svg) center left no-repeat !important; } &.icon-spring { - background: url(~@wwwroot/icons/java/common/spring.svg) center left no-repeat !important; + background: url(/icons/java/common/spring.svg) center left no-repeat !important; } &.icon-unknown { - background: url(~@wwwroot/icons/java/common/unknown.svg) center left no-repeat !important; + background: url(/icons/java/common/unknown.svg) center left no-repeat !important; } &.icon-android { - background: url(~@wwwroot/icons/java/common/android.svg) center left no-repeat !important; + background: url(/icons/java/common/android.svg) center left no-repeat !important; } &.icon-annotation { - background: url(~@wwwroot/icons/java/kotlin/annotation.svg) center left no-repeat !important; + background: url(/icons/java/kotlin/annotation.svg) center left no-repeat !important; } &.icon-class { - background: url(~@wwwroot/icons/java/kotlin/class.svg) center left no-repeat !important; + background: url(/icons/java/kotlin/class.svg) center left no-repeat !important; } &.icon-enum { - background: url(~@wwwroot/icons/java/kotlin/enum.svg) center left no-repeat !important; + background: url(/icons/java/kotlin/enum.svg) center left no-repeat !important; } &.icon-interface { - background: url(~@wwwroot/icons/java/kotlin/interface.svg) center left no-repeat !important; + background: url(/icons/java/kotlin/interface.svg) center left no-repeat !important; } &.icon-function { - background: url(~@wwwroot/icons/java/kotlin/function.svg) center left no-repeat !important; + background: url(/icons/java/kotlin/function.svg) center left no-repeat !important; } &.icon-kotlinLanguage { - background: url(~@wwwroot/icons/java/kotlin/kotlinLanguage.svg) center left no-repeat !important; + background: url(/icons/java/kotlin/kotlinLanguage.svg) center left no-repeat !important; } &.icon-object { - background: url(~@wwwroot/icons/java/kotlin/object.svg) center left no-repeat !important; + background: url(/icons/java/kotlin/object.svg) center left no-repeat !important; } &.icon-property { - background: url(~@wwwroot/icons/java/kotlin/property.svg) center left no-repeat !important; + background: url(/icons/java/kotlin/property.svg) center left no-repeat !important; } &.icon-module { - background: url(~@wwwroot/icons/java/common/module.svg) center left no-repeat !important; + background: url(/icons/java/common/module.svg) center left no-repeat !important; } } .c-variant, .cplusplus-variant, .csharp-variant, .go-variant, .javascript-variant, .json-variant, .python-variant, .swagger-variant, .swift-variant, .xml-variant { &.icon-class { - background: url(~@wwwroot/icons/class.png) center left no-repeat; + background: url(/icons/class.png) center left no-repeat; } &.icon-interface { - background: url(~@wwwroot/icons/interface.png) center left no-repeat; + background: url(/icons/interface.png) center left no-repeat; } &.icon-struct { - background: url(~@wwwroot/icons/struct.png) center left no-repeat; + background: url(/icons/struct.png) center left no-repeat; } &.icon-enum { - background: url(~@wwwroot/icons/enum.png) center left no-repeat; + background: url(/icons/enum.png) center left no-repeat; } &.icon-delegate { - background: url(~@wwwroot/icons/delegate.png) center left no-repeat; + background: url(/icons/delegate.png) center left no-repeat; } &.icon-unknown { - background: url(~@wwwroot/icons/type.png) center left no-repeat; + background: url(/icons/type.png) center left no-repeat; } &.icon-assembly { - background: url(~@wwwroot/icons/assembly.png) center left no-repeat; + background: url(/icons/assembly.png) center left no-repeat; } &.icon-namespace { - background: url(~@wwwroot/icons/namespace.png) center left no-repeat; + background: url(/icons/namespace.png) center left no-repeat; } &.icon-package { - background: url(~@wwwroot/icons/package.png) center left no-repeat; + background: url(/icons/package.png) center left no-repeat; } &.icon-method { - background: url(~@wwwroot/icons/method.png) center left no-repeat; + background: url(/icons/method.png) center left no-repeat; } } .icon-csharp { @extend .icon-language; - background: url(~@wwwroot/icons/csharp-original.svg) center no-repeat; + background: url(/icons/csharp-original.svg) center no-repeat; } .icon-javascript { @extend .icon-language; - background: url(~@wwwroot/icons/javascript-original.svg) center no-repeat; + background: url(/icons/javascript-original.svg) center no-repeat; } .icon-python { @extend .icon-language; - background: url(~@wwwroot/icons/python-original.svg) center no-repeat; + background: url(/icons/python-original.svg) center no-repeat; } .icon-c { @extend .icon-language; - background: url(~@wwwroot/icons/c-original.svg) center no-repeat; + background: url(/icons/c-original.svg) center no-repeat; } .icon-cplusplus { @extend .icon-language; - background: url(~@wwwroot/icons/cplusplus-original.svg) center no-repeat; + background: url(/icons/cplusplus-original.svg) center no-repeat; } .icon-go { @extend .icon-language; - background: url(~@wwwroot/icons/go-original.svg) center no-repeat; + background: url(/icons/go-original.svg) center no-repeat; } .icon-java { @extend .icon-language; - background: url(~@wwwroot/icons/java-original.svg) center no-repeat; + background: url(/icons/java-original.svg) center no-repeat; } .icon-java-spring { @extend .icon-language; - background: url(~@wwwroot/icons/java-spring-original.svg) center no-repeat; + background: url(/icons/java-spring-original.svg) center no-repeat; } .icon-java-android { @extend .icon-language; - background: url(~@wwwroot/icons/java-android-original.svg) center no-repeat; + background: url(/icons/java-android-original.svg) center no-repeat; } .icon-swift { @extend .icon-language; - background: url(~@wwwroot/icons/swift-original.svg) center no-repeat; + background: url(/icons/swift-original.svg) center no-repeat; } .icon-kotlin { @extend .icon-language; - background: url(~@wwwroot/icons/kotlin-original.svg) center no-repeat; + background: url(/icons/kotlin-original.svg) center no-repeat; } .icon-json { @extend .icon-language; - background: url(~@wwwroot/icons/json-original.svg) center no-repeat; + background: url(/icons/json-original.svg) center no-repeat; } .icon-swagger { @extend .icon-language; - background: url(~@wwwroot/icons/swagger-original.svg) center no-repeat; + background: url(/icons/swagger-original.svg) center no-repeat; } .icon-typespec { @extend .icon-language; - background: url(~@wwwroot/icons/typespec-original.svg) center center no-repeat; + background: url(/icons/typespec-original.svg) center center no-repeat; } .icon-comments { @@ -242,9 +242,9 @@ } .icon-chevron-right { - background: url(~@wwwroot/icons/chevron-right.svg) center no-repeat; + background: url(/icons/chevron-right.svg) center no-repeat; } .icon-chevron-up { - background: url(~@wwwroot/icons/chevron-up.svg) center no-repeat; + background: url(/icons/chevron-up.svg) center no-repeat; } \ No newline at end of file diff --git a/src/dotnet/APIView/ClientSPA/workbox-config.js b/src/dotnet/APIView/ClientSPA/workbox-config.js index 9eda708b0b6..34930eb9e91 100644 --- a/src/dotnet/APIView/ClientSPA/workbox-config.js +++ b/src/dotnet/APIView/ClientSPA/workbox-config.js @@ -1,27 +1,38 @@ +const version = 'v1.0.0'; +const staticCacheName = `static-${version}`; +const globPatterns = [ + 'favicon.ico', + 'index.html', + 'manifest.webmanifest', + '*.css', + '*.js', + 'assets/**/*.{svg,cur,jpg,jpeg,png,apng,webp,avif,gif,otf,ttf,woff,woff2,json}' +]; + module.exports = { - globDirectory: '../APIViewWeb/wwwroot/spa', - globPatterns: [ - 'favicon.ico', - 'index.html', - 'manifest.webmanifest', - '*.css', - '*.js', - 'assets/**/*.{svg,cur,jpg,jpeg,png,apng,webp,avif,gif,otf,ttf,woff,woff2,json}' - ], - swDest: '../APIViewWeb/wwwroot/spa/sw.js', - runtimeCaching: [ - { - urlPattern: "https://apiviewstagingtest.com/api/reviews/*/content**", - handler: 'CacheFirst', - options: { - cacheName: 'revisioncontent', - expiration: { - maxEntries: 50, - maxAgeSeconds: 24 * 60 * 60, // 1 day - }, - }, - } - ], - skipWaiting: true, - clientsClaim: true, - }; \ No newline at end of file + globDirectory: '../APIViewWeb/wwwroot/spa', + globPatterns: globPatterns, + swDest: '../APIViewWeb/wwwroot/spa/sw.js', + skipWaiting: true, + clientsClaim: true, + cleanupOutdatedCaches: true, +}; + +self.addEventListener('install', event => { + self.skipWaiting(); + event.waitUntil( + caches.keys().then(cacheNames => { + return Promise.all( + cacheNames.map(cacheName => caches.delete(cacheName)) + ); + }).then(() => { + return caches.open(staticCacheName).then(cache => { + return cache.addAll(globPatterns); + }); + }) + ); +}); + +self.addEventListener('activate', event => { + event.waitUntil(self.clients.claim()); +}); \ No newline at end of file From 636120843f8e50e93e006413ab20a6f3fbe58403 Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Mon, 14 Oct 2024 12:04:41 -0700 Subject: [PATCH 2/2] Version Service Worker Cache --- .../APIView/ClientSPA/workbox-config.js | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/src/dotnet/APIView/ClientSPA/workbox-config.js b/src/dotnet/APIView/ClientSPA/workbox-config.js index 34930eb9e91..ae51c014a0d 100644 --- a/src/dotnet/APIView/ClientSPA/workbox-config.js +++ b/src/dotnet/APIView/ClientSPA/workbox-config.js @@ -1,5 +1,4 @@ -const version = 'v1.0.0'; -const staticCacheName = `static-${version}`; +const version = process.env.BUILD_BUILDID || 'dev'; const globPatterns = [ 'favicon.ico', 'index.html', @@ -16,23 +15,7 @@ module.exports = { skipWaiting: true, clientsClaim: true, cleanupOutdatedCaches: true, -}; - -self.addEventListener('install', event => { - self.skipWaiting(); - event.waitUntil( - caches.keys().then(cacheNames => { - return Promise.all( - cacheNames.map(cacheName => caches.delete(cacheName)) - ); - }).then(() => { - return caches.open(staticCacheName).then(cache => { - return cache.addAll(globPatterns); - }); - }) - ); -}); - -self.addEventListener('activate', event => { - event.waitUntil(self.clients.claim()); -}); \ No newline at end of file + modifyURLPrefix: { + '': `?v=${version}` + } +}; \ No newline at end of file