Skip to content

Commit

Permalink
satellite/{console,web}: add config for billing information tab
Browse files Browse the repository at this point in the history
Add a feature flag for the billing information tab in billing.

Change-Id: I47b727ad1368e6d816bfc40f1129307827874824
  • Loading branch information
wilfred-asomanii authored and andriikotko committed May 9, 2024
1 parent d68abcf commit 712add7
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 55 deletions.
1 change: 1 addition & 0 deletions satellite/console/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type Config struct {
ObjectBrowserKeyNamePrefix string `help:"prefix for object browser API key names" default:".storj-web-file-browser-api-key-"`
ObjectBrowserKeyLifetime time.Duration `help:"duration for which the object browser API key remains valid" default:"72h"`
MaxNameCharacters int `help:"defines the maximum number of characters allowed for names, e.g. user first/last names and company names" default:"100"`
BillingInformationTabEnabled bool `help:"indicates if billing information tab should be enabled" default:"false"`
UsageLimits UsageLimitsConfig
Captcha CaptchaConfig
Session SessionConfig
Expand Down
1 change: 1 addition & 0 deletions satellite/console/consoleweb/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type FrontendConfig struct {
ObjectBrowserKeyNamePrefix string `json:"objectBrowserKeyNamePrefix"`
ObjectBrowserKeyLifetime time.Duration `json:"objectBrowserKeyLifetime"`
MaxNameCharacters int `json:"maxNameCharacters"`
BillingInformationTabEnabled bool `json:"billingInformationTabEnabled"`
}

// Satellites is a configuration value that contains a list of satellite names and addresses.
Expand Down
1 change: 1 addition & 0 deletions satellite/console/consoleweb/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,7 @@ func (server *Server) frontendConfigHandler(w http.ResponseWriter, r *http.Reque
ObjectBrowserKeyNamePrefix: server.config.ObjectBrowserKeyNamePrefix,
ObjectBrowserKeyLifetime: server.config.ObjectBrowserKeyLifetime,
MaxNameCharacters: server.config.MaxNameCharacters,
BillingInformationTabEnabled: server.config.BillingInformationTabEnabled,
}

err := json.NewEncoder(w).Encode(&cfg)
Expand Down
3 changes: 3 additions & 0 deletions satellite/satellite-config.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ compensation.withheld-percents: 75,75,75,50,50,50,25,25,25,0,0,0,0,0,0
# indicates if billing features should be enabled
# console.billing-features-enabled: true

# indicates if billing information tab should be enabled
# console.billing-information-tab-enabled: false

# url of the transaction block explorer
# console.block-explorer-url: https://etherscan.io/

Expand Down
104 changes: 51 additions & 53 deletions web/satellite/src/components/billing/BillingInformationTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,57 @@
// See LICENSE for copying information.

<template>
<v-container>
<v-row>
<v-col cols="12" lg="4">
<v-card :loading="isLoading" title="Address" variant="flat">
<v-card-text>
<v-chip v-if="!billingAddress" rounded color="default" variant="tonal" size="small" class="font-weight-bold">
No billing address added
</v-chip>
<template v-else>
<p>{{ billingAddress.name }}</p>
<p>{{ billingAddress.line1 }}</p>
<p>{{ billingAddress.line2 }}</p>
<p>{{ billingAddress.city }}</p>
<p>{{ billingAddress.state }}</p>
<p>{{ billingAddress.postalCode }}</p>
<p>{{ billingAddress.country.name }}</p>
</template>
<v-divider class="my-4" />
<v-btn variant="outlined" color="default" size="small" @click="isAddressDialogShown = true">
Update Address
</v-btn>
</v-card-text>
</v-card>
</v-col>
<v-col v-if="!taxIDs.length" cols="12" lg="4">
<v-card :loading="isLoading" title="Tax Information" variant="flat">
<v-card-text>
<v-chip rounded color="default" variant="tonal" size="small" class="font-weight-bold">
No tax information added
</v-chip>
<v-divider class="my-4" />
<v-btn variant="outlined" color="default" size="small" @click="isTaxIdDialogShown = true">
Add Tax ID
</v-btn>
</v-card-text>
</v-card>
</v-col>
<v-col v-for="(taxID, index) in taxIDs" v-else :key="index" cols="12" lg="4">
<v-card :title="taxID.tax.name" variant="flat">
<v-card-text>
<p>{{ taxID.value }}</p>
<v-divider class="my-4" />
<v-btn :loading="isLoading" class="mr-2" variant="outlined" color="error" size="small" @click="removeTaxID(taxID.id ?? '')">
Remove
</v-btn>
<v-btn v-if="index === taxIDs.length - 1" color="primary" size="small" @click="isTaxIdDialogShown = true">
Add Tax ID
</v-btn>
</v-card-text>
</v-card>
</v-col>
</v-row>
</v-container>
<v-row>
<v-col cols="12" lg="4">
<v-card :loading="isLoading" title="Address" variant="flat">
<v-card-text>
<v-chip v-if="!billingAddress" rounded color="default" variant="tonal" size="small" class="font-weight-bold">
No billing address added
</v-chip>
<template v-else>
<p>{{ billingAddress.name }}</p>
<p>{{ billingAddress.line1 }}</p>
<p>{{ billingAddress.line2 }}</p>
<p>{{ billingAddress.city }}</p>
<p>{{ billingAddress.state }}</p>
<p>{{ billingAddress.postalCode }}</p>
<p>{{ billingAddress.country.name }}</p>
</template>
<v-divider class="my-4" />
<v-btn variant="outlined" color="default" size="small" @click="isAddressDialogShown = true">
Update Address
</v-btn>
</v-card-text>
</v-card>
</v-col>
<v-col v-if="!taxIDs.length" cols="12" lg="4">
<v-card :loading="isLoading" title="Tax Information" variant="flat">
<v-card-text>
<v-chip rounded color="default" variant="tonal" size="small" class="font-weight-bold">
No tax information added
</v-chip>
<v-divider class="my-4" />
<v-btn variant="outlined" color="default" size="small" @click="isTaxIdDialogShown = true">
Add Tax ID
</v-btn>
</v-card-text>
</v-card>
</v-col>
<v-col v-for="(taxID, index) in taxIDs" v-else :key="index" cols="12" lg="4">
<v-card :title="taxID.tax.name" variant="flat">
<v-card-text>
<p>{{ taxID.value }}</p>
<v-divider class="my-4" />
<v-btn :loading="isLoading" class="mr-2" variant="outlined" color="error" size="small" @click="removeTaxID(taxID.id ?? '')">
Remove
</v-btn>
<v-btn v-if="index === taxIDs.length - 1" color="primary" size="small" @click="isTaxIdDialogShown = true">
Add Tax ID
</v-btn>
</v-card-text>
</v-card>
</v-col>
</v-row>
<add-tax-id-dialog v-model="isTaxIdDialogShown" />
<billing-address-dialog v-model="isAddressDialogShown" />
Expand Down
1 change: 1 addition & 0 deletions web/satellite/src/types/config.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class FrontendConfig {
objectBrowserKeyNamePrefix: string;
objectBrowserKeyLifetime: number;
maxNameCharacters: number;
billingInformationTabEnabled: boolean;
}

export class MultiCaptchaConfig {
Expand Down
5 changes: 3 additions & 2 deletions web/satellite/src/views/Billing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<v-tab>
Billing History
</v-tab>
<v-tab>
<v-tab v-if="billingInformationUIEnabled">
Billing Information
</v-tab>
</v-tabs>
Expand Down Expand Up @@ -197,7 +197,7 @@
<billing-history-tab />
</v-window-item>

<v-window-item>
<v-window-item v-if="billingInformationUIEnabled">
<billing-information-tab />
</v-window-item>
</v-window>
Expand Down Expand Up @@ -287,6 +287,7 @@ const creditCards = computed((): CreditCard[] => {
});
const couponCodeBillingUIEnabled = computed<boolean>(() => configStore.state.config.couponCodeBillingUIEnabled);
const billingInformationUIEnabled = computed<boolean>(() => configStore.state.config.billingInformationTabEnabled);
/**
* projectIDs is an array of all of the project IDs for which there exist project usage charges.
Expand Down

0 comments on commit 712add7

Please sign in to comment.