Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #946 from navikt/redirect-gcp
Browse files Browse the repository at this point in the history
Videresend sbs-ingresser til gcp-ingresser med feature-toggle
  • Loading branch information
jrtm authored Oct 7, 2021
2 parents 09d3bd5 + 6009f3f commit d146ca6
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 43 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,43 +57,6 @@ jobs:
CLUSTER: dev-sbs
RESOURCE: nais/naiserator-sbs.yaml
VARS: nais/vars-dev-sbs.yaml
deploy-dev-gcp:
name: Deploy to dev-gcp
needs: test-build-and-push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Lag tag for image
run: echo "TAG=$(git log -1 --pretty='%ad_%h' --date=format:'%Y%m%d%H%M%S')" >> $GITHUB_ENV
- name: Lag full image referanse
run: echo "IMAGE=$IMAGE_BASE:$TAG" >> $GITHUB_ENV
- name: Deploy with nais
uses: nais/deploy/actions/deploy@master
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: nais/naiserator-gcp.yaml
VARS: nais/vars-dev-gcp.yaml
DRY_RUN: true

deploy-prod-gcp:
name: Deploy to prod-gcp
needs: deploy-dev-gcp
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Lag tag for image
run: echo "TAG=$(git log -1 --pretty='%ad_%h' --date=format:'%Y%m%d%H%M%S')" >> $GITHUB_ENV
- name: Lag full image referanse
run: echo "IMAGE=$IMAGE_BASE:$TAG" >> $GITHUB_ENV
- name: Deploy with nais
uses: nais/deploy/actions/deploy@master
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: nais/naiserator-gcp.yaml
VARS: nais/vars-p-gcp.yaml
DRY_RUN: true

deploy-prod-sbs-paw:
name: Deploy to Prod SBS
Expand Down
5 changes: 3 additions & 2 deletions cypress/fixtures/feature-toggle/nedetid-false.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"arbeidssokerregistrering.nedetid": false,
"arbeidssokerregistrering.ingen_kvittering": false
}
"arbeidssokerregistrering.ingen_kvittering": false,
"arbeidssokerregistrering.ny-ingress": false
}
5 changes: 3 additions & 2 deletions cypress/fixtures/feature-toggle/nedetid-true.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"arbeidssokerregistrering.nedetid": true,
"arbeidssokerregistrering.ingen_kvittering": true
}
"arbeidssokerregistrering.ingen_kvittering": true,
"arbeidssokerregistrering.ny-ingress": false
}
8 changes: 7 additions & 1 deletion src/ducks/feature-toggles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export enum ActionTypes {
export interface Data {
"arbeidssokerregistrering.nedetid": boolean;
"arbeidssokerregistrering.ingen_kvittering": boolean;
"arbeidssokerregistrering.ny-ingress": boolean;
}

export interface State {
Expand All @@ -23,12 +24,17 @@ interface Action {
data: Data;
}

export const alleFeatureToggles = ["arbeidssokerregistrering.nedetid", "arbeidssokerregistrering.ingen_kvittering"];
export const alleFeatureToggles = [
"arbeidssokerregistrering.nedetid",
"arbeidssokerregistrering.ingen_kvittering",
"arbeidssokerregistrering.ny-ingress",
];

const initialState = {
data: {
"arbeidssokerregistrering.nedetid": false,
"arbeidssokerregistrering.ingen_kvittering": false,
"arbeidssokerregistrering.ny-ingress": false,
},
status: STATUS.NOT_STARTED,
};
Expand Down
19 changes: 18 additions & 1 deletion src/komponenter/initialdata/hent-initial-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
import {
hentFeatureToggles,
selectFeatureTogglesState,
Data as FeatureToggleData,
State as FeatureToggleState,
} from "../../ducks/feature-toggles";
import Innholdslaster from "../innholdslaster/innholdslaster";
Expand Down Expand Up @@ -46,9 +47,25 @@ interface DispatchProps {

type Props = StateProps & DispatchProps;

function videresendTilNyIngress() {
const { location } = window;
// pathname vil alltid starte med '/'
const komplettSti = location.pathname + location.search + location.hash;

if (location.hostname === "arbeidssokerregistrering.dev.nav.no") {
location.href = "https://arbeid.dev.nav.no/arbeid/registrering" + komplettSti;
} else if (location.hostname === "arbeidssokerregistrering.nav.no") {
location.href = "https://www.nav.no/arbeid/registrering" + komplettSti;
}
}

export class HentInitialData extends React.Component<Props> {
componentDidMount() {
this.props.hentFeatureToggle().then(() => {
this.props.hentFeatureToggle().then((featureToggles) => {
if ((featureToggles as FeatureToggleData)["arbeidssokerregistrering.ny-ingress"]) {
videresendTilNyIngress();
}

this.props.hentAutentiseringsInfo().then((res) => {
if ((res as AuthData).securityLevel === SecurityLevel.Level4) {
this.props.hentRegistreringStatus();
Expand Down
1 change: 1 addition & 0 deletions src/mocks/feature-toggles-mock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const featureTogglesMock = {
"arbeidssokerregistrering.nedetid": false,
"arbeidssokerregistrering.ingen_kvittering": false,
"arbeidssokerregistrering.ny-ingress": false,
};

0 comments on commit d146ca6

Please sign in to comment.