Skip to content

Commit

Permalink
satellite/{web,console}: remove upload modal flag
Browse files Browse the repository at this point in the history
This change removes the config flag for the new upload modal.

Issue: #6515

Change-Id: I69612c6730f933d6320cb3c05995900eac98ac91
  • Loading branch information
wilfred-asomanii authored and Storj Robot committed Nov 30, 2023
1 parent e03091d commit 8568e49
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 113 deletions.
1 change: 0 additions & 1 deletion satellite/console/consoleweb/config.go
Expand Up @@ -45,7 +45,6 @@ type FrontendConfig struct {
PasswordMaximumLength int `json:"passwordMaximumLength"`
ABTestingEnabled bool `json:"abTestingEnabled"`
PricingPackagesEnabled bool `json:"pricingPackagesEnabled"`
NewUploadModalEnabled bool `json:"newUploadModalEnabled"`
GalleryViewEnabled bool `json:"galleryViewEnabled"`
NeededTransactionConfirmations int `json:"neededTransactionConfirmations"`
ObjectBrowserPaginationEnabled bool `json:"objectBrowserPaginationEnabled"`
Expand Down
2 changes: 0 additions & 2 deletions satellite/console/consoleweb/server.go
Expand Up @@ -105,7 +105,6 @@ type Config struct {
HomepageURL string `help:"url link to storj.io homepage" default:"https://www.storj.io"`
NativeTokenPaymentsEnabled bool `help:"indicates if storj native token payments system is enabled" default:"false"`
PricingPackagesEnabled bool `help:"whether to allow purchasing pricing packages" default:"false" devDefault:"true"`
NewUploadModalEnabled bool `help:"whether to show new upload modal" default:"false"`
GalleryViewEnabled bool `help:"whether to show new gallery view" default:"true"`
UseVuetifyProject bool `help:"whether to use vuetify POC project" default:"false"`
VuetifyHost string `help:"the subdomain the vuetify POC project should be hosted on" default:""`
Expand Down Expand Up @@ -749,7 +748,6 @@ func (server *Server) frontendConfigHandler(w http.ResponseWriter, r *http.Reque
PasswordMaximumLength: console.PasswordMaximumLength,
ABTestingEnabled: server.config.ABTesting.Enabled,
PricingPackagesEnabled: server.config.PricingPackagesEnabled,
NewUploadModalEnabled: server.config.NewUploadModalEnabled,
GalleryViewEnabled: server.config.GalleryViewEnabled,
NeededTransactionConfirmations: server.neededTokenPaymentConfirmations,
ObjectBrowserPaginationEnabled: server.config.ObjectBrowserPaginationEnabled,
Expand Down
3 changes: 0 additions & 3 deletions scripts/testdata/satellite-config.yaml.lock
Expand Up @@ -334,9 +334,6 @@ compensation.withheld-percents: 75,75,75,50,50,50,25,25,25,0,0,0,0,0,0
# indicates if storj native token payments system is enabled
# console.native-token-payments-enabled: false

# whether to show new upload modal
# console.new-upload-modal-enabled: false

# how long oauth access tokens are issued for
# console.oauth-access-token-expiry: 24h0m0s

Expand Down
60 changes: 0 additions & 60 deletions web/satellite/src/components/browser/FileBrowser.vue
Expand Up @@ -120,59 +120,6 @@
<file-browser-header />
</template>
<template #body>
<template v-if="!isNewUploadingModal">
<tr
v-for="(file, index) in formattedFilesUploading"
:key="index"
>
<!-- using <th> to comply with common Vtable.vue-->
<th class="hide-mobile icon" />
<th
class="align-left"
aria-roledescription="file-uploading"
>
<p class="file-name">
<file-icon />
<span>{{ filename(file) }}</span>
</p>
</th>
<th aria-roledescription="progress-bar">
<div class="progress">
<div
class="progress-bar"
role="progressbar"
:style="{
width: `${file.progress}%`
}"
>
{{ file.progress }}%
</div>
</div>
</th>
<th>
<v-button
width="60px"
font-size="14px"
label="Cancel"
is-deletion
:on-press="() => cancelUpload(file.Key)"
/>
</th>
<th class="hide-mobile" />
</tr>

<tr v-if="filesUploading.length" class="files-uploading-count">
<th class="hide-mobile files-uploading-count__content icon" />
<th class="align-left files-uploading-count__content" aria-roledescription="files-uploading-count">
{{ formattedFilesWaitingToBeUploaded }}
waiting to be uploaded...
</th>
<th class="hide-mobile files-uploading-count__content" />
<th class="hide-mobile files-uploading-count__content" />
<th class="files-uploading-count__content" />
</tr>
</template>

<up-entry v-if="path.length > 0" :on-back="onBack" />

<file-entry
Expand Down Expand Up @@ -306,13 +253,6 @@ const isPaginationEnabled = computed((): boolean => {
return configStore.state.config.objectBrowserPaginationEnabled;
});
/**
* Indicates if new objects uploading flow should be working.
*/
const isNewUploadingModal = computed((): boolean => {
return configStore.state.config.newUploadModalEnabled;
});
/**
* Retrieve the current path from the store.
*/
Expand Down
74 changes: 30 additions & 44 deletions web/satellite/src/store/modules/objectBrowserStore.ts
Expand Up @@ -179,11 +179,7 @@ export const useObjectBrowserStore = defineStore('objectBrowser', () => {
});

const uploadingLength = computed(() => {
if (config.state.config.newUploadModalEnabled) {
return state.uploading.filter(f => f.status === UploadingStatus.InProgress).length;
}

return state.uploading.length;
return state.uploading.filter(f => f.status === UploadingStatus.InProgress).length;
});

function setCursor(cursor: ObjectBrowserCursor): void {
Expand Down Expand Up @@ -536,34 +532,32 @@ export const useObjectBrowserStore = defineStore('objectBrowser', () => {
Body: body,
};

if (config.state.config.newUploadModalEnabled) {
if (state.uploading.some(f => f.Key === key && f.status === UploadingStatus.InProgress)) {
notifyError(`${key} is already uploading`, AnalyticsErrorEventSource.OBJECT_UPLOAD_ERROR);
return;
}
if (state.uploading.some(f => f.Key === key && f.status === UploadingStatus.InProgress)) {
notifyError(`${key} is already uploading`, AnalyticsErrorEventSource.OBJECT_UPLOAD_ERROR);
return;
}

appStore.setUploadingModal(true);
appStore.setUploadingModal(true);

const index = state.uploading.findIndex(file => file.Key === key);
if (index !== -1) {
state.uploading.splice(index, 1);
}
const index = state.uploading.findIndex(file => file.Key === key);
if (index !== -1) {
state.uploading.splice(index, 1);
}

// If file size exceeds 30 GB, abort the upload attempt
if (body.size > (30 * 1024 * 1024 * 1024)) {
state.uploading.push({
...params,
progress: 0,
Size: 0,
LastModified: new Date(),
Body: body,
status: UploadingStatus.Failed,
failedMessage: FailedUploadMessage.TooBig,
type: 'file',
});
// If file size exceeds 30 GB, abort the upload attempt
if (body.size > (30 * 1024 * 1024 * 1024)) {
state.uploading.push({
...params,
progress: 0,
Size: 0,
LastModified: new Date(),
Body: body,
status: UploadingStatus.Failed,
failedMessage: FailedUploadMessage.TooBig,
type: 'file',
});

return;
}
return;
}

// If file size exceeds 5 GB, show warning notification
Expand Down Expand Up @@ -642,25 +636,19 @@ export const useObjectBrowserStore = defineStore('objectBrowser', () => {
appStore.updateActiveModal(MODALS.objectDetails);
}
}

if (!config.state.config.newUploadModalEnabled) {
state.uploading = state.uploading.filter(file => file.Key !== key);
}
});
}

function handleUploadError(item: UploadingBrowserObject, error: Error): void {
if (error.name === 'AbortError' && item.status === UploadingStatus.Cancelled) return;

if (config.state.config.newUploadModalEnabled) {
item.status = UploadingStatus.Failed;
item.failedMessage = FailedUploadMessage.Failed;
item.status = UploadingStatus.Failed;
item.failedMessage = FailedUploadMessage.Failed;

// If file size exceeds 1 GB, show warning notification.
if (item.Size > (1024 * 1024 * 1024)) {
const appStore = useAppStore();
appStore.setLargeUploadWarningNotification(true);
}
// If file size exceeds 1 GB, show warning notification.
if (item.Size > (1024 * 1024 * 1024)) {
const appStore = useAppStore();
appStore.setLargeUploadWarningNotification(true);
}

const { notifyError } = useNotificationsStore();
Expand Down Expand Up @@ -701,9 +689,7 @@ export const useObjectBrowserStore = defineStore('objectBrowser', () => {
Key: path + file.Key,
}));

if (config.state.config.newUploadModalEnabled) {
state.uploading = state.uploading.filter(f => f.Key !== file.Key);
}
state.uploading = state.uploading.filter(f => f.Key !== file.Key);

if (!isFolder) {
if (config.state.config.objectBrowserPaginationEnabled) {
Expand Down
3 changes: 1 addition & 2 deletions web/satellite/src/types/config.gen.ts
Expand Up @@ -13,7 +13,7 @@ export class FrontendConfig {
satelliteName: string;
satelliteNodeURL: string;
stripePublicKey: string;
partneredSatellites?: PartneredSatellite[];
partneredSatellites: PartneredSatellite[] | null;
defaultProjectLimit: number;
generalRequestURL: string;
projectLimitsIncreaseRequestURL: string;
Expand Down Expand Up @@ -42,7 +42,6 @@ export class FrontendConfig {
passwordMaximumLength: number;
abTestingEnabled: boolean;
pricingPackagesEnabled: boolean;
newUploadModalEnabled: boolean;
galleryViewEnabled: boolean;
neededTransactionConfirmations: number;
objectBrowserPaginationEnabled: boolean;
Expand Down
2 changes: 1 addition & 1 deletion web/satellite/src/views/dashboard/DashboardArea.vue
Expand Up @@ -152,7 +152,7 @@ const billingEnabled = computed<boolean>(() => configStore.state.config.billingF
* Indicates whether objects upload modal should be shown.
*/
const isObjectsUploadModal = computed((): boolean => {
return configStore.state.config.newUploadModalEnabled && appStore.state.isUploadingModal;
return appStore.state.isUploadingModal;
});
/**
Expand Down

0 comments on commit 8568e49

Please sign in to comment.