-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds a modal component to the Organizations table. On clicking the View teams button in the table, this modal opens up displaying all the top level teams of the organization. Signed-off-by: Rashmi-K-A <k.a.rashmi04@gmail.com>
- Loading branch information
1 parent
5ab99ce
commit 631fc7b
Showing
15 changed files
with
1,489 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,157 @@ | ||
import ExpandedOrganization from "./ExpandedOrganization.vue"; | ||
import ExpandedOrganization from './ExpandedOrganization.vue'; | ||
|
||
export default { | ||
title: "ExpandedOrganization", | ||
excludeStories: /.*Data$/ | ||
title: 'ExpandedOrganization', | ||
excludeStories: /.*Data$/, | ||
}; | ||
|
||
const ExpandedOrganizationTemplate = `<expanded-organization :domains="domains" />`; | ||
const ExpandedOrganizationTemplate = `<expanded-organization :domains="domains" :organization="organization" :add-team="addTeam" :delete-team="deleteTeam" :fetch-teams="fetchTeams"/>`; | ||
|
||
export const Default = () => ({ | ||
components: { ExpandedOrganization }, | ||
template: ExpandedOrganizationTemplate, | ||
data: () => ({ | ||
domains: [{ domain: "hogwarts.edu" }, { domain: "hogwarts.com" }] | ||
}) | ||
domains: [{ domain: 'hogwarts.edu' }, { domain: 'hogwarts.com' }], | ||
organization: 'Hogwarts', | ||
query: [ | ||
{ | ||
data: { | ||
teams: { | ||
entities: [ | ||
{ | ||
name: 'BU1', | ||
numchild: 2, | ||
}, | ||
{ | ||
name: 'BU2', | ||
numchild: 0, | ||
}, | ||
{ | ||
name: 'BU3', | ||
numchild: 1, | ||
}, | ||
{ | ||
name: 'Team1', | ||
parent: 'BU1', | ||
numchild: 0, | ||
}, | ||
{ | ||
name: 'Team2', | ||
parent: 'BU1', | ||
numchild: 0, | ||
}, | ||
{ | ||
name: 'Team4', | ||
parent: 'BU3', | ||
numchild: 0, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
], | ||
}), | ||
methods: { | ||
fetchTeams(filters) { | ||
let data = []; | ||
if (Object.keys(filters).includes('parent')) { | ||
this.query[0].data.teams.entities.forEach((team) => { | ||
if (team['parent'] === filters['parent']) { | ||
data.push(team); | ||
} | ||
}); | ||
} else { | ||
this.query[0].data.teams.entities.forEach((team) => { | ||
if (team['parent'] === undefined) { | ||
data.push(team); | ||
} | ||
}); | ||
} | ||
const resp = { | ||
data: { | ||
teams: { | ||
entities: data | ||
}, | ||
}, | ||
}; | ||
return resp; | ||
}, | ||
addTeam(team, organization, parent) { | ||
const insertData = { | ||
name: team, | ||
}; | ||
if (parent) { | ||
insertData['parent'] = parent; | ||
} | ||
this.query[0].data.teams.entities.push(insertData); | ||
return true; | ||
}, | ||
deleteTeam(team, organization) { | ||
this.query[0].data.teams.entities = this.query[0].data.teams.entities.filter( | ||
(elem) => elem.name != team, | ||
); | ||
return true; | ||
}, | ||
}, | ||
}); | ||
|
||
export const Empty = () => ({ | ||
components: { ExpandedOrganization }, | ||
template: ExpandedOrganizationTemplate, | ||
data: () => ({ | ||
domains: [] | ||
}) | ||
domains: [], | ||
organization: 'Hogwarts', | ||
query: [ | ||
{ | ||
data: { | ||
teams: { | ||
entities: [], | ||
}, | ||
}, | ||
}, | ||
], | ||
}), | ||
methods: { | ||
fetchTeams(filters) { | ||
let data = []; | ||
if (Object.keys(filters).includes('parent')) { | ||
this.query[0].data.teams.entities.forEach((team) => { | ||
if (team['parent'] === filters['parent']) { | ||
data.push(team); | ||
} | ||
}); | ||
} else { | ||
this.query[0].data.teams.entities.forEach((team) => { | ||
if (team['parent'] === undefined) { | ||
data.push(team); | ||
} | ||
}); | ||
} | ||
const resp = { | ||
data: { | ||
teams: { | ||
entities: data, | ||
}, | ||
}, | ||
}; | ||
|
||
return resp; | ||
}, | ||
addTeam(team, organization, parent) { | ||
const insertData = { | ||
name: team, | ||
}; | ||
if (parent) { | ||
insertData['parent'] = parent; | ||
} | ||
this.query[0].data.teams.entities.push(insertData); | ||
return true; | ||
}, | ||
deleteTeam(team, organization) { | ||
this.query[0].data.teams.entities = this.query[0].data.teams.entities.filter( | ||
(elem) => elem.name != team, | ||
); | ||
return true; | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.