mirror of
https://github.com/OpenMaxIO/openmaxio-object-browser
synced 2026-07-01 07:41:18 -07:00
Added FS Support & blocked non usable functionality in console (#880)
Co-authored-by: Benjamin Perez <benjamin@bexsoft.net> Co-authored-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
@@ -39,7 +39,7 @@ type ListBucketsResponse struct {
|
||||
// list of resulting buckets
|
||||
Buckets []*Bucket `json:"buckets"`
|
||||
|
||||
// number of buckets accessible to tenant user
|
||||
// number of buckets accessible to the user
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,9 @@ import (
|
||||
// swagger:model sessionResponse
|
||||
type SessionResponse struct {
|
||||
|
||||
// distributed mode
|
||||
DistributedMode bool `json:"distributedMode,omitempty"`
|
||||
|
||||
// features
|
||||
Features []string `json:"features"`
|
||||
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/static/css/main.8cfac526.chunk.css",
|
||||
"main.js": "/static/js/main.059e1608.chunk.js",
|
||||
"main.js.map": "/static/js/main.059e1608.chunk.js.map",
|
||||
"main.js": "/static/js/main.a608e767.chunk.js",
|
||||
"main.js.map": "/static/js/main.a608e767.chunk.js.map",
|
||||
"runtime-main.js": "/static/js/runtime-main.43a31377.js",
|
||||
"runtime-main.js.map": "/static/js/runtime-main.43a31377.js.map",
|
||||
"static/css/2.c5a51b70.chunk.css": "/static/css/2.c5a51b70.chunk.css",
|
||||
"static/js/2.dd405112.chunk.js": "/static/js/2.dd405112.chunk.js",
|
||||
"static/js/2.dd405112.chunk.js.map": "/static/js/2.dd405112.chunk.js.map",
|
||||
"static/js/2.55ef6ad7.chunk.js": "/static/js/2.55ef6ad7.chunk.js",
|
||||
"static/js/2.55ef6ad7.chunk.js.map": "/static/js/2.55ef6ad7.chunk.js.map",
|
||||
"index.html": "/index.html",
|
||||
"static/css/2.c5a51b70.chunk.css.map": "/static/css/2.c5a51b70.chunk.css.map",
|
||||
"static/css/main.8cfac526.chunk.css.map": "/static/css/main.8cfac526.chunk.css.map",
|
||||
"static/js/2.dd405112.chunk.js.LICENSE.txt": "/static/js/2.dd405112.chunk.js.LICENSE.txt",
|
||||
"static/js/2.55ef6ad7.chunk.js.LICENSE.txt": "/static/js/2.55ef6ad7.chunk.js.LICENSE.txt",
|
||||
"static/media/minio_console_logo.0837460e.svg": "/static/media/minio_console_logo.0837460e.svg",
|
||||
"static/media/minio_operator_logo.1312b7c9.svg": "/static/media/minio_operator_logo.1312b7c9.svg"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/js/runtime-main.43a31377.js",
|
||||
"static/css/2.c5a51b70.chunk.css",
|
||||
"static/js/2.dd405112.chunk.js",
|
||||
"static/js/2.55ef6ad7.chunk.js",
|
||||
"static/css/main.8cfac526.chunk.css",
|
||||
"static/js/main.059e1608.chunk.js"
|
||||
"static/js/main.a608e767.chunk.js"
|
||||
]
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="MinIO Console"/><link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;500;700;900&display=swap" rel="stylesheet"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="manifest" href="/manifest.json"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#3a4e54"/><title>MinIO Console</title><link href="/static/css/2.c5a51b70.chunk.css" rel="stylesheet"><link href="/static/css/main.8cfac526.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,l,i=r[0],a=r[1],p=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,p||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var a=t[i];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var i=this["webpackJsonpportal-ui"]=this["webpackJsonpportal-ui"]||[],a=i.push.bind(i);i.push=r,i=i.slice();for(var p=0;p<i.length;p++)r(i[p]);var f=a;t()}([])</script><script src="/static/js/2.dd405112.chunk.js"></script><script src="/static/js/main.059e1608.chunk.js"></script></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="MinIO Console"/><link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;500;700;900&display=swap" rel="stylesheet"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="manifest" href="/manifest.json"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#3a4e54"/><title>MinIO Console</title><link href="/static/css/2.c5a51b70.chunk.css" rel="stylesheet"><link href="/static/css/main.8cfac526.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,l,i=r[0],a=r[1],p=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,p||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var a=t[i];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var i=this["webpackJsonpportal-ui"]=this["webpackJsonpportal-ui"]||[],a=i.push.bind(i);i.push=r,i=i.slice();for(var p=0;p<i.length;p++)r(i[p]);var f=a;t()}([])</script><script src="/static/js/2.55ef6ad7.chunk.js"></script><script src="/static/js/main.a608e767.chunk.js"></script></body></html>
|
||||
3
portal-ui/build/static/js/2.55ef6ad7.chunk.js
Normal file
3
portal-ui/build/static/js/2.55ef6ad7.chunk.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
portal-ui/build/static/js/main.a608e767.chunk.js
Normal file
2
portal-ui/build/static/js/main.a608e767.chunk.js
Normal file
File diff suppressed because one or more lines are too long
1
portal-ui/build/static/js/main.a608e767.chunk.js.map
Normal file
1
portal-ui/build/static/js/main.a608e767.chunk.js.map
Normal file
File diff suppressed because one or more lines are too long
@@ -18,27 +18,22 @@ import React, { useEffect, useState } from "react";
|
||||
import { Redirect } from "react-router-dom";
|
||||
import { connect } from "react-redux";
|
||||
import { AppState } from "./store";
|
||||
import { consoleOperatorMode, userLoggedIn } from "./actions";
|
||||
import {
|
||||
consoleOperatorMode,
|
||||
userLoggedIn,
|
||||
setDistributedMode,
|
||||
} from "./actions";
|
||||
import api from "./common/api";
|
||||
import { saveSessionResponse } from "./screens/Console/actions";
|
||||
import { ISessionResponse } from "./screens/Console/types";
|
||||
|
||||
const mapState = (state: AppState) => ({
|
||||
loggedIn: state.system.loggedIn,
|
||||
});
|
||||
|
||||
const connector = connect(mapState, {
|
||||
userLoggedIn,
|
||||
consoleOperatorMode,
|
||||
saveSessionResponse,
|
||||
});
|
||||
|
||||
interface ProtectedRouteProps {
|
||||
loggedIn: boolean;
|
||||
Component: any;
|
||||
userLoggedIn: typeof userLoggedIn;
|
||||
consoleOperatorMode: typeof consoleOperatorMode;
|
||||
saveSessionResponse: typeof saveSessionResponse;
|
||||
setDistributedMode: typeof setDistributedMode;
|
||||
}
|
||||
|
||||
const ProtectedRoute = ({
|
||||
@@ -47,6 +42,7 @@ const ProtectedRoute = ({
|
||||
userLoggedIn,
|
||||
consoleOperatorMode,
|
||||
saveSessionResponse,
|
||||
setDistributedMode,
|
||||
}: ProtectedRouteProps) => {
|
||||
const [sessionLoading, setSessionLoading] = useState<boolean>(true);
|
||||
useEffect(() => {
|
||||
@@ -56,6 +52,7 @@ const ProtectedRoute = ({
|
||||
saveSessionResponse(res);
|
||||
userLoggedIn(true);
|
||||
setSessionLoading(false);
|
||||
setDistributedMode(res.distributedMode || false);
|
||||
// check for tenants presence, that indicates we are in operator mode
|
||||
if (res.operator) {
|
||||
consoleOperatorMode(true);
|
||||
@@ -63,7 +60,12 @@ const ProtectedRoute = ({
|
||||
}
|
||||
})
|
||||
.catch(() => setSessionLoading(false));
|
||||
}, [saveSessionResponse, consoleOperatorMode, userLoggedIn]);
|
||||
}, [
|
||||
saveSessionResponse,
|
||||
consoleOperatorMode,
|
||||
userLoggedIn,
|
||||
setDistributedMode,
|
||||
]);
|
||||
|
||||
// if we still trying to retrieve user session render nothing
|
||||
if (sessionLoading) {
|
||||
@@ -73,4 +75,15 @@ const ProtectedRoute = ({
|
||||
return loggedIn ? <Component /> : <Redirect to={{ pathname: "/login" }} />;
|
||||
};
|
||||
|
||||
const mapState = (state: AppState) => ({
|
||||
loggedIn: state.system.loggedIn,
|
||||
});
|
||||
|
||||
const connector = connect(mapState, {
|
||||
userLoggedIn,
|
||||
consoleOperatorMode,
|
||||
saveSessionResponse,
|
||||
setDistributedMode,
|
||||
});
|
||||
|
||||
export default connector(ProtectedRoute);
|
||||
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
SET_ERROR_SNACK_MESSAGE,
|
||||
SET_SNACK_MODAL_MESSAGE,
|
||||
SET_MODAL_ERROR_MESSAGE,
|
||||
GLOBAL_SET_DISTRIBUTED_SETUP,
|
||||
} from "./types";
|
||||
|
||||
export function userLoggedIn(loggedIn: boolean) {
|
||||
@@ -104,3 +105,10 @@ export const setModalErrorSnackMessage = (message: string) => {
|
||||
message,
|
||||
};
|
||||
};
|
||||
|
||||
export const setDistributedMode = (distributedSetup: boolean) => {
|
||||
return {
|
||||
type: GLOBAL_SET_DISTRIBUTED_SETUP,
|
||||
distributedSetup,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
SET_SERVER_DIAG_STAT,
|
||||
SET_SNACK_MODAL_MESSAGE,
|
||||
SET_MODAL_ERROR_MESSAGE,
|
||||
GLOBAL_SET_DISTRIBUTED_SETUP,
|
||||
} from "./types";
|
||||
|
||||
const initialState: SystemState = {
|
||||
@@ -48,6 +49,7 @@ const initialState: SystemState = {
|
||||
type: "message",
|
||||
},
|
||||
serverDiagnosticStatus: "",
|
||||
distributedSetup: false,
|
||||
};
|
||||
|
||||
export function systemReducer(
|
||||
@@ -111,6 +113,11 @@ export function systemReducer(
|
||||
...state,
|
||||
serverDiagnosticStatus: action.serverDiagnosticStatus,
|
||||
};
|
||||
case GLOBAL_SET_DISTRIBUTED_SETUP:
|
||||
return {
|
||||
...state,
|
||||
distributedSetup: action.distributedSetup,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import {
|
||||
import { setErrorSnackMessage } from "../../../../actions";
|
||||
import { setBucketDetailsTab } from "../actions";
|
||||
import { AppState } from "../../../../store";
|
||||
import { ISessionResponse } from "../../types";
|
||||
import PageHeader from "../../Common/PageHeader/PageHeader";
|
||||
import AccessDetailsPanel from "./AccessDetailsPanel";
|
||||
import BucketSummaryPanel from "./BucketSummaryPanel";
|
||||
@@ -148,8 +147,8 @@ interface IBucketDetailsProps {
|
||||
classes: any;
|
||||
match: any;
|
||||
history: any;
|
||||
session: ISessionResponse;
|
||||
selectedTab: string;
|
||||
distributedSetup: boolean;
|
||||
setErrorSnackMessage: typeof setErrorSnackMessage;
|
||||
setBucketDetailsTab: typeof setBucketDetailsTab;
|
||||
}
|
||||
@@ -165,10 +164,10 @@ const BucketDetails = ({
|
||||
classes,
|
||||
match,
|
||||
history,
|
||||
session,
|
||||
selectedTab,
|
||||
setErrorSnackMessage,
|
||||
setBucketDetailsTab,
|
||||
distributedSetup,
|
||||
}: IBucketDetailsProps) => {
|
||||
const [loadingPerms, setLoadingPerms] = useState<boolean>(true);
|
||||
const [canGetReplication, setCanGetReplication] = useState<boolean>(false);
|
||||
@@ -273,9 +272,14 @@ const BucketDetails = ({
|
||||
value="replication"
|
||||
label="Replication"
|
||||
{...a11yProps(2)}
|
||||
disabled={!canGetReplication}
|
||||
disabled={!canGetReplication || !distributedSetup}
|
||||
/>
|
||||
<Tab
|
||||
value="lifecycle"
|
||||
label="Lifecycle"
|
||||
{...a11yProps(3)}
|
||||
disabled={!distributedSetup}
|
||||
/>
|
||||
<Tab value="lifecycle" label="Lifecycle" {...a11yProps(3)} />
|
||||
<Tab value="access" label="Access" {...a11yProps(4)} />
|
||||
</Tabs>
|
||||
</Grid>
|
||||
@@ -291,18 +295,19 @@ const BucketDetails = ({
|
||||
path="/buckets/:bucketName/events"
|
||||
component={BucketEventsPanel}
|
||||
/>
|
||||
<Route
|
||||
path="/buckets/:bucketName/replication"
|
||||
component={BucketReplicationPanel}
|
||||
/>
|
||||
<Route
|
||||
path="/buckets/:bucketName/lifecycle"
|
||||
component={BucketLifecyclePanel}
|
||||
/>
|
||||
<Route
|
||||
path="/buckets/:bucketName/access"
|
||||
component={AccessDetailsPanel}
|
||||
/>
|
||||
{distributedSetup && (
|
||||
<Route
|
||||
path="/buckets/:bucketName/replication"
|
||||
component={BucketReplicationPanel}
|
||||
/>
|
||||
)}
|
||||
{distributedSetup && (
|
||||
<Route
|
||||
path="/buckets/:bucketName/lifecycle"
|
||||
component={BucketLifecyclePanel}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Route
|
||||
path="/buckets/:bucketName/access"
|
||||
component={AccessDetailsPanel}
|
||||
@@ -325,6 +330,7 @@ const BucketDetails = ({
|
||||
const mapState = (state: AppState) => ({
|
||||
session: state.console.session,
|
||||
selectedTab: state.buckets.bucketDetails.selectedTab,
|
||||
distributedSetup: state.system.distributedSetup,
|
||||
});
|
||||
|
||||
const connector = connect(mapState, {
|
||||
|
||||
@@ -50,6 +50,7 @@ import EnableQuota from "./EnableQuota";
|
||||
interface IBucketSummaryProps {
|
||||
classes: any;
|
||||
match: any;
|
||||
distributedSetup: boolean;
|
||||
setErrorSnackMessage: typeof setErrorSnackMessage;
|
||||
}
|
||||
|
||||
@@ -87,6 +88,7 @@ const styles = (theme: Theme) =>
|
||||
const BucketSummary = ({
|
||||
classes,
|
||||
match,
|
||||
distributedSetup,
|
||||
setErrorSnackMessage,
|
||||
}: IBucketSummaryProps) => {
|
||||
const [info, setInfo] = useState<BucketInfo | null>(null);
|
||||
@@ -166,7 +168,7 @@ const BucketSummary = ({
|
||||
}, [loadingEncryption, bucketName]);
|
||||
|
||||
useEffect(() => {
|
||||
if (loadingVersioning) {
|
||||
if (loadingVersioning && distributedSetup) {
|
||||
api
|
||||
.invoke("GET", `/api/v1/buckets/${bucketName}/versioning`)
|
||||
.then((res: BucketVersioning) => {
|
||||
@@ -178,10 +180,10 @@ const BucketSummary = ({
|
||||
setLoadingVersioning(false);
|
||||
});
|
||||
}
|
||||
}, [loadingVersioning, setErrorSnackMessage, bucketName]);
|
||||
}, [loadingVersioning, setErrorSnackMessage, bucketName, distributedSetup]);
|
||||
|
||||
useEffect(() => {
|
||||
if (loadingQuota) {
|
||||
if (loadingQuota && distributedSetup) {
|
||||
api
|
||||
.invoke("GET", `/api/v1/buckets/${bucketName}/quota`)
|
||||
.then((res: BucketQuota) => {
|
||||
@@ -199,10 +201,16 @@ const BucketSummary = ({
|
||||
setLoadingVersioning(false);
|
||||
});
|
||||
}
|
||||
}, [loadingQuota, setLoadingVersioning, setErrorSnackMessage, bucketName]);
|
||||
}, [
|
||||
loadingQuota,
|
||||
setLoadingVersioning,
|
||||
setErrorSnackMessage,
|
||||
bucketName,
|
||||
distributedSetup,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (loadingVersioning) {
|
||||
if (loadingVersioning && distributedSetup) {
|
||||
api
|
||||
.invoke("GET", `/api/v1/buckets/${bucketName}/object-locking`)
|
||||
.then((res: BucketObjectLocking) => {
|
||||
@@ -219,6 +227,7 @@ const BucketSummary = ({
|
||||
setErrorSnackMessage,
|
||||
bucketName,
|
||||
loadingVersioning,
|
||||
distributedSetup,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -244,7 +253,7 @@ const BucketSummary = ({
|
||||
}, [loadingSize, setErrorSnackMessage, bucketName]);
|
||||
|
||||
useEffect(() => {
|
||||
if (loadingReplication) {
|
||||
if (loadingReplication && distributedSetup) {
|
||||
api
|
||||
.invoke("GET", `/api/v1/buckets/${bucketName}/replication`)
|
||||
.then((res: BucketReplication) => {
|
||||
@@ -257,7 +266,7 @@ const BucketSummary = ({
|
||||
setLoadingReplication(false);
|
||||
});
|
||||
}
|
||||
}, [loadingReplication, setErrorSnackMessage, bucketName]);
|
||||
}, [loadingReplication, setErrorSnackMessage, bucketName, distributedSetup]);
|
||||
|
||||
const loadAllBucketData = () => {
|
||||
setLoadingBucket(true);
|
||||
@@ -399,22 +408,24 @@ const BucketSummary = ({
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className={classes.titleCol}>Replication:</td>
|
||||
<td className={classes.doubleElement}>
|
||||
<span>{replicationRules ? "Enabled" : "Disabled"}</span>
|
||||
</td>
|
||||
{!hasObjectLocking ? (
|
||||
<React.Fragment>
|
||||
<td className={classes.titleCol}>Object Locking:</td>
|
||||
<td>Disabled</td>
|
||||
</React.Fragment>
|
||||
) : (
|
||||
<React.Fragment>
|
||||
<td colSpan={2}></td>
|
||||
</React.Fragment>
|
||||
)}
|
||||
</tr>
|
||||
{distributedSetup && (
|
||||
<tr>
|
||||
<td className={classes.titleCol}>Replication:</td>
|
||||
<td className={classes.doubleElement}>
|
||||
<span>{replicationRules ? "Enabled" : "Disabled"}</span>
|
||||
</td>
|
||||
{!hasObjectLocking ? (
|
||||
<React.Fragment>
|
||||
<td className={classes.titleCol}>Object Locking:</td>
|
||||
<td>Disabled</td>
|
||||
</React.Fragment>
|
||||
) : (
|
||||
<React.Fragment>
|
||||
<td colSpan={2}></td>
|
||||
</React.Fragment>
|
||||
)}
|
||||
</tr>
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</Grid>
|
||||
@@ -437,79 +448,84 @@ const BucketSummary = ({
|
||||
</Paper>
|
||||
<br />
|
||||
<br />
|
||||
<Paper className={classes.paperContainer}>
|
||||
<Grid container>
|
||||
<Grid item xs={quotaEnabled ? 9 : 12}>
|
||||
<h2>Versioning</h2>
|
||||
<hr className={classes.hrClass} />
|
||||
<table width={"100%"}>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td className={classes.titleCol}>Versioning:</td>
|
||||
<td>
|
||||
{loadingVersioning ? (
|
||||
<CircularProgress
|
||||
color="primary"
|
||||
size={16}
|
||||
variant="indeterminate"
|
||||
/>
|
||||
) : (
|
||||
<Fragment>
|
||||
<Button
|
||||
color="primary"
|
||||
className={classes.anchorButton}
|
||||
onClick={setBucketVersioning}
|
||||
>
|
||||
{isVersioned ? "Enabled" : "Disabled"}
|
||||
</Button>
|
||||
</Fragment>
|
||||
)}
|
||||
</td>
|
||||
<td className={classes.titleCol}>Quota:</td>
|
||||
<td>
|
||||
{loadingQuota ? (
|
||||
<CircularProgress
|
||||
color="primary"
|
||||
size={16}
|
||||
variant="indeterminate"
|
||||
/>
|
||||
) : (
|
||||
<Fragment>
|
||||
<Button
|
||||
color="primary"
|
||||
className={classes.anchorButton}
|
||||
onClick={setBucketQuota}
|
||||
>
|
||||
{quotaEnabled ? "Enabled" : "Disabled"}
|
||||
</Button>
|
||||
</Fragment>
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</Grid>
|
||||
{quotaEnabled && quota && (
|
||||
<Grid item xs={3} className={classes.reportedUsage}>
|
||||
<Grid container direction="row" alignItems="center">
|
||||
<Grid item className={classes.icon} xs={2}>
|
||||
<GavelIcon />
|
||||
</Grid>
|
||||
<Grid item xs={10}>
|
||||
<Typography className={classes.elementTitle}>
|
||||
{cap(quota?.type)} Quota
|
||||
{distributedSetup && (
|
||||
<Fragment>
|
||||
<Paper className={classes.paperContainer}>
|
||||
<Grid container>
|
||||
<Grid item xs={quotaEnabled ? 9 : 12}>
|
||||
<h2>Versioning</h2>
|
||||
<hr className={classes.hrClass} />
|
||||
<table width={"100%"}>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td className={classes.titleCol}>Versioning:</td>
|
||||
<td>
|
||||
{loadingVersioning ? (
|
||||
<CircularProgress
|
||||
color="primary"
|
||||
size={16}
|
||||
variant="indeterminate"
|
||||
/>
|
||||
) : (
|
||||
<Fragment>
|
||||
<Button
|
||||
color="primary"
|
||||
className={classes.anchorButton}
|
||||
onClick={setBucketVersioning}
|
||||
>
|
||||
{isVersioned ? "Enabled" : "Disabled"}
|
||||
</Button>
|
||||
</Fragment>
|
||||
)}
|
||||
</td>
|
||||
<td className={classes.titleCol}>Quota:</td>
|
||||
<td>
|
||||
{loadingQuota ? (
|
||||
<CircularProgress
|
||||
color="primary"
|
||||
size={16}
|
||||
variant="indeterminate"
|
||||
/>
|
||||
) : (
|
||||
<Fragment>
|
||||
<Button
|
||||
color="primary"
|
||||
className={classes.anchorButton}
|
||||
onClick={setBucketQuota}
|
||||
>
|
||||
{quotaEnabled ? "Enabled" : "Disabled"}
|
||||
</Button>
|
||||
</Fragment>
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</Grid>
|
||||
{quotaEnabled && quota && (
|
||||
<Grid item xs={3} className={classes.reportedUsage}>
|
||||
<Grid container direction="row" alignItems="center">
|
||||
<Grid item className={classes.icon} xs={2}>
|
||||
<GavelIcon />
|
||||
</Grid>
|
||||
<Grid item xs={10}>
|
||||
<Typography className={classes.elementTitle}>
|
||||
{cap(quota?.type)} Quota
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Typography className={classes.consumptionValue}>
|
||||
{niceBytes(`${quota?.quota}`)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Typography className={classes.consumptionValue}>
|
||||
{niceBytes(`${quota?.quota}`)}
|
||||
</Typography>
|
||||
)}
|
||||
</Grid>
|
||||
)}
|
||||
</Grid>
|
||||
</Paper>
|
||||
<br />
|
||||
<br />
|
||||
</Paper>
|
||||
<br />
|
||||
<br />
|
||||
</Fragment>
|
||||
)}
|
||||
|
||||
{hasObjectLocking && (
|
||||
<Paper className={classes.paperContainer}>
|
||||
<Grid container>
|
||||
@@ -554,6 +570,7 @@ const BucketSummary = ({
|
||||
|
||||
const mapState = (state: AppState) => ({
|
||||
session: state.console.session,
|
||||
distributedSetup: state.system.distributedSetup,
|
||||
});
|
||||
|
||||
const connector = connect(mapState, {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React, { useEffect, useState, Fragment } from "react";
|
||||
import Grid from "@material-ui/core/Grid";
|
||||
import { Button, LinearProgress, Typography } from "@material-ui/core";
|
||||
import { createStyles, Theme, withStyles } from "@material-ui/core/styles";
|
||||
@@ -64,6 +64,9 @@ const styles = (theme: Theme) =>
|
||||
marginLeft: 8,
|
||||
alignSelf: "flex-start" as const,
|
||||
},
|
||||
error: {
|
||||
color: "#b53b4b",
|
||||
},
|
||||
...modalBasic,
|
||||
});
|
||||
|
||||
@@ -94,6 +97,7 @@ interface IAddBucketProps {
|
||||
retentionMode: string;
|
||||
retentionUnit: string;
|
||||
retentionValidity: number;
|
||||
distributedSetup: boolean;
|
||||
}
|
||||
|
||||
const AddBucket = ({
|
||||
@@ -123,6 +127,7 @@ const AddBucket = ({
|
||||
retentionMode,
|
||||
retentionUnit,
|
||||
retentionValidity,
|
||||
distributedSetup,
|
||||
}: IAddBucketProps) => {
|
||||
const [addLoading, setAddLoading] = useState<boolean>(false);
|
||||
const [sendEnabled, setSendEnabled] = useState<boolean>(false);
|
||||
@@ -138,25 +143,27 @@ const AddBucket = ({
|
||||
|
||||
let request: MakeBucketRequest = {
|
||||
name: bucketName,
|
||||
versioning: versioningEnabled,
|
||||
locking: lockingEnabled,
|
||||
versioning: distributedSetup ? versioningEnabled : false,
|
||||
locking: distributedSetup ? lockingEnabled : false,
|
||||
};
|
||||
|
||||
if (quotaEnabled) {
|
||||
const amount = getBytes(quotaSize, quotaUnit, false);
|
||||
request.quota = {
|
||||
enabled: true,
|
||||
quota_type: quotaType,
|
||||
amount: parseInt(amount),
|
||||
};
|
||||
}
|
||||
if (distributedSetup) {
|
||||
if (quotaEnabled) {
|
||||
const amount = getBytes(quotaSize, quotaUnit, false);
|
||||
request.quota = {
|
||||
enabled: true,
|
||||
quota_type: quotaType,
|
||||
amount: parseInt(amount),
|
||||
};
|
||||
}
|
||||
|
||||
if (retentionEnabled) {
|
||||
request.retention = {
|
||||
mode: retentionMode,
|
||||
unit: retentionUnit,
|
||||
validity: retentionValidity,
|
||||
};
|
||||
if (retentionEnabled) {
|
||||
request.retention = {
|
||||
mode: retentionMode,
|
||||
unit: retentionUnit,
|
||||
validity: retentionValidity,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
api
|
||||
@@ -281,7 +288,20 @@ const AddBucket = ({
|
||||
Features
|
||||
</Typography>
|
||||
<hr />
|
||||
{!distributedSetup && (
|
||||
<Fragment>
|
||||
<small className={classes.error}>
|
||||
Some of these features are disabled as server is running in
|
||||
FS mode. <br />
|
||||
If you require any of this, please start server in
|
||||
distributed mode.
|
||||
</small>
|
||||
<br />
|
||||
<br />
|
||||
</Fragment>
|
||||
)}
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12}>
|
||||
<FormSwitchWrapper
|
||||
value="versioned"
|
||||
@@ -296,6 +316,7 @@ const AddBucket = ({
|
||||
}
|
||||
label={"Versioning"}
|
||||
indicatorLabels={["On", "Off"]}
|
||||
disabled={!distributedSetup}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
@@ -303,7 +324,7 @@ const AddBucket = ({
|
||||
value="locking"
|
||||
id="locking"
|
||||
name="locking"
|
||||
disabled={lockingFieldDisabled}
|
||||
disabled={lockingFieldDisabled || !distributedSetup}
|
||||
checked={lockingEnabled}
|
||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
enableObjectLocking(event.target.checked);
|
||||
@@ -315,6 +336,7 @@ const AddBucket = ({
|
||||
indicatorLabels={["On", "Off"]}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12}>
|
||||
<FormSwitchWrapper
|
||||
value="bucket_quota"
|
||||
@@ -327,9 +349,10 @@ const AddBucket = ({
|
||||
label={"Quota"}
|
||||
description={"Limit the amount of data in the bucket."}
|
||||
indicatorLabels={["On", "Off"]}
|
||||
disabled={!distributedSetup}
|
||||
/>
|
||||
</Grid>
|
||||
{quotaEnabled && (
|
||||
{quotaEnabled && distributedSetup && (
|
||||
<React.Fragment>
|
||||
<Grid item xs={12}>
|
||||
<RadioGroupSelector
|
||||
@@ -380,7 +403,7 @@ const AddBucket = ({
|
||||
</Grid>
|
||||
</React.Fragment>
|
||||
)}
|
||||
{versioningEnabled && (
|
||||
{versioningEnabled && distributedSetup && (
|
||||
<Grid item xs={12}>
|
||||
<FormSwitchWrapper
|
||||
value="bucket_retention"
|
||||
@@ -398,7 +421,7 @@ const AddBucket = ({
|
||||
/>
|
||||
</Grid>
|
||||
)}
|
||||
{retentionEnabled && (
|
||||
{retentionEnabled && distributedSetup && (
|
||||
<React.Fragment>
|
||||
<Grid item xs={12}>
|
||||
<RadioGroupSelector
|
||||
@@ -489,6 +512,7 @@ const mapState = (state: AppState) => ({
|
||||
retentionMode: state.buckets.addBucketRetentionMode,
|
||||
retentionUnit: state.buckets.addBucketRetentionUnit,
|
||||
retentionValidity: state.buckets.addBucketRetentionValidity,
|
||||
distributedSetup: state.system.distributedSetup,
|
||||
});
|
||||
|
||||
const connector = connect(mapState, {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import React, { useState } from "react";
|
||||
import get from "lodash/get";
|
||||
import { connect } from "react-redux";
|
||||
import { Button, Grid } from "@material-ui/core";
|
||||
import { createStyles, Theme, withStyles } from "@material-ui/core/styles";
|
||||
@@ -23,6 +24,7 @@ import { setModalErrorSnackMessage } from "../../../../../../actions";
|
||||
import InputBoxWrapper from "../../../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper";
|
||||
import ModalWrapper from "../../../../Common/ModalWrapper/ModalWrapper";
|
||||
import api from "../../../../../../common/api";
|
||||
import { AppState } from "../../../../../../store";
|
||||
|
||||
interface ITagModal {
|
||||
modalOpen: boolean;
|
||||
@@ -31,6 +33,7 @@ interface ITagModal {
|
||||
versionId: string | null;
|
||||
onCloseAndUpdate: (refresh: boolean) => void;
|
||||
selectedObject: string;
|
||||
distributedSetup: boolean;
|
||||
setModalErrorSnackMessage: typeof setModalErrorSnackMessage;
|
||||
classes: any;
|
||||
}
|
||||
@@ -54,6 +57,7 @@ const AddTagModal = ({
|
||||
onCloseAndUpdate,
|
||||
bucketName,
|
||||
versionId,
|
||||
distributedSetup,
|
||||
setModalErrorSnackMessage,
|
||||
classes,
|
||||
}: ITagModal) => {
|
||||
@@ -73,10 +77,12 @@ const AddTagModal = ({
|
||||
newTag[newKey] = newLabel;
|
||||
const newTagList = { ...currentTags, ...newTag };
|
||||
|
||||
const verID = distributedSetup ? versionId : "null";
|
||||
|
||||
api
|
||||
.invoke(
|
||||
"PUT",
|
||||
`/api/v1/buckets/${bucketName}/objects/tags?prefix=${selectedObject}&version_id=${versionId}`,
|
||||
`/api/v1/buckets/${bucketName}/objects/tags?prefix=${selectedObject}&version_id=${verID}`,
|
||||
{ tags: newTagList }
|
||||
)
|
||||
.then((res: any) => {
|
||||
@@ -153,10 +159,14 @@ const AddTagModal = ({
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = ({ system }: AppState) => ({
|
||||
distributedSetup: get(system, "distributedSetup", false),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = {
|
||||
setModalErrorSnackMessage,
|
||||
};
|
||||
|
||||
const connector = connect(null, mapDispatchToProps);
|
||||
const connector = connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
export default withStyles(styles)(connector(AddTagModal));
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import React, { useState } from "react";
|
||||
import get from "lodash/get";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
Button,
|
||||
@@ -29,6 +30,7 @@ import { createStyles, Theme, withStyles } from "@material-ui/core/styles";
|
||||
import { modalBasic } from "../../../../Common/FormComponents/common/styleLibrary";
|
||||
import { setErrorSnackMessage } from "../../../../../../actions";
|
||||
import api from "../../../../../../common/api";
|
||||
import { AppState } from "../../../../../../store";
|
||||
|
||||
interface IDeleteTagModal {
|
||||
deleteOpen: boolean;
|
||||
@@ -38,6 +40,7 @@ interface IDeleteTagModal {
|
||||
selectedTag: string[];
|
||||
onCloseAndUpdate: (refresh: boolean) => void;
|
||||
selectedObject: string;
|
||||
distributedSetup: boolean;
|
||||
setErrorSnackMessage: typeof setErrorSnackMessage;
|
||||
classes: any;
|
||||
}
|
||||
@@ -62,6 +65,7 @@ const DeleteTagModal = ({
|
||||
onCloseAndUpdate,
|
||||
bucketName,
|
||||
versionId,
|
||||
distributedSetup,
|
||||
setErrorSnackMessage,
|
||||
classes,
|
||||
}: IDeleteTagModal) => {
|
||||
@@ -73,10 +77,12 @@ const DeleteTagModal = ({
|
||||
const cleanObject = { ...currentTags };
|
||||
delete cleanObject[tagKey];
|
||||
|
||||
const verID = distributedSetup ? versionId : "null";
|
||||
|
||||
api
|
||||
.invoke(
|
||||
"PUT",
|
||||
`/api/v1/buckets/${bucketName}/objects/tags?prefix=${selectedObject}&version_id=${versionId}`,
|
||||
`/api/v1/buckets/${bucketName}/objects/tags?prefix=${selectedObject}&version_id=${verID}`,
|
||||
{ tags: cleanObject }
|
||||
)
|
||||
.then((res: any) => {
|
||||
@@ -127,10 +133,14 @@ const DeleteTagModal = ({
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = ({ system }: AppState) => ({
|
||||
distributedSetup: get(system, "distributedSetup", false),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = {
|
||||
setErrorSnackMessage,
|
||||
};
|
||||
|
||||
const connector = connect(null, mapDispatchToProps);
|
||||
const connector = connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
export default withStyles(styles)(connector(DeleteTagModal));
|
||||
|
||||
@@ -40,10 +40,7 @@ import {
|
||||
fileIsBeingPrepared,
|
||||
removeRouteLevel,
|
||||
} from "../../../../ObjectBrowser/actions";
|
||||
import {
|
||||
ObjectBrowserReducer,
|
||||
Route,
|
||||
} from "../../../../ObjectBrowser/reducers";
|
||||
import { Route } from "../../../../ObjectBrowser/reducers";
|
||||
import { download } from "../utils";
|
||||
import history from "../../../../../../history";
|
||||
import api from "../../../../../../common/api";
|
||||
@@ -66,6 +63,7 @@ import {
|
||||
setSnackBarMessage,
|
||||
} from "../../../../../../actions";
|
||||
import { CircularProgress } from "@material-ui/core";
|
||||
import { AppState } from "../../../../../../store";
|
||||
|
||||
const styles = (theme: Theme) =>
|
||||
createStyles({
|
||||
@@ -167,6 +165,7 @@ interface IObjectDetailsProps {
|
||||
rewindEnabled: boolean;
|
||||
rewindDate: any;
|
||||
bucketToRewind: string;
|
||||
distributedSetup: boolean;
|
||||
removeRouteLevel: (newRoute: string) => any;
|
||||
setErrorSnackMessage: typeof setErrorSnackMessage;
|
||||
setSnackBarMessage: typeof setSnackBarMessage;
|
||||
@@ -192,6 +191,7 @@ const ObjectDetails = ({
|
||||
downloadingFiles,
|
||||
rewindEnabled,
|
||||
rewindDate,
|
||||
distributedSetup,
|
||||
bucketToRewind,
|
||||
removeRouteLevel,
|
||||
setErrorSnackMessage,
|
||||
@@ -223,14 +223,22 @@ const ObjectDetails = ({
|
||||
api
|
||||
.invoke(
|
||||
"GET",
|
||||
`/api/v1/buckets/${bucketName}/objects?prefix=${encodedPath}&with_versions=true`
|
||||
`/api/v1/buckets/${bucketName}/objects?prefix=${encodedPath}${
|
||||
distributedSetup ? "&with_versions=true" : ""
|
||||
}`
|
||||
)
|
||||
.then((res: IFileInfo[]) => {
|
||||
const result = get(res, "objects", []);
|
||||
setActualInfo(
|
||||
result.find((el: IFileInfo) => el.is_latest) || emptyFile
|
||||
);
|
||||
setVersions(result);
|
||||
if (distributedSetup) {
|
||||
setActualInfo(
|
||||
result.find((el: IFileInfo) => el.is_latest) || emptyFile
|
||||
);
|
||||
setVersions(result);
|
||||
} else {
|
||||
setActualInfo(result[0]);
|
||||
setVersions([]);
|
||||
}
|
||||
|
||||
setLoadObjectData(false);
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -238,7 +246,13 @@ const ObjectDetails = ({
|
||||
setLoadObjectData(false);
|
||||
});
|
||||
}
|
||||
}, [loadObjectData, bucketName, pathInBucket, setErrorSnackMessage]);
|
||||
}, [
|
||||
loadObjectData,
|
||||
bucketName,
|
||||
pathInBucket,
|
||||
setErrorSnackMessage,
|
||||
distributedSetup,
|
||||
]);
|
||||
|
||||
let tagKeys: string[] = [];
|
||||
|
||||
@@ -543,6 +557,7 @@ const ObjectDetails = ({
|
||||
</div>
|
||||
</div>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12} className={classes.tagsContainer}>
|
||||
<div className={classes.tagText}>Tags:</div>
|
||||
{tagKeys &&
|
||||
@@ -644,11 +659,12 @@ const ObjectDetails = ({
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = ({ objectBrowser }: ObjectBrowserReducer) => ({
|
||||
const mapStateToProps = ({ objectBrowser, system }: AppState) => ({
|
||||
downloadingFiles: get(objectBrowser, "downloadingFiles", []),
|
||||
rewindEnabled: get(objectBrowser, "rewind.rewindEnabled", false),
|
||||
rewindDate: get(objectBrowser, "rewind.dateToRewind", null),
|
||||
bucketToRewind: get(objectBrowser, "rewind.bucketToRewind", ""),
|
||||
distributedSetup: get(system, "distributedSetup", false),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import get from "lodash/get";
|
||||
import { connect } from "react-redux";
|
||||
import { createStyles, Theme, withStyles } from "@material-ui/core/styles";
|
||||
import CopyToClipboard from "react-copy-to-clipboard";
|
||||
@@ -31,6 +32,7 @@ import api from "../../../../../../common/api";
|
||||
import ModalWrapper from "../../../../Common/ModalWrapper/ModalWrapper";
|
||||
import DateSelector from "../../../../Common/FormComponents/DateSelector/DateSelector";
|
||||
import PredefinedList from "../../../../Common/FormComponents/PredefinedList/PredefinedList";
|
||||
import { AppState } from "../../../../../../store";
|
||||
|
||||
const styles = (theme: Theme) =>
|
||||
createStyles({
|
||||
@@ -48,6 +50,7 @@ interface IShareFileProps {
|
||||
open: boolean;
|
||||
bucketName: string;
|
||||
dataObject: IFileInfo;
|
||||
distributedSetup: boolean;
|
||||
closeModalAndRefresh: () => void;
|
||||
setModalSnackMessage: typeof setModalSnackMessage;
|
||||
setModalErrorSnackMessage: typeof setModalErrorSnackMessage;
|
||||
@@ -59,6 +62,7 @@ const ShareFile = ({
|
||||
closeModalAndRefresh,
|
||||
bucketName,
|
||||
dataObject,
|
||||
distributedSetup,
|
||||
setModalSnackMessage,
|
||||
setModalErrorSnackMessage,
|
||||
}: IShareFileProps) => {
|
||||
@@ -86,6 +90,8 @@ const ShareFile = ({
|
||||
|
||||
const diffDate = slDate.getTime() - currDate.getTime();
|
||||
|
||||
const versID = distributedSetup ? dataObject.version_id : "null";
|
||||
|
||||
if (diffDate < 0) {
|
||||
setModalErrorSnackMessage(
|
||||
"Selected date must be greater than current time."
|
||||
@@ -111,7 +117,7 @@ const ShareFile = ({
|
||||
"GET",
|
||||
`/api/v1/buckets/${bucketName}/objects/share?prefix=${
|
||||
dataObject.name
|
||||
}&version_id=${dataObject.version_id}${
|
||||
}&version_id=${versID}${
|
||||
selectedDate !== "" ? `&expires=${diffDate}ms` : ""
|
||||
}`
|
||||
)
|
||||
@@ -133,6 +139,7 @@ const ShareFile = ({
|
||||
dateValid,
|
||||
setShareURL,
|
||||
setModalErrorSnackMessage,
|
||||
distributedSetup,
|
||||
]);
|
||||
|
||||
return (
|
||||
@@ -180,7 +187,11 @@ const ShareFile = ({
|
||||
);
|
||||
};
|
||||
|
||||
const connector = connect(null, {
|
||||
const mapStateToProps = ({ system }: AppState) => ({
|
||||
distributedSetup: get(system, "distributedSetup", false),
|
||||
});
|
||||
|
||||
const connector = connect(mapStateToProps, {
|
||||
setModalSnackMessage,
|
||||
setModalErrorSnackMessage,
|
||||
});
|
||||
|
||||
@@ -31,6 +31,7 @@ import { ISessionResponse } from "../types";
|
||||
interface IConfigurationMain {
|
||||
classes: any;
|
||||
session: ISessionResponse;
|
||||
distributedSetup: boolean;
|
||||
}
|
||||
|
||||
const styles = (theme: Theme) =>
|
||||
@@ -44,7 +45,11 @@ const styles = (theme: Theme) =>
|
||||
...containerForHeader(theme.spacing(4)),
|
||||
});
|
||||
|
||||
const ConfigurationMain = ({ classes, session }: IConfigurationMain) => {
|
||||
const ConfigurationMain = ({
|
||||
classes,
|
||||
session,
|
||||
distributedSetup,
|
||||
}: IConfigurationMain) => {
|
||||
const [selectedTab, setSelectedTab] = useState<number>(0);
|
||||
|
||||
return (
|
||||
@@ -65,7 +70,7 @@ const ConfigurationMain = ({ classes, session }: IConfigurationMain) => {
|
||||
>
|
||||
<Tab label="Configurations" />
|
||||
<Tab label="Lambda Notifications" />
|
||||
<Tab label="Tiers" />
|
||||
<Tab label="Tiers" disabled={!distributedSetup} />
|
||||
</Tabs>
|
||||
<Grid item xs={12}>
|
||||
{selectedTab === 0 && (
|
||||
@@ -78,7 +83,7 @@ const ConfigurationMain = ({ classes, session }: IConfigurationMain) => {
|
||||
<ListNotificationEndpoints />
|
||||
</Grid>
|
||||
)}
|
||||
{selectedTab === 2 && (
|
||||
{selectedTab === 2 && distributedSetup && (
|
||||
<Grid item xs={12}>
|
||||
<ListTiersConfiguration />
|
||||
</Grid>
|
||||
@@ -92,6 +97,7 @@ const ConfigurationMain = ({ classes, session }: IConfigurationMain) => {
|
||||
|
||||
const mapState = (state: AppState) => ({
|
||||
session: state.console.session,
|
||||
distributedSetup: state.system.distributedSetup,
|
||||
});
|
||||
|
||||
const connector = connect(mapState, {});
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
LinearProgress,
|
||||
} from "@material-ui/core";
|
||||
import api from "../../../../common/api";
|
||||
import { IPodListElement, ITenant } from "../ListTenants/types";
|
||||
import { IPodListElement } from "../ListTenants/types";
|
||||
import InputBoxWrapper from "../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper";
|
||||
import Grid from "@material-ui/core/Grid";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
@@ -48,7 +48,6 @@ const PodsSummary = ({ match, history, loadingTenant }: IPodsSummary) => {
|
||||
const [loadingPods, setLoadingPods] = useState<boolean>(true);
|
||||
const [deleteOpen, setDeleteOpen] = useState<boolean>(false);
|
||||
const [selectedPod, setSelectedPod] = useState<any>(null);
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
|
||||
const tenantName = match.params["tenantName"];
|
||||
const tenantNamespace = match.params["tenantNamespace"];
|
||||
@@ -62,10 +61,6 @@ const PodsSummary = ({ match, history, loadingTenant }: IPodsSummary) => {
|
||||
|
||||
const closeDeleteModalAndRefresh = (reloadData: boolean) => {
|
||||
setDeleteOpen(false);
|
||||
|
||||
if (reloadData) {
|
||||
setIsLoading(true);
|
||||
}
|
||||
};
|
||||
|
||||
const confirmDeletePod = (pod: IPodListElement) => {
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
setTenantInfo,
|
||||
setTenantTab,
|
||||
} from "../actions";
|
||||
import { IPodListElement, ITenant } from "../ListTenants/types";
|
||||
import { ITenant } from "../ListTenants/types";
|
||||
import {
|
||||
containerForHeader,
|
||||
tenantDetailsStyles,
|
||||
|
||||
@@ -27,6 +27,7 @@ const initialState: ConsoleState = {
|
||||
status: "",
|
||||
pages: [],
|
||||
features: [],
|
||||
distributedMode: false,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -19,4 +19,5 @@ export interface ISessionResponse {
|
||||
pages: string[];
|
||||
features: string[];
|
||||
operator: boolean;
|
||||
distributedMode: boolean;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ export interface SystemState {
|
||||
snackBar: snackBarMessage;
|
||||
modalSnackBar: snackBarMessage;
|
||||
serverDiagnosticStatus: string;
|
||||
distributedSetup: boolean;
|
||||
}
|
||||
|
||||
export const USER_LOGGED = "USER_LOGGED";
|
||||
@@ -43,6 +44,7 @@ export const SET_SERVER_DIAG_STAT = "SET_SERVER_DIAG_STAT";
|
||||
export const SET_ERROR_SNACK_MESSAGE = "SET_ERROR_SNACK_MESSAGE";
|
||||
export const SET_SNACK_MODAL_MESSAGE = "SET_SNACK_MODAL_MESSAGE";
|
||||
export const SET_MODAL_ERROR_MESSAGE = "SET_MODAL_ERROR_MESSAGE";
|
||||
export const GLOBAL_SET_DISTRIBUTED_SETUP = "GLOBAL/SET_DISTRIBUTED_SETUP";
|
||||
|
||||
interface UserLoggedAction {
|
||||
type: typeof USER_LOGGED;
|
||||
@@ -98,6 +100,11 @@ interface SetModalErrorMessage {
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface SetDistributedSetup {
|
||||
type: typeof GLOBAL_SET_DISTRIBUTED_SETUP;
|
||||
distributedSetup: boolean;
|
||||
}
|
||||
|
||||
export type SystemActionTypes =
|
||||
| UserLoggedAction
|
||||
| OperatorModeAction
|
||||
@@ -109,4 +116,5 @@ export type SystemActionTypes =
|
||||
| SetSnackBarMessage
|
||||
| SetErrorSnackMessage
|
||||
| SetModalSnackMessage
|
||||
| SetModalErrorMessage;
|
||||
| SetModalErrorMessage
|
||||
| SetDistributedSetup;
|
||||
|
||||
@@ -2886,62 +2886,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/subscription/refresh": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Refresh existing subscription license",
|
||||
"operationId": "SubscriptionRefresh",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/license"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/subscription/validate": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Validates subscription license",
|
||||
"operationId": "SubscriptionValidate",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subscriptionValidateRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/license"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -4880,6 +4824,9 @@ func init() {
|
||||
"sessionResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"distributedMode": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"features": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@@ -5058,20 +5005,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"subscriptionValidateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"license": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tier": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -8284,62 +8217,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/subscription/refresh": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Refresh existing subscription license",
|
||||
"operationId": "SubscriptionRefresh",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/license"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/subscription/validate": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Validates subscription license",
|
||||
"operationId": "SubscriptionValidate",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subscriptionValidateRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/license"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -10388,6 +10265,9 @@ func init() {
|
||||
"sessionResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"distributedMode": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"features": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@@ -10566,20 +10446,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"subscriptionValidateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"license": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tier": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// SubscriptionRefreshHandlerFunc turns a function with the right signature into a subscription refresh handler
|
||||
type SubscriptionRefreshHandlerFunc func(SubscriptionRefreshParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn SubscriptionRefreshHandlerFunc) Handle(params SubscriptionRefreshParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// SubscriptionRefreshHandler interface for that can handle valid subscription refresh params
|
||||
type SubscriptionRefreshHandler interface {
|
||||
Handle(SubscriptionRefreshParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewSubscriptionRefresh creates a new http.Handler for the subscription refresh operation
|
||||
func NewSubscriptionRefresh(ctx *middleware.Context, handler SubscriptionRefreshHandler) *SubscriptionRefresh {
|
||||
return &SubscriptionRefresh{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* SubscriptionRefresh swagger:route POST /subscription/refresh AdminAPI subscriptionRefresh
|
||||
|
||||
Refresh existing subscription license
|
||||
|
||||
*/
|
||||
type SubscriptionRefresh struct {
|
||||
Context *middleware.Context
|
||||
Handler SubscriptionRefreshHandler
|
||||
}
|
||||
|
||||
func (o *SubscriptionRefresh) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewSubscriptionRefreshParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// NewSubscriptionRefreshParams creates a new SubscriptionRefreshParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewSubscriptionRefreshParams() SubscriptionRefreshParams {
|
||||
|
||||
return SubscriptionRefreshParams{}
|
||||
}
|
||||
|
||||
// SubscriptionRefreshParams contains all the bound params for the subscription refresh operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters SubscriptionRefresh
|
||||
type SubscriptionRefreshParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewSubscriptionRefreshParams() beforehand.
|
||||
func (o *SubscriptionRefreshParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// SubscriptionRefreshOKCode is the HTTP code returned for type SubscriptionRefreshOK
|
||||
const SubscriptionRefreshOKCode int = 200
|
||||
|
||||
/*SubscriptionRefreshOK A successful response.
|
||||
|
||||
swagger:response subscriptionRefreshOK
|
||||
*/
|
||||
type SubscriptionRefreshOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.License `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewSubscriptionRefreshOK creates SubscriptionRefreshOK with default headers values
|
||||
func NewSubscriptionRefreshOK() *SubscriptionRefreshOK {
|
||||
|
||||
return &SubscriptionRefreshOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the subscription refresh o k response
|
||||
func (o *SubscriptionRefreshOK) WithPayload(payload *models.License) *SubscriptionRefreshOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the subscription refresh o k response
|
||||
func (o *SubscriptionRefreshOK) SetPayload(payload *models.License) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *SubscriptionRefreshOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*SubscriptionRefreshDefault Generic error response.
|
||||
|
||||
swagger:response subscriptionRefreshDefault
|
||||
*/
|
||||
type SubscriptionRefreshDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewSubscriptionRefreshDefault creates SubscriptionRefreshDefault with default headers values
|
||||
func NewSubscriptionRefreshDefault(code int) *SubscriptionRefreshDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &SubscriptionRefreshDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the subscription refresh default response
|
||||
func (o *SubscriptionRefreshDefault) WithStatusCode(code int) *SubscriptionRefreshDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the subscription refresh default response
|
||||
func (o *SubscriptionRefreshDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the subscription refresh default response
|
||||
func (o *SubscriptionRefreshDefault) WithPayload(payload *models.Error) *SubscriptionRefreshDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the subscription refresh default response
|
||||
func (o *SubscriptionRefreshDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *SubscriptionRefreshDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// SubscriptionRefreshURL generates an URL for the subscription refresh operation
|
||||
type SubscriptionRefreshURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *SubscriptionRefreshURL) WithBasePath(bp string) *SubscriptionRefreshURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *SubscriptionRefreshURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *SubscriptionRefreshURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/subscription/refresh"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *SubscriptionRefreshURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *SubscriptionRefreshURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *SubscriptionRefreshURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on SubscriptionRefreshURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on SubscriptionRefreshURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *SubscriptionRefreshURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// SubscriptionValidateHandlerFunc turns a function with the right signature into a subscription validate handler
|
||||
type SubscriptionValidateHandlerFunc func(SubscriptionValidateParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn SubscriptionValidateHandlerFunc) Handle(params SubscriptionValidateParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// SubscriptionValidateHandler interface for that can handle valid subscription validate params
|
||||
type SubscriptionValidateHandler interface {
|
||||
Handle(SubscriptionValidateParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewSubscriptionValidate creates a new http.Handler for the subscription validate operation
|
||||
func NewSubscriptionValidate(ctx *middleware.Context, handler SubscriptionValidateHandler) *SubscriptionValidate {
|
||||
return &SubscriptionValidate{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* SubscriptionValidate swagger:route POST /subscription/validate AdminAPI subscriptionValidate
|
||||
|
||||
Validates subscription license
|
||||
|
||||
*/
|
||||
type SubscriptionValidate struct {
|
||||
Context *middleware.Context
|
||||
Handler SubscriptionValidateHandler
|
||||
}
|
||||
|
||||
func (o *SubscriptionValidate) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewSubscriptionValidateParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// NewSubscriptionValidateParams creates a new SubscriptionValidateParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewSubscriptionValidateParams() SubscriptionValidateParams {
|
||||
|
||||
return SubscriptionValidateParams{}
|
||||
}
|
||||
|
||||
// SubscriptionValidateParams contains all the bound params for the subscription validate operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters SubscriptionValidate
|
||||
type SubscriptionValidateParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.SubscriptionValidateRequest
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewSubscriptionValidateParams() beforehand.
|
||||
func (o *SubscriptionValidateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body models.SubscriptionValidateRequest
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
}
|
||||
} else {
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(context.Background())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// SubscriptionValidateOKCode is the HTTP code returned for type SubscriptionValidateOK
|
||||
const SubscriptionValidateOKCode int = 200
|
||||
|
||||
/*SubscriptionValidateOK A successful response.
|
||||
|
||||
swagger:response subscriptionValidateOK
|
||||
*/
|
||||
type SubscriptionValidateOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.License `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewSubscriptionValidateOK creates SubscriptionValidateOK with default headers values
|
||||
func NewSubscriptionValidateOK() *SubscriptionValidateOK {
|
||||
|
||||
return &SubscriptionValidateOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the subscription validate o k response
|
||||
func (o *SubscriptionValidateOK) WithPayload(payload *models.License) *SubscriptionValidateOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the subscription validate o k response
|
||||
func (o *SubscriptionValidateOK) SetPayload(payload *models.License) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *SubscriptionValidateOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*SubscriptionValidateDefault Generic error response.
|
||||
|
||||
swagger:response subscriptionValidateDefault
|
||||
*/
|
||||
type SubscriptionValidateDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewSubscriptionValidateDefault creates SubscriptionValidateDefault with default headers values
|
||||
func NewSubscriptionValidateDefault(code int) *SubscriptionValidateDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &SubscriptionValidateDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the subscription validate default response
|
||||
func (o *SubscriptionValidateDefault) WithStatusCode(code int) *SubscriptionValidateDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the subscription validate default response
|
||||
func (o *SubscriptionValidateDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the subscription validate default response
|
||||
func (o *SubscriptionValidateDefault) WithPayload(payload *models.Error) *SubscriptionValidateDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the subscription validate default response
|
||||
func (o *SubscriptionValidateDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *SubscriptionValidateDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// SubscriptionValidateURL generates an URL for the subscription validate operation
|
||||
type SubscriptionValidateURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *SubscriptionValidateURL) WithBasePath(bp string) *SubscriptionValidateURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *SubscriptionValidateURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *SubscriptionValidateURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/subscription/validate"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *SubscriptionValidateURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *SubscriptionValidateURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *SubscriptionValidateURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on SubscriptionValidateURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on SubscriptionValidateURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *SubscriptionValidateURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -323,12 +323,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
AdminAPISubscriptionInfoHandler: admin_api.SubscriptionInfoHandlerFunc(func(params admin_api.SubscriptionInfoParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin_api.SubscriptionInfo has not yet been implemented")
|
||||
}),
|
||||
AdminAPISubscriptionRefreshHandler: admin_api.SubscriptionRefreshHandlerFunc(func(params admin_api.SubscriptionRefreshParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin_api.SubscriptionRefresh has not yet been implemented")
|
||||
}),
|
||||
AdminAPISubscriptionValidateHandler: admin_api.SubscriptionValidateHandlerFunc(func(params admin_api.SubscriptionValidateParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin_api.SubscriptionValidate has not yet been implemented")
|
||||
}),
|
||||
AdminAPITiersListHandler: admin_api.TiersListHandlerFunc(func(params admin_api.TiersListParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin_api.TiersList has not yet been implemented")
|
||||
}),
|
||||
@@ -571,10 +565,6 @@ type ConsoleAPI struct {
|
||||
UserAPIShareObjectHandler user_api.ShareObjectHandler
|
||||
// AdminAPISubscriptionInfoHandler sets the operation handler for the subscription info operation
|
||||
AdminAPISubscriptionInfoHandler admin_api.SubscriptionInfoHandler
|
||||
// AdminAPISubscriptionRefreshHandler sets the operation handler for the subscription refresh operation
|
||||
AdminAPISubscriptionRefreshHandler admin_api.SubscriptionRefreshHandler
|
||||
// AdminAPISubscriptionValidateHandler sets the operation handler for the subscription validate operation
|
||||
AdminAPISubscriptionValidateHandler admin_api.SubscriptionValidateHandler
|
||||
// AdminAPITiersListHandler sets the operation handler for the tiers list operation
|
||||
AdminAPITiersListHandler admin_api.TiersListHandler
|
||||
// UserAPIUpdateBucketLifecycleHandler sets the operation handler for the update bucket lifecycle operation
|
||||
@@ -930,12 +920,6 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.AdminAPISubscriptionInfoHandler == nil {
|
||||
unregistered = append(unregistered, "admin_api.SubscriptionInfoHandler")
|
||||
}
|
||||
if o.AdminAPISubscriptionRefreshHandler == nil {
|
||||
unregistered = append(unregistered, "admin_api.SubscriptionRefreshHandler")
|
||||
}
|
||||
if o.AdminAPISubscriptionValidateHandler == nil {
|
||||
unregistered = append(unregistered, "admin_api.SubscriptionValidateHandler")
|
||||
}
|
||||
if o.AdminAPITiersListHandler == nil {
|
||||
unregistered = append(unregistered, "admin_api.TiersListHandler")
|
||||
}
|
||||
@@ -1397,14 +1381,6 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/subscription/info"] = admin_api.NewSubscriptionInfo(o.context, o.AdminAPISubscriptionInfoHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/subscription/refresh"] = admin_api.NewSubscriptionRefresh(o.context, o.AdminAPISubscriptionRefreshHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/subscription/validate"] = admin_api.NewSubscriptionValidate(o.context, o.AdminAPISubscriptionValidateHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
|
||||
@@ -17,13 +17,39 @@
|
||||
package restapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/console/pkg/acl"
|
||||
"github.com/minio/console/restapi/operations"
|
||||
"github.com/minio/console/restapi/operations/user_api"
|
||||
"github.com/minio/madmin-go"
|
||||
)
|
||||
|
||||
func validateDistributedMode(session *models.Principal) bool {
|
||||
ctx := context.Background()
|
||||
mAdmin, err := NewMinioAdminClient(session)
|
||||
|
||||
// We couldn't create the client, return false
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
// create a minioClient interface implementation
|
||||
client := AdminClient{Client: mAdmin}
|
||||
|
||||
info, err := client.AccountInfo(ctx)
|
||||
|
||||
// We couldn't retrieve admin information
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
backendInfo := info.Server
|
||||
|
||||
return backendInfo.Type == madmin.Erasure
|
||||
}
|
||||
|
||||
func registerSessionHandlers(api *operations.ConsoleAPI) {
|
||||
// session check
|
||||
api.UserAPISessionCheckHandler = user_api.SessionCheckHandlerFunc(func(params user_api.SessionCheckParams, session *models.Principal) middleware.Responder {
|
||||
@@ -41,11 +67,13 @@ func getSessionResponse(session *models.Principal) (*models.SessionResponse, *mo
|
||||
if session == nil {
|
||||
return nil, prepareError(errorGenericInvalidSession)
|
||||
}
|
||||
|
||||
sessionResp := &models.SessionResponse{
|
||||
Pages: acl.GetAuthorizedEndpoints(session.Actions),
|
||||
Features: getListOfEnabledFeatures(),
|
||||
Status: models.SessionResponseStatusOk,
|
||||
Operator: acl.GetOperatorMode(),
|
||||
Pages: acl.GetAuthorizedEndpoints(session.Actions),
|
||||
Features: getListOfEnabledFeatures(),
|
||||
Status: models.SessionResponseStatusOk,
|
||||
Operator: acl.GetOperatorMode(),
|
||||
DistributedMode: validateDistributedMode(session), // TODO: Review why this function is always returning false
|
||||
}
|
||||
return sessionResp, nil
|
||||
}
|
||||
|
||||
@@ -2829,6 +2829,8 @@ definitions:
|
||||
enum: [ok]
|
||||
operator:
|
||||
type: boolean
|
||||
distributedMode:
|
||||
type: boolean
|
||||
widgetResult:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
Reference in New Issue
Block a user