mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Refactor k8s api to common (#3553)
* refactor kube api to common Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * refactor more utils to common Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * refactor more utils to common Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix tests Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * switch to use node-fetch on both sides Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * cleanup Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * improve logger Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix lint errors Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix/improve tests Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix tests Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix node-fetch require error on prod build Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * preload fix Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fixes Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * read serverAddress from apiBase Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * cleanup Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
476aa74101
commit
58a446bd45
250 files changed
+1244
-644
No files matched your search
@@ -25,7 +25,7 @@ import { reaction } from "mobx";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import React from "react";
|
||||
|
||||
import type { ClusterRoleBinding, ClusterRoleBindingSubject } from "../../../api/endpoints";
|
||||
import type { ClusterRoleBinding, ClusterRoleBindingSubject } from "../../../../common/k8s-api/endpoints";
|
||||
import { autoBind, ObservableHashSet, prevDefault } from "../../../utils";
|
||||
import { AddRemoveButtons } from "../../add-remove-buttons";
|
||||
import { ConfirmDialog } from "../../confirm-dialog";
|
||||
|
||||
@@ -26,7 +26,7 @@ import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import React from "react";
|
||||
|
||||
import { serviceAccountsStore } from "../+service-accounts/store";
|
||||
import { ClusterRole, ClusterRoleBinding, ClusterRoleBindingSubject, ServiceAccount } from "../../../api/endpoints";
|
||||
import { ClusterRole, ClusterRoleBinding, ClusterRoleBindingSubject, ServiceAccount } from "../../../../common/k8s-api/endpoints";
|
||||
import { Dialog, DialogProps } from "../../dialog";
|
||||
import { EditableList } from "../../editable-list";
|
||||
import { Icon } from "../../icon";
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
import { MD5 } from "crypto-js";
|
||||
import type { ClusterRoleBindingSubject } from "../../../api/endpoints";
|
||||
import type { ClusterRoleBindingSubject } from "../../../../common/k8s-api/endpoints";
|
||||
|
||||
export function hashClusterRoleBindingSubject(subject: ClusterRoleBindingSubject): string {
|
||||
return MD5(JSON.stringify([
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { apiManager } from "../../../api/api-manager";
|
||||
import { ClusterRoleBinding, clusterRoleBindingApi, ClusterRoleBindingSubject } from "../../../api/endpoints";
|
||||
import { KubeObjectStore } from "../../../kube-object.store";
|
||||
import { apiManager } from "../../../../common/k8s-api/api-manager";
|
||||
import { ClusterRoleBinding, clusterRoleBindingApi, ClusterRoleBindingSubject } from "../../../../common/k8s-api/endpoints";
|
||||
import { KubeObjectStore } from "../../../../common/k8s-api/kube-object.store";
|
||||
import { autoBind, HashSet } from "../../../utils";
|
||||
import { hashClusterRoleBindingSubject } from "./hashers";
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import React from "react";
|
||||
import { DrawerTitle } from "../../drawer";
|
||||
import type { KubeObjectDetailsProps } from "../../kube-object-details";
|
||||
import { KubeObjectMeta } from "../../kube-object-meta";
|
||||
import type { ClusterRole } from "../../../api/endpoints";
|
||||
import type { ClusterRole } from "../../../../common/k8s-api/endpoints";
|
||||
|
||||
interface Props extends KubeObjectDetailsProps<ClusterRole> {
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
import { apiManager } from "../../../api/api-manager";
|
||||
import { ClusterRole, clusterRoleApi } from "../../../api/endpoints";
|
||||
import { KubeObjectStore } from "../../../kube-object.store";
|
||||
import { apiManager } from "../../../../common/k8s-api/api-manager";
|
||||
import { ClusterRole, clusterRoleApi } from "../../../../common/k8s-api/endpoints";
|
||||
import { KubeObjectStore } from "../../../../common/k8s-api/kube-object.store";
|
||||
import { autoBind } from "../../../utils";
|
||||
|
||||
export class ClusterRolesStore extends KubeObjectStore<ClusterRole> {
|
||||
|
||||
@@ -24,7 +24,7 @@ import "./details.scss";
|
||||
import { reaction } from "mobx";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import React from "react";
|
||||
import type { RoleBinding, RoleBindingSubject } from "../../../api/endpoints";
|
||||
import type { RoleBinding, RoleBindingSubject } from "../../../../common/k8s-api/endpoints";
|
||||
import { prevDefault, boundMethod } from "../../../utils";
|
||||
import { AddRemoveButtons } from "../../add-remove-buttons";
|
||||
import { ConfirmDialog } from "../../confirm-dialog";
|
||||
|
||||
@@ -28,7 +28,7 @@ import React from "react";
|
||||
import { rolesStore } from "../+roles/store";
|
||||
import { serviceAccountsStore } from "../+service-accounts/store";
|
||||
import { NamespaceSelect } from "../../+namespaces/namespace-select";
|
||||
import { ClusterRole, Role, roleApi, RoleBinding, RoleBindingSubject, ServiceAccount } from "../../../api/endpoints";
|
||||
import { ClusterRole, Role, roleApi, RoleBinding, RoleBindingSubject, ServiceAccount } from "../../../../common/k8s-api/endpoints";
|
||||
import { Dialog, DialogProps } from "../../dialog";
|
||||
import { EditableList } from "../../editable-list";
|
||||
import { Icon } from "../../icon";
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
import { MD5 } from "crypto-js";
|
||||
import type { RoleBindingSubject } from "../../../api/endpoints";
|
||||
import type { RoleBindingSubject } from "../../../../common/k8s-api/endpoints";
|
||||
|
||||
export function hashRoleBindingSubject(subject: RoleBindingSubject): string {
|
||||
return MD5(JSON.stringify([
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { apiManager } from "../../../api/api-manager";
|
||||
import { RoleBinding, roleBindingApi, RoleBindingSubject } from "../../../api/endpoints";
|
||||
import { KubeObjectStore } from "../../../kube-object.store";
|
||||
import { apiManager } from "../../../../common/k8s-api/api-manager";
|
||||
import { RoleBinding, roleBindingApi, RoleBindingSubject } from "../../../../common/k8s-api/endpoints";
|
||||
import { KubeObjectStore } from "../../../../common/k8s-api/kube-object.store";
|
||||
import { HashSet } from "../../../utils";
|
||||
import { hashRoleBindingSubject } from "./hashers";
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import "./details.scss";
|
||||
import { observer } from "mobx-react";
|
||||
import React from "react";
|
||||
|
||||
import type { Role } from "../../../api/endpoints";
|
||||
import type { Role } from "../../../../common/k8s-api/endpoints";
|
||||
import { DrawerTitle } from "../../drawer";
|
||||
import type { KubeObjectDetailsProps } from "../../kube-object-details";
|
||||
import { KubeObjectMeta } from "../../kube-object-meta";
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
import { apiManager } from "../../../api/api-manager";
|
||||
import { Role, roleApi } from "../../../api/endpoints";
|
||||
import { KubeObjectStore } from "../../../kube-object.store";
|
||||
import { apiManager } from "../../../../common/k8s-api/api-manager";
|
||||
import { Role, roleApi } from "../../../../common/k8s-api/endpoints";
|
||||
import { KubeObjectStore } from "../../../../common/k8s-api/kube-object.store";
|
||||
import { autoBind } from "../../../utils";
|
||||
|
||||
export class RolesStore extends KubeObjectStore<Role> {
|
||||
|
||||
@@ -27,7 +27,7 @@ import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import { secretsStore } from "../../+config-secrets/secrets.store";
|
||||
import { Secret, ServiceAccount } from "../../../api/endpoints";
|
||||
import { Secret, ServiceAccount } from "../../../../common/k8s-api/endpoints";
|
||||
import { DrawerItem, DrawerTitle } from "../../drawer";
|
||||
import { Icon } from "../../icon";
|
||||
import type { KubeObjectDetailsProps } from "../../kube-object-details";
|
||||
|
||||
@@ -24,7 +24,7 @@ import "./secret.scss";
|
||||
import moment from "moment";
|
||||
import React from "react";
|
||||
|
||||
import type { Secret } from "../../../api/endpoints/secret.api";
|
||||
import type { Secret } from "../../../../common/k8s-api/endpoints/secret.api";
|
||||
import { prevDefault } from "../../../utils";
|
||||
import { Icon } from "../../icon";
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { apiManager } from "../../../api/api-manager";
|
||||
import { ServiceAccount, serviceAccountsApi } from "../../../api/endpoints";
|
||||
import { KubeObjectStore } from "../../../kube-object.store";
|
||||
import { apiManager } from "../../../../common/k8s-api/api-manager";
|
||||
import { ServiceAccount, serviceAccountsApi } from "../../../../common/k8s-api/endpoints";
|
||||
import { KubeObjectStore } from "../../../../common/k8s-api/kube-object.store";
|
||||
import { autoBind } from "../../../utils";
|
||||
|
||||
export class ServiceAccountsStore extends KubeObjectStore<ServiceAccount> {
|
||||
|
||||
@@ -24,7 +24,7 @@ import "./view.scss";
|
||||
import { observer } from "mobx-react";
|
||||
import React from "react";
|
||||
import type { RouteComponentProps } from "react-router";
|
||||
import type { ServiceAccount } from "../../../api/endpoints/service-accounts.api";
|
||||
import type { ServiceAccount } from "../../../../common/k8s-api/endpoints/service-accounts.api";
|
||||
import { Icon } from "../../icon";
|
||||
import { KubeObjectListLayout } from "../../kube-object-list-layout";
|
||||
import { KubeObjectStatusIcon } from "../../kube-object-status-icon";
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import type { ServiceAccount } from "../../api/endpoints";
|
||||
import type { KubeObject } from "../../api/kube-object";
|
||||
import type { ServiceAccount } from "../../../common/k8s-api/endpoints";
|
||||
import type { KubeObject } from "../../../common/k8s-api/kube-object";
|
||||
import { Icon } from "../icon";
|
||||
import type { SelectOption } from "../select";
|
||||
import { TooltipPosition } from "../tooltip";
|
||||
|
||||
Reference in new issue
Block a user