-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
web/admin: prevent file upload attempt when backend not managed #18646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,17 +3,20 @@ import "#elements/buttons/SpinnerButton/index"; | |||||||||||||||||||||||||||
| import "#elements/forms/DeleteBulkForm"; | ||||||||||||||||||||||||||||
| import "#elements/forms/ModalForm"; | ||||||||||||||||||||||||||||
| import "@patternfly/elements/pf-tooltip/pf-tooltip.js"; | ||||||||||||||||||||||||||||
| import "#elements/EmptyState"; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| import { DEFAULT_CONFIG } from "#common/api/config"; | ||||||||||||||||||||||||||||
| import { docLink } from "#common/global"; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| import { WithCapabilitiesConfig } from "#elements/mixins/capabilities"; | ||||||||||||||||||||||||||||
| import { PaginatedResponse, TableColumn } from "#elements/table/Table"; | ||||||||||||||||||||||||||||
| import { TablePage } from "#elements/table/TablePage"; | ||||||||||||||||||||||||||||
| import { SlottedTemplateResult } from "#elements/types"; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| import { AdminApi, AdminFileListUsageEnum } from "@goauthentik/api"; | ||||||||||||||||||||||||||||
| import { AdminApi, AdminFileListUsageEnum, CapabilitiesEnum } from "@goauthentik/api"; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| import { msg } from "@lit/localize"; | ||||||||||||||||||||||||||||
| import { html, TemplateResult } from "lit"; | ||||||||||||||||||||||||||||
| import { html, nothing, TemplateResult } from "lit"; | ||||||||||||||||||||||||||||
| import { customElement, property } from "lit/decorators.js"; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| export interface FileItem { | ||||||||||||||||||||||||||||
|
|
@@ -25,7 +28,7 @@ export interface FileItem { | |||||||||||||||||||||||||||
| export type FileListOrderKey = "name" | "mimeType"; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| @customElement("ak-files-list") | ||||||||||||||||||||||||||||
| export class FileListPage extends TablePage<FileItem> { | ||||||||||||||||||||||||||||
| export class FileListPage extends WithCapabilitiesConfig(TablePage<FileItem>) { | ||||||||||||||||||||||||||||
| public override checkbox = true; | ||||||||||||||||||||||||||||
| public override clearOnRefresh = true; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
@@ -67,7 +70,10 @@ export class FileListPage extends TablePage<FileItem> { | |||||||||||||||||||||||||||
| [msg("Actions"), null, msg("Row Actions")], | ||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| renderToolbarSelected(): TemplateResult { | ||||||||||||||||||||||||||||
| renderToolbarSelected() { | ||||||||||||||||||||||||||||
| if (!this.can(CapabilitiesEnum.CanSaveMedia)) { | ||||||||||||||||||||||||||||
| return nothing; | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| const disabled = !this.selectedElements.length; | ||||||||||||||||||||||||||||
| const count = this.selectedElements.length; | ||||||||||||||||||||||||||||
| return html`<ak-forms-delete-bulk | ||||||||||||||||||||||||||||
|
|
@@ -116,7 +122,36 @@ export class FileListPage extends TablePage<FileItem> { | |||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| protected renderObjectCreate(): TemplateResult { | ||||||||||||||||||||||||||||
| protected renderEmpty(inner?: TemplateResult) { | ||||||||||||||||||||||||||||
| if (!this.can(CapabilitiesEnum.CanSaveMedia)) { | ||||||||||||||||||||||||||||
| return super.renderEmpty( | ||||||||||||||||||||||||||||
| html`<ak-empty-state icon=${this.pageIcon} | ||||||||||||||||||||||||||||
| ><span | ||||||||||||||||||||||||||||
| >${msg("Configured file backend does not support file management.")}</span | ||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||
| <div slot="body"> | ||||||||||||||||||||||||||||
| ${msg( | ||||||||||||||||||||||||||||
| "Please ensure the data folder is mounted or S3 storage is configured.", | ||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||
| <div slot="primary"> | ||||||||||||||||||||||||||||
| <a | ||||||||||||||||||||||||||||
| target="_blank" | ||||||||||||||||||||||||||||
| class="pf-c-button pf-m-primary" | ||||||||||||||||||||||||||||
| href=${docLink("/install-config/configuration/#storage-settings")} | ||||||||||||||||||||||||||||
| >${msg("Learn more")}</a | ||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
| <a | |
| target="_blank" | |
| class="pf-c-button pf-m-primary" | |
| href=${docLink("/install-config/configuration/#storage-settings")} | |
| >${msg("Learn more")}</a | |
| > | |
| ${msg("Read more about")} | |
| <a | |
| target="_blank" | |
| rel="noopener noreferrer" | |
| href=${docLink("/install-config/configuration/#storage-settings")} | |
| >${msg("Storage Settings")}</a | |
| >. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer keeping it as a single string in the link since that makes translation a lot easier (with regards to where the button is placed in the sentence)
Uh oh!
There was an error while loading. Please reload this page.