web/satellite: remove unused references to meta config values

All values derived from meta tag config values have been removed.
They were unused because references to them were modified to instead
refer to the frontend config fetched through the satellite API.

References #5494

Change-Id: Iab6c5e18eac85e2f757e9e731e23239fa267ee0a
This commit is contained in:
Jeremy Wharton 2023-04-05 16:55:08 -05:00
parent e2abbc3800
commit 6e866856c4
7 changed files with 1 additions and 140 deletions

View File

@ -14,8 +14,6 @@
<script setup lang="ts">
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
import { PartneredSatellite } from '@/types/common';
import { MetaUtils } from '@/utils/meta';
import { useNotify } from '@/utils/hooks';
import { useAppStore } from '@/store/modules/appStore';
import ErrorPage from '@/views/ErrorPage.vue';
@ -75,43 +73,6 @@ onMounted(async (): Promise<void> => {
notify.error(error.message, null);
}
const satelliteName = MetaUtils.getMetaContent('satellite-name');
const partneredSatellitesData = MetaUtils.getMetaContent('partnered-satellites');
let partneredSatellitesJSON = [];
if (partneredSatellitesData) {
partneredSatellitesJSON = JSON.parse(partneredSatellitesData);
}
const isBetaSatellite = MetaUtils.getMetaContent('is-beta-satellite');
const couponCodeBillingUIEnabled = MetaUtils.getMetaContent('coupon-code-billing-ui-enabled');
const couponCodeSignupUIEnabled = MetaUtils.getMetaContent('coupon-code-signup-ui-enabled');
if (satelliteName) {
appStore.setSatelliteName(satelliteName);
if (partneredSatellitesJSON.length) {
const partneredSatellites: PartneredSatellite[] = [];
partneredSatellitesJSON.forEach((sat: PartneredSatellite) => {
// skip current satellite
if (sat.name !== satelliteName) {
partneredSatellites.push(sat);
}
});
appStore.setPartneredSatellites(partneredSatellites);
}
}
if (isBetaSatellite) {
appStore.setSatelliteStatus(isBetaSatellite === 'true');
}
if (couponCodeBillingUIEnabled) {
appStore.setCouponCodeBillingUIStatus(couponCodeBillingUIEnabled === 'true');
}
if (couponCodeSignupUIEnabled) {
appStore.setCouponCodeSignupUIStatus(couponCodeSignupUIEnabled === 'true');
}
fixViewportHeight();
isLoading.value = false;

View File

@ -5,7 +5,6 @@ import Vue from 'vue';
import Router from 'vue-router';
import { NavigationLink } from '@/types/navigation';
import { MetaUtils } from '@/utils/meta';
import AllDashboardArea from '@/views/all-dashboard/AllDashboardArea.vue';
import MyProjects from '@/views/all-dashboard/components/MyProjects.vue';
@ -115,8 +114,6 @@ export abstract class RouteConfig {
public static ShareObject = new NavigationLink('share-object', 'Onboarding Share Object');
public static SuccessScreen = new NavigationLink('success', 'Onboarding Success Screen');
public static FirstOnboardingStep = this.OverviewStep;
// objects child paths.
public static BucketsManagement = new NavigationLink('management', 'Buckets Management');
public static BucketsDetails = new NavigationLink('details', 'Bucket Details');
@ -124,10 +121,6 @@ export abstract class RouteConfig {
public static UploadFileChildren = new NavigationLink('*', 'Objects Upload Children');
}
if (MetaUtils.getMetaContent('pricing-packages-enabled') === 'true') {
RouteConfig.FirstOnboardingStep = RouteConfig.PricingPlanStep;
}
export const notProjectRelatedRoutes = [
RouteConfig.Login.name,
RouteConfig.Register.name,

View File

@ -4,7 +4,7 @@
import { reactive } from 'vue';
import { defineStore } from 'pinia';
import { OnboardingOS, PartneredSatellite, PricingPlanInfo } from '@/types/common';
import { OnboardingOS, PricingPlanInfo } from '@/types/common';
import { FetchState } from '@/utils/constants/fetchStateEnum';
import { ManageProjectPassphraseStep } from '@/types/managePassphrase';
import { FrontendConfig, FrontendConfigApi } from '@/types/config';
@ -42,12 +42,6 @@ class ErrorPageState {
export class State {
public viewsState: ViewsState = new ViewsState();
public satelliteName = '';
public partneredSatellites = new Array<PartneredSatellite>();
public isBetaSatellite = false;
public couponCodeBillingUIEnabled = false;
public couponCodeSignupUIEnabled = false;
public isAllProjectsDashboard = false;
public config: FrontendConfig = new FrontendConfig();
}
@ -60,7 +54,6 @@ export const useAppStore = defineStore('app', () => {
const result = await configApi.get();
state.config = result;
state.isAllProjectsDashboard = result.allProjectsDashboard;
return result;
}
@ -107,18 +100,6 @@ export const useAppStore = defineStore('app', () => {
state.viewsState.fetchState = newFetchState;
}
function setSatelliteName(satelliteName: string): void {
state.satelliteName = satelliteName;
}
function setPartneredSatellites(partneredSatellites: PartneredSatellite[]): void {
state.partneredSatellites = partneredSatellites;
}
function setSatelliteStatus(isBetaSatellite: boolean): void {
state.isBetaSatellite = isBetaSatellite;
}
function setOnboardingBackRoute(backRoute: string): void {
state.viewsState.onbAGStepBackRoute = backRoute;
}
@ -135,14 +116,6 @@ export const useAppStore = defineStore('app', () => {
state.viewsState.onbCleanApiKey = apiKey;
}
function setCouponCodeBillingUIStatus(couponCodeBillingUIEnabled: boolean): void {
state.couponCodeBillingUIEnabled = couponCodeBillingUIEnabled;
}
function setCouponCodeSignupUIStatus(couponCodeSignupUIEnabled: boolean): void {
state.couponCodeSignupUIEnabled = couponCodeSignupUIEnabled;
}
function setOnboardingOS(os: OnboardingOS): void {
state.viewsState.onbSelectedOs = os;
}
@ -198,15 +171,10 @@ export const useAppStore = defineStore('app', () => {
removeActiveModal,
toggleHasJustLoggedIn: toggleHasJustLoggenIn,
changeState,
setSatelliteName,
setPartneredSatellites,
setSatelliteStatus,
setOnboardingBackRoute,
setOnboardingAPIKeyStepBackRoute,
setOnboardingAPIKey,
setOnboardingCleanAPIKey,
setCouponCodeBillingUIStatus,
setCouponCodeSignupUIStatus,
setOnboardingOS,
setPricingPlan,
setManagePassphraseStep,

View File

@ -12,13 +12,6 @@ export enum OnboardingOS {
LINUX = 'linux',
}
export class PartneredSatellite {
constructor(
public name: string = '',
public address: string = '',
) {}
}
export class PricingPlanInfo {
constructor(
public type: PricingPlanType = PricingPlanType.FREE,

View File

@ -1,17 +0,0 @@
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
/**
* MetaUtils extracting content from meta.
*/
export class MetaUtils {
public static getMetaContent(metaName: string): string {
const meta = document.querySelector(`meta[name='${metaName}']`);
if (meta) {
return meta.getAttribute('content') as string;
}
return '';
}
}

View File

@ -1,15 +1,10 @@
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import { MetaUtils } from '@/utils/meta';
/**
* Validator holds validation check methods for strings.
*/
export class Validator {
public static readonly PASS_MIN_LENGTH = parseInt(MetaUtils.getMetaContent('password-minimum-length'));
public static readonly PASS_MAX_LENGTH = parseInt(MetaUtils.getMetaContent('password-maximum-length'));
/**
* Checks string to satisfy email rules.
*/
@ -19,15 +14,6 @@ export class Validator {
return rgx.test(email);
}
/**
* Checks string to satisfy password rules.
*/
public static password(password: string): boolean {
return typeof password !== 'undefined'
&& password.length >= this.PASS_MIN_LENGTH
&& password.length <= this.PASS_MAX_LENGTH;
}
/**
* Checks string to satisfy bucket name rules.
*/

View File

@ -4,29 +4,6 @@
import { Validator } from '@/utils/validation';
describe('validation', (): void => {
Object.defineProperties(Validator, {
PASS_MIN_LENGTH: { value: 6 },
PASS_MAX_LENGTH: { value: 128 },
});
it('password regex works correctly', (): void => {
const testString1 = 'test';
const testString2 = ' '.trim();
const testString3 = 'test %%%';
const testString4 = 'testtest';
const testString5 = 'test1233';
const testString6 = 'test1';
const testString7 = 'teSTt1123';
expect(Validator.password(testString1)).toBe(false);
expect(Validator.password(testString2)).toBe(false);
expect(Validator.password(testString3)).toBe(true);
expect(Validator.password(testString4)).toBe(true);
expect(Validator.password(testString5)).toBe(true);
expect(Validator.password(testString6)).toBe(false);
expect(Validator.password(testString7)).toBe(true);
});
it('email regex works correctly', () => {
const testString1 = 'test';
const testString2 = ' ';