Skip to content

Commit

Permalink
chore: normalise log and storage key names for hawtio online
Browse files Browse the repository at this point in the history
  • Loading branch information
tadayosi committed Mar 14, 2024
1 parent cf39ae1 commit b47d12c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/kubernetes-api/src/client/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Logger } from '@hawtio/react'
import { KubeObject } from '../globals'
import { WatchActions, WatchTypes } from '../model'

export const log = Logger.get('hawtio-k8s-objects')
export const log = Logger.get('hawtio-online-k8s-objects')

// Allow clients to add other types to force polling under whatever circumstances
export const pollingOnly = [WatchTypes.IMAGE_STREAM_TAGS]
Expand Down
2 changes: 1 addition & 1 deletion packages/kubernetes-api/src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Logger } from '@hawtio/react'
import { NamespaceSpec, NamespaceStatus, Pod } from 'kubernetes-types/core/v1'
import { ObjectMeta } from 'kubernetes-types/meta/v1'

export const pluginName = 'hawtio-k8s-api'
export const pluginName = 'hawtio-online-k8s-api'
export const log = Logger.get(pluginName)

export const K8S_PREFIX = 'api'
Expand Down
2 changes: 1 addition & 1 deletion packages/management-api/src/globals.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Logger } from '@hawtio/react'

export const pluginName = 'hawtio-management-api'
export const pluginName = 'hawtio-online-management-api'
export const log = Logger.get(pluginName)

/*
Expand Down
4 changes: 1 addition & 3 deletions packages/oauth/src/form/globals.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
export const FORM_AUTH_PROTOCOL_MODULE = 'hawtio-form-auth'

export const FORM_AUTH_PROTOCOL_MODULE_FORM = `${FORM_AUTH_PROTOCOL_MODULE}-login-form`

export const FORM_TOKEN_STORAGE_KEY = 'formAuthToken'
export const FORM_TOKEN_STORAGE_KEY = 'online.oauth.form.token'

export interface FormConfig {
uri: string
Expand Down
3 changes: 2 additions & 1 deletion packages/oauth/src/globals.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Logger } from '@hawtio/react'

export const log = Logger.get('hawtio-oauth')
export const pluginName = 'hawtio-online-oauth'
export const log = Logger.get(pluginName)
export const PATH_OSCONSOLE_CLIENT_CONFIG = 'osconsole/config.json'
export const LOGOUT_ENDPOINT = '/auth/logout'

Expand Down
18 changes: 9 additions & 9 deletions packages/oauth/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { hawtio, HawtioPlugin } from '@hawtio/react'
import { log } from './globals'
import { getActiveProfile } from './api'
import { oAuthService } from './oauth-service'
import { FORM_AUTH_PROTOCOL_MODULE, FORM_AUTH_PROTOCOL_MODULE_FORM } from './form/globals'
import { FormAuthLoginForm } from './form'
import { FORM_AUTH_PROTOCOL_MODULE } from './form/globals'
import { log } from './globals'
import { oAuthService } from './oauth-service'

let initialised = false

Expand All @@ -26,10 +26,10 @@ export function oAuthInitialised(): boolean {
}

export const oAuthInit: HawtioPlugin = async () => {
if (hawtio.getPlugins().filter(plugin => plugin.id === FORM_AUTH_PROTOCOL_MODULE).length === 0) {
if (hawtio.getPlugins().filter(plugin => plugin.id === 'online-oauth').length === 0) {
hawtio.addPlugin({
id: FORM_AUTH_PROTOCOL_MODULE,
title: FORM_AUTH_PROTOCOL_MODULE_FORM,
id: 'online-oauth',
title: 'Online OAuth',
path: '/login',
isLogin: true,
component: FormAuthLoginForm,
Expand All @@ -44,8 +44,8 @@ export const oAuthInit: HawtioPlugin = async () => {
await oAuthRegister()
}

export * from './metadata'
export * from './globals'
export * from './api'
export * from './openshift'
export * from './form'
export * from './globals'
export * from './metadata'
export * from './openshift'
2 changes: 1 addition & 1 deletion packages/oauth/src/openshift/support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { log, UserProfile } from '../globals'
import { logoutRedirect, redirect, relToAbsUrl, secureDispose, secureRetrieve, secureStore } from '../utils'
import { EXPIRES_IN_KEY, OBTAINED_AT_KEY, OpenShiftOAuthConfig, TokenMetadata } from './globals'

const OS_TOKEN_STORAGE_KEY = 'osAuthCreds'
const OS_TOKEN_STORAGE_KEY = 'online.oauth.openshift.credentials'

export function currentTimeSeconds(): number {
return Math.floor(new Date().getTime() / 1000)
Expand Down

0 comments on commit b47d12c

Please sign in to comment.